Invoking Web services by using an automatically generated self-defined operation

This section describes how to use the Web services self-defined operation feature that is included in IBM® WebSphere® Multichannel Bank Transformation Toolkit. The Web services self-defined operation feature automatically generates the self-defined operation that is required to invoke the Web services that you want to use.

Before you begin

If you are retrieving the WSDL file from IBM WebSphere Service Registry and Repository (WSRR), you must first specify the WSRR host address and port number in IBM Rational® Application Developer. For information on setting your WSRR preferences, see the WebSphere Service Registry and Repository section.

About this task

The Web services self-defined operation feature automatically generates the self-defined operation that is required to invoke the Web services that you want to use. Using the Web services self-defined operation feature means that you do not have to manually generate the data and the context for a self-defined operation. The Web services self-defined operation feature also automatically creates data mappings between the data elements belonging to theWebSphere Multichannel Bank Transformation Toolkit operation context and the data elements belonging to the Web services.

Procedure

  1. Launch the New Web Services Connector wizard through the WebSphere Multichannel Bank Transformation Toolkit project in which you want to store the definition files and the Java classes of the Web services connector.
    1. Right-click the WebSphere Multichannel Bank Transformation Toolkit project in which you want to store the definition files and the Java classes for the Web services connector.
    2. Click BTT Tools > Generate Self-defined Operations.
  2. In this wizard, you can either select the WSDL file of the web services from a URL or from the workspace, if the web service was previously created in the development environment by the technical developers or the WSDL files for remote web services have been imported into the workspace as part of the environment configuration. In both cases the technical developers should tell you where the WSDL file is located. The following fig shows how to input WSDL location from Workspace. When finished, press OK and move to the next step.
    The Select WSDL page of the New Web Services Connector wizard.
  3. Click Next. The Generate Web Services Client wizard opens. You have to select the BTT Project folder in which the operation implementation class will be created and the Target package, meaning the WSDL namespace to package mapping. You can keep this field blank and then the default mapping will be used. For the other fields, you can also keep the default values.
    The Generate Web Services Client page.
  4. Click Next. Now the Service information wizard opens.
    The Service Information page.
    Two attributes are especially important in this wizard: the web service connector (WSConnector) and the Endpoint address.
    • web service connector (WSConnector): The toolkit provides a default WS connector that registers the handlers that add to the web service messages the architecture and security headers: com.ibm.btt.services.ws.javax.BTTJaxWsHeaderConnector. This connector is selected by default.
    • EndPoint address: You have to select the address of the web service function you want to generate the operation for. The URL in which the web service is published depending on the different application deployment environments. Your development environment can be configured by the technical developers so that a variable represents the web services server location. The variable for target web services server is resolved to a real URL address during runtime. See below an example of such a variable, esbHost
  5. Click Next. The Derive Self-defined Operations panel opens. The default implementation class for all automatically generated web service access operation is com.ibm.btt.base.ws.WSAccessOp (a different implementation may be provided by the technical developers and would be specified). Check from the Operation List table, all the web service calls for which you want to generate an operation.
    For a brief description of typed data, refer to the Derive Self-defined Operations page section.
    Note: Several methods are listed as possible web service access calls if the web service does provide different functions. For each of the listed methods, an operation will be created for corresponding to a function provided by a web service and in each case the operation data would be automatically mapped to the request and response web service corresponding function data.
    1. You can check the option ‘Data will be generated with BTT type’.
      • If the option is checked, the tooling verifies for each web service request and response data if there is a defined BTT type matching the web service data type and uses it to define the new operation data. The configuration file defining the type mapping between WSDL types and BTT types must be available to enable this option. For more information about default type mapping, please refer to Default type mapping.
      • If the option is not checked or the corresponding BTT type is not found, the generated BTT data will be one of the default types. For instance, for a complex business object with several attributes, if the type does not exist in BTT, a keyed collection labeled with the business object name and with as many fields as business object attributes is created. The WSDL to BTT type mapping configuration file can also be used to define which XSD type matches with which BTT type (different names) and to map XSD type restrictions to BTT type parameters. Full description on customizing type mapping can be found in section Customized type mapping.
    2. You can also check the option ‘Data will refer to global dictionary’.
      • If the option is checked, the tooling verifies for each element in the web service definition if there is already a defined BTT data in the data dictionary matching id, type and structure ( field or data) and then, instead of creating a new data element, the wizard will create a reference to the existing data. You could refer to Default dataname mapping rule for detailed rules. The name mapping default behavior can be changed by using an extension point; see section Providing ID Mapping During SDO Generation.
      • If this option is not checked, for all elements defined by the web service new BTT data elements will be created locally in the newly generated self-defined operation.
      When adding a reference to an existing data, also the restrictions defined in the WSDL may be added as refData params if they do not match the values of the properties defined for the referred data. In this case, the refData param values will override the referred data values. If the properties values match, then no param child will be added to the refData definition.
  6. Click Finish.