Generating a JavaScript client API for an integration service

An IBM® Integration Bus integration service developer or administrator can generate a JavaScript client API for an existing integration service so that the integration service can be called from an application that is running in a JavaScript environment.

Before you begin

  • You must have an existing integration service that uses the default SOAP/HTTP binding.
  • Ensure that you are not referring to information from SOAP headers or SOAP attachments in your integration service, because this information is not available when the integration service is called by the JavaScript client API.
  • If the JavaScript client API is being generated for use by a web browser-based JavaScript application, then you must configure the IBM Integration Bus environment to support this usage, see Configuring the environment for a web browser-based application that uses the JavaScript client API.

Procedure

Complete the following steps to generate a JavaScript client API from an existing integration service:

  1. In the IBM Integration Toolkit, open your integration service in the integration service editor by double-clicking Integration Service Description in the Application Development view.
  2. Click the Service tab.
    The integration service description is displayed, which includes the SOAP/HTTP binding.
  3. Above the SOAP/HTTP binding, right-click the integration service name and click Generate > JavaScript Client API.
    The JavaScript client API for the integration service is generated and a reference to the JavaScript client API is displayed below the SOAP/HTTP binding.

    The properties of the JavaScript client API are shown in the Properties view when the JavaScript client API is selected in the integration service editor. You can view and edit the JavaScript client API properties from the Properties view.

    Note: The Generate > JavaScript Client API menu option is not available when the JavaScript client API already exists. In normal conditions, you should not need to regenerate the JavaScript client API. When you add new operations to the integration service, or update or delete existing operations, the API is automatically updated when you save the integration service. However, if you want to manually regenerate the JavaScript client API, you must remove the existing API first by right-clicking the JavaScript Client API entry and clicking Remove.

Results

  • JavaScript client API files are generated from the definition of the existing integration service interface. The JavaScript client API files contain code that includes a JavaScript method for each integration service operation.
  • A JSON/HTTP binding is added to the integration service so that JSON (JavaScript Object Notation) messages that are sent from the JavaScript client API can be processed by the integration service.
  • A web page that describes the JavaScript client API is generated. From the web page, the JavaScript developer can download or reference the JavaScript client API code and copy sample code directly into JavaScript applications. The web page is accessed from the integration service URL.

What to do next

  1. Deploy the integration service to an integration server. For more information, see Deploying integration solutions.
  2. Provide JavaScript developers with the integration service URL so that they can download or reference the JavaScript client API files and copy the sample code. The JavaScript developers can use the JavaScript client API to call the integration service. For more information, see Calling an integration service by using a JavaScript client API.