Skip to main content

Enabling Correlation ID with XPATH extraction from payload

The XPATH parser allows to build the correlation ID using JXPath expressions. For more information, see http://commons.apache.org/proper/commons-jxpath/users-guide.html.

To enable the Correlation ID policy with XPATH extraction from payload, upload the following XPATH Correlation ID policy to the Service Registry and attach it to a service:

<wsp:Policy Name="wspolicy_schema_correlation_id" xmlns:wsp="http://www.w3.org/ns/ws-policy">
    <wsp:ExactlyOne>
        <wsp:All>
            <tpa:CorrelationID xmlns:tpa="http://types.talend.com/policy/assertion/1.0" type="xpath" name="customer">
                <tpa:Namespace prefix="ns2" uri="http://customerservice.example.com/"/>
                <tpa:Part name="customerFirstName" xpath="/ns2:getCustomersByName/firstname"/>
                <tpa:Part name="customerLastName" optional="true" xpath="/ns2:getCustomersByName/lastname"/>
            </tpa:CorrelationID>
        </wsp:All>
    </wsp:ExactlyOne>
</wsp:Policy>

When you apply it to the above SOAP message:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns2:getCustomersByName xmlns:ns2="http://customerservice.example.com/">
            <firstname>Alfred</firstname>
            <lastname>Nobel</lastname>
        </ns2:getCustomersByName>
    </soap:Body>
</soap:Envelope>

You get the following SOAP message with the Correlation ID policy attachment:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
      <correlationId xmlns="http://www.talend.com/esb/sam/correlationId/v1">customer#customerFirstName=Alfred;customerLastName=Nobel</correlationId>
   </soap:Header>
    <soap:Body>
        <ns2:getCustomersByName xmlns:ns2="http://customerservice.example.com/">
            <firstname>Alfred</firstname>
            <lastname>Nobel</lastname>
        </ns2:getCustomersByName>
    </soap:Body>
</soap:Envelope>

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!