Call External Services

This task describes how to configure a virtual service to call external services.

Note:  

  • This task is part of a higher-level task. For details, see Modify Virtual Service Behavior.
  • Service call activity is supported for:

    • SOAP services over HTTP or JMS
    • XML services over HTTP, JMS, WebSphere MQ, or Filesystem
    • REST services
    • Binary over HTTP or JMS

Create service call activity by importing a service description

  1. In the Data Model Editor, select the operation from which you want to call the external service.
  2. To import a new service description, click Activity > Import Activities. Enter the path to the WSDL for a SOAP service, to the XML schema for an XML service, or to the OpenAPI (Swagger) file for a REST service.

    Note: If you are importing an XML service that requires HTTP authentication, you must add the user name and password to the Service Virtualization credential store.

    • The Identify Name you enter in the credential store must be SCA:<name of called activity>.
    • Alternatively, you can create a global Identity Name SCA which is used if no specific identity exists in the credential store.

    For user interface details, see Edit Credential Store Dialog Box.

  3. For a SOAP service: In the Select Service Operation dialog box, select an activity to add, or import the service description document for use at a later time. For user interface details, see Select Service Operation Dialog Box.
  4. For an XML over HTTP service: In the Service Properties dialog boxes:

    1. Select message elements for input and output messages.
    2. Enter the URL on which the real service runs.
  5. To add a new activity to your data model, select an operation, click Activity again, and select an activity. Choose whether to add it before or after the response.

Back to top

Create service call activity by importing messages

  1. In the Data Model Editor, click Activity > Import Activities.
  2. Select I don't have a service description.
  3. Select a service protocol.
  4. Enter the service properties. For details, see Service Properties Page.
  5. In the Select Service Operation dialog box, select Do not add an activity now.
  6. Import messages into the newly created service call activity.

    1. Select Activity > SCA Description > Learn Schema from Messages.
    2. Select messages to import. For details, see Learn Schema Dialog Box.

    New activities are created based on the imported messages.

  7. To add a new activity to your data model, select an operation, click Activity again, and select an activity. Choose whether to add it before or after the response.

Back to top

Work with service call activity in the Data Model

After you add the service call activity (SCA) to an operation in your data model, you can see it in each rule in the operation. The following options are then available:

Task Details
Edit properties for a SCA Right-click the activity's column header and click Activity Properties. For user interface details, see Activity Properties Dialog Box.
Edit protocol metadata To add, enable, or disable protocol headers, right-click the activity's column header and click Activity Service Description Editor. Then click Edit for request or response metadata. For user interface details, see Edit Metadata Dialog Box.
Remove SCA from a rule Right-click the column header and click Remove Activity.
Enable or disable SCA in a rule Click the on/off icon in the rule's header.
Handle connection failure

To handle connection failure, define a response for the virtual service to return if the service call activity cannot connect to the external service.

  1. Prerequisite: A rule with service call activity enabled.
  2. Create an additional rule with a lower priority than the rule that contains the enabled service call activity.
  3. In the new rule:

    • Turn off the service call activity.
    • Set the service call activity's response Type column with the Is function, and assign the value Service Call Failure. The ServiceCallFailure column is displayed.
    • In the ServiceCallFailure column, select a value for the response: UNKNOWN, HOST_NOT_FOUND, CONNECTION_FAILED, CONNECTION_TIMEOUT. By default, the connection timeout is 100 seconds.

Tip:  

  • You can use the Copy from function on any service call request column, or virtual service response column. Select the Copy from function. The columns that you can use as a source are highlighted. Click the desired source column.
  • Use the Row Detail dialog box for easier configuration of the service call activity. For details, see Row Detail Dialog Box.

Back to top