Signing message elements in consumer security constraints with an XPath expression

The following information explains the difference between using an XPath expression and using keywords to specify which part of the message to sign:

XPath expression

Specify any part of the message using an XPath expression. XPath is a language that is used to address parts of an XML document. You can find information on XPath syntax at the following Web site: http://www.w3.org/TR/1999/REC-xpath-19991116.

Keywords

Specify only elements within the message using predefined keywords.

Complete the following steps to specify which message parts are expected to be signed using an XPath expression. In the following steps, configure either the client-side extensions in step 2 or the server-side extensions in step 3.

  1. Click Window > Open Perspective > J2EE.

  2. Optional:

    Locate the client-side extensions using the Project Explorer window. The Client Deployment Descriptor window is displayed. This Web service contains the extensions that you need to configure. Complete the following steps to locate the client-side extensions:

    1. Expand the Web Services > Client section and double-click the name of the Web service.

    2. Click the WS Extension tab and expand the Response Consumer Configuration section.

  3. Optional:

    Locate the server-side extensions using the Project Explorer window. The Web Services Editor window is displayed. This Web service contains the extensions that you need to configure. Complete the following steps to locate the server-side extensions:

    1. Expand the Web Services > Services section and double-click the name of the Web service.

    2. Click the Extensions tab and expand the Request Consumer Service Configuration Details section.

  4. Expand the Required Integrity section. Integrity refers to digital signature while confidentiality refers to encryption. Integrity decreases the risk of data modification when you transmit data across a network. For more information on digitally signing Simple Object Access Protocol (SOAP) messages, see XML digital signature.

  5. Click Add to indicate which message parts to validate for digital signature. The Required Integrity Dialog window is displayed. Complete the following steps to specify a configuration:

    1. Specify a name for the integrity element under Required Integrity Name field.

    2. Specify a usage type in the Usage type field. This field specifies the requirement for the integrity element. The value of this attribute is either Required or Optional.

      Required

      If you select Required and the required message parts or elements are not signed, then the message is rejected with SOAP fault.

      Optional

      If you select Optional, then the digital signature of the selected message parts or elements is verified if they are signed. However, the consumer does not reject the message if the selected message parts or elements are not signed.

  6. Click Add under the Message Parts section of the Required Integrity Dialog window. Complete the following steps to specify the message parts dialect and its message part:

    1. Select the Message parts dialect from the Message Parts section of the Required Integrity Dialog window. If you select the http://www.w3.org/TR/1999/REC-xpath-19991116 dialect, the message part that is validated for digital signature is specified by the XPath expression.

    2. Specify the message part to be validated for digital signature using an XPath expression in the Message parts keyword field. For example, to specify that the message body is checked to determine if it is signed, you might add the following expression in the Message parts keyword field as one continuous line:

      /*[namespace-uri()='http://schemas.xmlsoap.org/soap/envelope/' and local-name()='Envelope']/*
      [namespace-uri()='http://schemas.xmlsoap.org/soap/envelope/' and local-name()='Body']

      Important: Verify that your XPath syntax is correct.

  7. Click OK to save the configuration changes.

    Note: These configurations for the consumer and the generator must match.

    In addition to the message parts, you also can specify that WebSphere® Application Server check the nonce and timestamp elements for a digital signature. For more information, see the following articles:

After you specify which message parts to check for a digital signature, specify which method is used to validate the signature. For more information, see Configuring signing information for the consumer binding.

 

Related concepts

XML digital signature

 

Related tasks

Adding a stand-alone time stamp in consumer security constraints

Adding time stamps for integrity in consumer security constraints with keywords

Adding a nonce for integrity in consumer security constraints with keywords

Configuring signing information for the consumer binding