Record a service test using an HTTP proxy

 

+

Search Tips   |   Advanced Search

 

Overview

You can record tests for SOAP-based services or plain XML services by running a client program through a dedicated HTTP proxy.

To record the test, the proxy intercepts the service calls and message returns between the client and the service.

This interception can cause authentication problems because the client communicates with the recording proxy instead of the actual server.

Verify that the Rational Agent Controller is running on the local computer.

If workspace does not already contain a test project, the test recording wizard creates one.

To generate a test in a specific project, verify that the project is available before you record the test.

If you are testing a SOAP-based Web service, ensure that you have access to a valid WSDL file. The wizard can import WSDL files from the workspace, the file system, a remote repository, or from a URL. Verify 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 SSL to authenticate communication with the server, configure the client to accept the certificate that the recorder proxy generates instead of the certificate from the actual server.

If you are using SOAP security or file attachments, ensure that you have configured the environment with the correct libraries and configuration files.

By default, the recording proxy uses port 1080. You can change the port number in the wizard if this port is already in use or if a corporate firewall or proxy already uses this port.


To record a test

  1. In the Test perspective, click File > New > Test from Recording, or click

  2. Select Create test from new recording and Web service or XML recording using existing client (HTTP proxy); then click Next.

  3. Select a project, and then, in Test file name, type a name for the test.

    The name that you type is the base name for the recording, test, and other required files. You can see these files in the Test Navigator or the Java Package Explorer with their distinguishing suffixes, but you see only the simple (test) name in the Test Navigator.

  4. Click Next.

  5. Specify any WSDL or XSD files that can be used to create the content of the test:

    1. If you are recording a SOAP-based Web service, click Add to select or import the WSDL files of the Web services to test.

      If you are testing a plain XML service over HTTP, without SOAP, a WSDL file is not required.

    2. If an XSD is available, click Add to select or import the XSD files that define the XML content of the services to test.

  6. Click Next.

  7. Specify the Port that the service uses and the Timeout value in seconds.

    The recorder uses its own proxy to record message calls and returns. However, if you are already using a proxy, such as a corporate firewall, to access the service, or if you need to transform incoming or outgoing messages with custom code, click Advanced Settings, and complete these steps:

    1. For an existing HTTP proxy, type the IP address or host name in HTTP proxy, and specify a value in Port.

      If some hosts need to bypass the proxy, then type the names of those hosts in No HTTP proxy for. Use a comma to separate multiple host names.

    2. For an existing HTTPS proxy, type the IP address or host name in HTTPS proxy, and specify a value in Port.

      If some hosts need to bypass the proxy, then type the names of those hosts in No HTTPS proxy for. Use a comma to separate multiple host names.

    3. If you need to transform incoming or outgoing messages with own Java code, click Browse to specify a Java class in workspace.

      This option is for particular cases where messages must be transformed or compressed through a processing method that can be defined in a Java class.

  8. Click Next.

  9. If you do not have access to the server certificate keystore file, you can tell the recorder proxy to provide its own certificate.

    To do this, select Authenticate with proxy certificate. This action causes the recorder proxy to attempt to identify itself with its own certificate; therefore configure the client application to trust the recorder proxy certificate by using one of the following methods.

    If you are not using SSL, select Authenticate with proxy certificate, and skip this page.

    • If the client application uses a truststore file, specify how you want the proxy recorder to authenticate itself with the client application: Select Add proxy certificate to client truststore, click Browse to specify the truststore file, and type the password.

    • If there is no truststore file, use the preferences, commands, or options that the client application provides to specify a trusted server.

  10. If you have access to the server certificate keystore file, if the service requires double authentication, or if the service offers multiple endpoints that each require their own SSL configuration, clear the Authenticate with proxy certificate check box, and use the table to associate an SSL configuration with each endpoint host name and port:

    1. For each endpoint host name and port, either select an existing SSL configuration, and click Edit Configuration, or click New Configuration to create an SSL configuration. This action opens the SSL Properties window.

    2. For the current SSL configuration, either select or clear the Authenticate with server certificate check box as described in step 9.

    3. If you want the server to authenticate the client, select Use client certificate, click Browse to specify the client certificate keystore file, and if the keystore is encrypted, type the password.

    4. Click OK.

  11. Click Next. If this is the first time you record a Web service test, read the Privacy Warning, and then select Accept, and click Finish to proceed.

  12. Run the client application manually and use it to send service calls to the service and to receive message returns from the service.

    All service calls and message returns that go through the recording proxy are recorded.

  13. After finishing recording the service calls and message returns for testing, click Stop in the Recorder Control view. A progress window opens while the test is generated.


Related

  • Service testing guidelines


    Related tasks

  • Verify WSDL syntax compliance for JMS services
  • Record a service test with the generic service client
  • Create a service test from a BPEL model
  • Create a service test manually
  • Create a service test for WebSphere MQ
  • Create a service test for a plain XML call
  • Change service test generation preferences
  • Create transport and security configurations