Recording a service test with the generic service client

You can record a service test by invoking service requests with the generic service client. After you have sent the requests and received the responses from the service, select the results in the History section of the generic service client to generate a test. If you do not have access to a dedicated client for the service calls, the generic service client is the easiest way to generate the calls and to record a test.

Before you begin

If you are testing a SOAP-based web service, ensure that you have access to a valid Web Services Description Language (WSDL) file. The wizard can import WSDL files from the workspace, the file system, a remote repository, or from a URL. Ensure that the WSDL files use the correct syntax for the test environment. The generic service client might not work with some WSDL files.

If you are using Secure Sockets Layer (SSL) authentication, ensure that you have the required key files in your workspace.

If you are using SOAP security, ensure that you have configured the environment with the correct libraries and configuration files. See Configuring the environment for SOAP security for more information.

If the response in a recording or test generation is in XML and the size of the XML data is higher than the value set in the XML Message Received maximum length field, the response is automatically converted to text to avoid any memory issues. To convert the full response to text, the tool checks the value set for Text Message Received maximum length. If the value is lesser than the size of the response, the response is truncated. If you want the response to be in XML when the response size exceeds the value set in XML Message Received maximum length, you can manually increase the value for both recording and test generation. To change the value for recording, click Window > Preferences > Generic Service Client > Message Edition. To change the value for test generation, click Window > Preferences > Test > Test Generation > Service Test Generation.

About this task

You can also record and generate a test by using REST APIs. The API documentation to record a test is located at C:\Program Files\HCL\HCLIMSHARED\plugins\com.ibm.rational.test.lt.server.recorder.jar. The API documentation to generate a test after the recording completes is located at C:\Program Files\HCL\HCLIMSHARED\plugins\com.ibm.rational.test.lt.server.testgen.jar.

To use a WS-SecurityPolicy that is included in a WSDL or an external XML file, you need to configure the security policy as described in Using a security policy. If a recording contains the Security Assertion Markup Language (SAML) token, the WS Security policy file must rely on the Service Token Service (STS) that produces the token. This token can then be used for encryption or other purposes as was designed.

Sample policy file that relies on SAML token:
<sp:SupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:IssuedToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
<sp:Issuer>
<Address xmlns="http://www.w3.org/2005/08/addressing">http://9.143.105.204:8080/axis2/services/STS</Address>
</sp:Issuer>
<sp:RequestSecurityTokenTemplate>
<t:TokenType xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</t:TokenType>
<t:KeyType xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">http://schemas.xmlsoap.org/ws/2005/02/trust/SymmetricKey</t:KeyType>
<t:KeySize xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">256</t:KeySize>
</sp:RequestSecurityTokenTemplate>
<wsp:Policy>
<sp:RequireInternalReference/>
</wsp:Policy>
</sp:IssuedToken>
</wsp:Policy>
</sp:SupportingTokens>

Procedure

  1. In the Performance Test perspective, click the New Test from Recording toolbar button New Test from Recording toolbar button or click File > New > Test from Recording.
  2. In the New Test from Recording wizard, click Create a test from a new recording, select Service Test, and click Next. If you are recording sensitive data, you can select a Recording encryption level.
  3. On the Select Location page, select the project and folder where you want to create the test, type a name for the test, and click Next. If necessary, click Create Parent Folder Create Parent Folder icon to create a project or folder
  4. On the Select Location page, select Generic Service Client. This option uses the generic service client if you do not have access to a dedicated client for the service calls. See Recording a service test through a client program for information about using other client programs to record the test.
  5. Click Next. If this is the first time you are recording a web service test, read the Privacy Warning, select Accept, and click Finish to proceed. The generic service client opens.
  6. If your service uses a transport or authentication protocol that requires overriding the default settings, then click the Transport tab and create an HTTP, Java Message Service (JMS), IBM® WebSphere® MQ, IBM WebSphere Java MQ, or Java MQ transport.
  7. Click the Requests tab.
    • Right-click WSDLs Add a WSDL file and select one of the options to get the WSDL file.
    • Right-click WADLs Add a WADL file and select one of the options to get the WADL file.
    • Right-click Endpoints Add an endpoint and select one of the options to send the request.
    See Sending service requests with the generic service client for more information about using the generic service client.
  8. After creating the call, click the Edit Data arrow to change the details of the call if necessary.
  9. Click the Invoke arrow to invoke the service call. If the call was successful, the response is displayed under the View Response arrow.
  10. To record a test with multiple calls, repeat steps 6 through 9.
  11. When you have finished sending service requests, stop the recorder. You can do this by closing the generic service client or by clicking the Stop push button Stop icon in the Recorder Control view. If you changed the network settings of the client program as described in step 8, you can revert to the default settings before closing the program. The Generate Service Test wizard opens.
  12. Click Finish.

What to do next

Alternatively, you can use the generic service client to create, edit, and invoke the calls without recording. Successful responses are added to the Request History list. You can select calls in the Request History list, and click the Generate Test Suite icon Generate Test Suite icon.
Feedback