Calling an external service

An external service is used to call an application or service on a system that is external to IBM® Cloud Pak for Business Automation. The designer provides a discovery mechanism to find the service or application that you want, select the operations that you want, and generate the external service. Many types of services are available, such as a Java service, a web service, a REST service, or an external implementation.

An external service provides an interface that you can use to model a connection to a service or application from the designer. An external service defines operations, their inputs and outputs, and a server that contains information on how to connect to the host server. How you create the external service, and the information that it contains, depends on the type of service or application that you want to call.

REST service

To create an external service that invokes a REST service, you discover the REST service and select the operations that you want to include. The external service is generated when you complete the service discovery. The External Service editor shows the operations that you selected and their inputs and outputs. The binding view shows the server that contains the information for connecting to the host. The source view of the editor shows the REST service source. Depending on the type of operation, you can invoke a REST service in one of the following ways:
  • By selecting an operation in a service task, mapping the inputs and outputs, and calling the service task in a service flow. When you discover a REST service, the operations that you select are included in the external service and they are available for invocation by a service task. See Invoking a REST service.
  • Some REST operations can only be invoked by using JavaScript. These operations are not available for invocation by a service task. When you discover a service, you see a list of such operations, and you can click View explanation for more information. You can view the operations in the source view of the External Service editor. See Invoking a REST service by using JavaScript.
    Note: To make operations available for invocation by using JavaScript, you must complete the service discovery and generate an external service. The operation that you want to invoke must be visible in the source view of the external service.

To invoke a REST service, you also need to specify the location of the host, authorization credentials, and security credentials. This information is defined in a server. An external service has a reference to the server that contains the connection information. See Specifying a REST server.

Service providers often change or update their REST service, which requires you to update the service in the designer. To update the service, you must rediscover it. When you discover a service that already exists in the designer, you can choose to replace the existing service or create a new one. Typically, you need to rediscover the service when an operation or its parameters change. If the connection information changes, you do not need to rediscover the service. You can change the properties in the server, or create a new server, and point the external service to it.

Web service

To invoke a web service, you discover the WSDL file from a URL and select the operations that you want to include. The external service is generated when you complete the service discovery. Each external service maps to a single port type. The external service includes the operations for the port type and the inputs, outputs and faults that are defined in the WSDL for each operation. The external service is bound to a web service server that contains the information for connecting to the host. You can view the operations and binding information in the External Service editor. The source view of the editor shows the WSDL source.

The operations of the external service are available for invocation by a service task. See Invoking a web service.

You can configure a service task to catch errors that are defined as faults in the WSDL. See Catching errors by using error boundary events.

Java service

A Java service invokes a Java application. To create a Java service, discover a JAR file from the library and select a class. An external service is created, with an operation for each method in the class, and inputs and outputs. The service has a binding type of Java.

To invoke the Java class, select an operation in a service task, map the inputs and outputs, and call the service task in a service flow. See Invoking a Java service.

External implementation

An external implementation calls an application that is external to IBM Cloud Pak for Business Automation. To create an external implementation, you create a new external service with an external implementation binding. You can create the operations in the External Service editor.

To call an external application, select an operation in a system task in a process, and map the inputs and outputs. See Invoking an external implementation by using a user task .