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
- In the Data Model Editor, select the operation from which you want to call the external service.
-
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.
- 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.
-
For an XML over HTTP service: In the Service Properties dialog boxes:
- Select message elements for input and output messages.
- Enter the URL on which the real service runs.
- 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.
Create service call activity by importing messages
- In the Data Model Editor, click Activity > Import Activities.
- Select I don't have a service description.
- Select a service protocol.
- Enter the service properties. For details, see Service Properties Page.
- In the Select Service Operation dialog box, select Do not add an activity now.
-
Import messages into the newly created service call activity.
- Select Activity > SCA Description > Learn Schema from Messages.
- Select messages to import. For details, see Learn Schema Dialog Box.
New activities are created based on the imported messages.
- 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.
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![]() |
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.
|
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.