Updating a service response from the service

While you are developing a service test, you can send a request from the test editor to record or update the response element.

Before you begin

Service response elements are children of service request elements. Service tests use response elements to measure the response time between a call and the corresponding response. Response elements can also contain verification points.

You can click Update Response in the request element to complete one of the following actions:
  • Record a response from the service: This method sends the request and records the actual response from the service. For services that use the IBM® WebSphere® MQ or JMS transport protocols, multiple responses can be recorded.
  • Update the current response content: If a response exists, its contents are replaced. If multiple responses are received, the number and order of the responses are updated.
Important: After updating the response content, data correlation or verification points that referred to replaced content might no longer work.
You can use the test editor to create or edit response elements in a service test. There are three methods of adding a service response:
  • Generate a response from Web Services Description Language (WSDL): If the service uses WSDL, then the response is created with the content structure that the WSDL specifies.
  • Add a text response: In this response type, you specify free formatted content for the response.
  • Record a response from the service: This method sends the request and records the actual response from the service.

WebSphere® MQ and JMS requests can contain multiple response elements.

Procedure

To add a response element to a service test:
  1. Open the test in the test editor, and select a service request element.
  2. On the Test Element Details page, click Update Response.
    Alternatively, right-click the service request element, and click Add > Response from Request.
    This action performs the service request. If the request is valid, the Update Response window opens and displays the response data.
  3. In the Return Preview window, review the content of the response to ensure that it is correct.
    For the WebSphere® MQ and JMS protocols, if multiple responses are received, then click the arrows to view each response.
    1. Click the Message tab to view the contents of the response in the Form, Tree or Source view.
    2. Click the Attachment tab to view any resource files that were attached to the response.
    3. Click the Response Properties tab to view the properties of the response.
  4. To use the received response in the test, click Update Test.
    This creates the response elements as a child of the request element or updates the existing response elements with the new data.

What to do next

After creating or updating response elements, you can create verification points on the response contents to test the behavior of the service.