Discovering and invoking a web service

Discover a web service from a URL and generate an external service based on the discovered web service. You can then use the external service in a service flow to invoke the web service.

About this task

To invoke a web service in web Process Designer, you discover the service and select the operations that you want to use. Then, set the server that contains the configuration properties that are required to invoke the service. An external service is generated containing the operations that you selected in the discovered service and a reference to the server that you selected. Business objects are also generated based on the WSDL definition.

Service providers update their services periodically, and you might want to rediscover the updated service so that you can use it. When you discover a service, if an external service discovered from the same URL already exists in Process Designer, you can either overwrite the existing service or create a new one. To get the updated version of the web service, replace the external service. If you have a service task that calls the external service, the operations and data mappings are preserved, unless the operation or data is not included in the new version. If the server connection information is unchanged, you can keep the reference to the server information.

Complete the following steps to discover an existing web service with a WSDL definition and generate an external service that you can use in a service flow.

  1. Create an external service in one of the following ways:
    • Beside Services in the library navigation, click the plus sign (+). Select External Service. In the New External Service page, choose Java, REST or Web service.
    • In the Service Flow editor, select a Service task. In the Implementation tab for the service, click New.
  2. Select one of the following:
    Web service server
    Select the server that you created for the web service.
    URL (WSDL)
    Enter the URL or local filesystem path of the web service definition language (WDSL) file. For example, https://hostname:port/WebService.wsdl or file://localhost/c:/WebService.wsdl.
  3. Each external service maps to a single port type. If the WSDL file has more than one port type, you can select the port type that the generated external service will map to. Click Next.
  4. The discovered operations for the port type are listed. Select the operations that you want to include in the external service, and click Next.
    The list of business objects that will be created is displayed, showing the XML type and the corresponding IBM® BPM type.
    Note: If a business object representing a discovered type already exists in the hierarchy of toolkit dependencies (direct dependencies or toolkits dependent on toolkits), it is not re-created. However, to refer to that business object, an application or toolkit must have a direct dependency on the snapshot of the toolkit that contains the business object. You must add the direct dependency, if it does not exist.
  5. If the web service was already discovered, you can create a new external service or replace the existing one. Click Next.
  6. If you discovered the web service from a URL, you can set the server that contains the properties used to invoke the web service. Either select an existing server, or create a new one based on information in the WSDL definition. Click Finish.

Results

The external service editor opens showing the external service that is created. The external service maps to the port type that you selected and the operations and their inputs, outputs and faults are based on the operations that you selected in the discovered web service.
  • In the Details section, the service name is shown.
  • Selecting Binding shows the binding type of Web Service (SOAP) and the server.
  • Selecting Source shows the WSDL definition source in read-only mode.
  • In the Data library section, there are business objects created as a result of generating the external service.
After your service is created, you can invoke it by performing the following tasks:
  1. Open a service flow.
  2. Drag a Service Task onto the service flow diagram.
  3. In the Implementation tab of the service task, select the external service.
  4. Select the operation that you want to invoke and select a port.
  5. In the Data Mapping tab, map the inputs and outputs.
  6. Optional: Add a SOAP header by creating a new variable in the Variables tab of type SOAPHeader or SOAPHeaders, then map that variable in the Data Mapping tab. For detailed instructions, seeCreating implicit SOAP headers for outbound web service integrations.