Editing a service stub

Service stubs are generated with a single default response for each operation in the WSDL specification. You can edit the service stub to change the default responses or to add conditional responses that can simulate the actual service.

Procedure

To edit the behavior of a service stub:
  1. In the test navigator, double-click the stub to open the stub editor.
    Each operation simulated by the stub is represented by an operation element, which contains Case elements that describe a condition. Each case contains a response element. Case elements are similar to test verification points and use the same presentation.
  2. To change the default response of an operation:
    1. Expand the operation and the Case : Default element, and then select the response element.
      The Case : Default element describes the response of the service stub when no other case condition is met.
    2. Edit the Message content to specify the XML content returned by the service stub.
  3. To add a conditional response case:
    1. Right-click the operation and select Add > Equals Case, Contains Case, or Query Case.
      These conditional case types are similar to the Equals, Contain and Query verification points in service tests.
      • Use Equal Case to specify a response that is returned by the stub when the entire incoming message content fully matches the specified message content.
      • Use Contains Case to specify a response that is returned by the service stub when a portion of the incoming message content matches the specified message content.
      • Use Query Case to specify a response that is returned by the service stub when an XPath query meets the specified criteria.
      You can add as many case elements as necessary to simulate the behavior of the original service. Use the Up and Down buttons to change the order in which the case conditions are evaluated. Only the first matching condition is executed.

      The default case cannot be removed and is always the last case element in the operation.

    2. Select the response element and edit the Message content to specify the XML content returned by the service stub. Use the Form, Tree, and Source views to change the XML content display mode.
  4. Select File > Save or click the Save toolbar button.

What to do next

When you have finished editing the service stub, you can deploy the stub to a stub server.