I have created an HTTP adapter to call a procedure to add 2 numbers. Its a basic program to send input and display the output. Below is my code.
HTML:
First Integer: <input type="text" id="firstint"/>
Second Integer: <input type="text" id="secondint"/>
<input type="button" onclick="submitInput()" value="Submit"/>
DemoHTTPAdapter-impl.js :
function submitInput() {
var invocationData = {
adapter : 'DemoHTTPAdapter',
procedure : "getDemoAdd",
parameters : [$('#firstint').val(),$('#secondint').val()]
};
var options = {
onSuccess : success,
onFailure : failure
};
WL.Client.invokeProcedure(invocationData, options);
}
function getDemoAdd(firstint, lastint) {
return {
result : com.ibm.demo.DemoAdd.addTwoInteger(firstint,secondint)
}
}
The procedure is invoked through a java code as below in the DemoAdd.java:
package com.ibm.demo;
import java.util.logging.Logger;
public class DemoAdd {
private static final Logger logger = Logger.getLogger(DemoAdd.class.getName());
public static int addTwoInteger(int afirstInt, int aSecondInt) {
logger.info("Add Method Invoked with Parameter " + afirstInt + " & " + aSecondInt);
return (afirstInt + aSecondInt);
}
I am getting an error when I run the html.
submitInput() not defined.
whereas I have already defined the submitInput() method.