Set security for a standard Web Service

Relevant for: API testing only

This task describes how to configure security settings for a standard Web Service. This mode lets you define the HTTP transport information and security elements such as tokens.

Create a Web Service scenario

  1. Open the Security Settings dialog in one of the following ways:

    • To set security on a port level, right-click a Web Service port in the Toolbox and choose Security Settings.

    • To set security for a specific Web Service step already on the canvas, select the step and open the Security Settings tab in the Properties pane. Clear the use the port's security settings option.

    • For a SOAP Request step, click the Security Settings tab in the Properties pane.

  2. In the Security Settings dialog box, select Web Service from the Service Details dropdown list (default).

  3. Back to top

Configure the HTTP settings

In the main window of the Security Settings dialog box, select the HTTP tab, and set the transport and proxy information.

Back to top

Add message level security with a Username Token

To send a message level username/password token (a UserName token):

  1. In the Security Settings dialog box, from the Service Details dropdown list, select the Web Service scenario.

  2. In the main part of the Security Settings dialog box, click the WS-Security tab.

  3. In the WS-Security tab, click the Add Token button and add a Username token.

  4. In the lower pane, customize the token details, such as username and password.

Back to top

Add message level security by signing with an X.509 Certificate

  1. In the Security Settings dialog box, select the Web Service scenario from the Service Details dropdown list.

  2. In the main part of the Security Settings dialog box, click the WS-Security tab.

  3. In the WS-Security tab, click the Add Token button and select X509 Certificate from the dropdown list

  4. In the lower pane, enter the token name.

  5. Click the Browse button to navigate to your certificate file. The certificate must be installed in the Windows certificate store.

  6. Select a Reference type. Since this token is used for a signature, the most common type is BinarySecurityToken.

  7. Click the Add Message Signature button .

  8. In the Signing Token dropdown list, select the token you entered in the previous steps.

  9. To sign a specific element with the certificate, scroll down to the XPath field and provide an XPath expression.

    You cannot use an XPath expression to sign a timestamp or token that is under the security element of a SOAP request.

    • To sign a SOAP Body, Timestamp, or WS-Addressing, select the check box in the Predefined parts area.

    • To sign tokens within the security element, select a token in the Token (optional) field, in the What to sign area.

    Note: The certificate needs to be installed in the Windows certificate store. In the example above, you need to set the actual store name, store location, and subject name of your certificate.

Back to top

Encrypt a Web service message using a Certificate

To encrypt a message using a service certificate:

  1. In the Security Settings dialog box, select the Web Service scenario from the Service Details dropdown list,

  2. In the main part of the Security Settings dialog box, select the WS-Security tab.

  3. In the WS-Security tab, click the Add Token button and select the appropriate token from the Security Token drop down list.

  4. Enter token name and set the token or certificate properties.

  5. Click the Add Message Encryption button . In the drop down list, select the token you created in the previous steps.

  6. Scroll down to the XPath field. Enter an XPath expression to the elements to encrypt, for example: // *[local-name(.)='Body'].

Back to top

Send a username token and encrypt the token with an X.509 Certificate

The following section describes how to send a Username token to the service and encrypt it with the server's X.509 certificate:

  1. In the Security Settings dialog box, select the Web Service scenario from the Service Details dropdown list.

  2. In the main part of the Security Settings dialog box, select the WS-Security stab.

  3. In the WS-Security tab, click the Add Token button and select Username Token from the Security Token drop down list.

  4. In the lower pane, Provide the token details for the Username token.

  5. Click the Add Token button again and select X509 Certificate Token from the Security Token drop down list.

  6. In the lower pane, enter the token details to reference the server's public certificate. Since this token is used for encryption, use Reference as the Reference type.

  7. Click the Add Message Encryption button . In the drop down list, select the X.509 token you created in the previous steps.

  8. To encrypt a specific message, scroll down to the XPath field. Enter an XPath expression, for example:, // *[local-name(.)='Body'].

Back to top

Configure the WS-Addressing (optional)

  1. In the main pane of the Security settings dialog box, click the WS-Addressing tab.

  2. In the WS-Addressing tab, select the relevant version or None if WS-Addressing is not used.

  3. In the Reply to field, provide an alternate destination.

Back to top