Referencing the dojo.js module and the JavaScript client API file
If you are writing a JavaScript application for a web browser client, then you must reference the dojo.js module and the JavaScript client API file that are used to call the integration service.
You must add the following lines of code to your JavaScript application, before
the code that calls the integration service, so that your
application can locate the dojo.js module
and the JavaScript client
API file:
<script type="text/javascript" src="/context_root/namespace/service_name?resource=dojo.js"></script>
<script type="text/javascript" src="/context_root/namespace/service_name?resource=service_name.js"></script>
where: - context_root
- Specifies the context root of the integration service (and the context
root of the proxy servlet). If the context root is set to
/*
, then this entry and the preceding forward slash are omitted. - namespace
- Specifies the namespace of the integration service. By default, the namespace is the name of the integration service.
- service_name
- Specifies the name of the integration service.
The lines of code are required only when the JavaScript application is run in a web browser client. If the lines of code are included in a Node.js application, the code is ignored.
The following
example shows a JavaScript
application where the dojo.js module and
the JavaScript client
API file for an integration service named OperationsService
are specified before the integration service is called:
<script type="text/javascript" src="/OperationsService/OperationsService?resource=dojo.js"></script>
<script type="text/javascript" src="/OperationsService/OperationsService?resource=OperationsService.js"></script>
var multiInputVar =
{
"input1" : "input1Value" ,
"input2" : "input2Value"
};
IBMIntegration.OperationsService.multiInput( multiInputVar, function(errorObj, responseObj))
{
console.log("IBMIntegration.OperationsService.multiInput()");
console.log("Response "+JSON.stringify(responseObj));
console.log("Response="+responseObj.output1);
});