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.
Before you begin
Verify that the Rational® Agent Controller is
running on the local computer.
If your workspace does not already
contain a test project, the test recording wizard creates one. If
you want 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 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)
to authenticate communication with the server, you must 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.
See Configuring the environment for SOAP security for
more information.
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.
About this task
To record a test:
Procedure
- In the Test perspective, click , or click
.
- Select Create test from new recording and Web
service or XML recording using existing client (HTTP proxy);
then click Next.
- 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.
- Click Next.
- Specify any WSDL or XML Schema Definition (XSD) files that
can be used to create the content of the test:
- 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.
- If an XSD is available, click Add to
select or import the XSD files that define the XML content of the
services to test.
- Click Next.
- 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:
- 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.
- 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.
- If you need to transform incoming or outgoing messages
with your own Java code, click Browse to specify
a Java class in your 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.
- Click Next.
- 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 you must configure the
client application to trust the recorder proxy certificate by using
one of the following methods.
Tip: 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.
- 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:
- 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.
- For the current SSL configuration, either select or
clear the Authenticate with server certificate check
box as described in step 9.
- 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.
- Click OK.
- 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.
- 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.
- After you finish 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.