Enabling Correlation ID with XPATH extraction from payload - 7.1

Talend ESB Infrastructure Services Configuration Guide

Version
7.1
Language
English (United States)
Product
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
Module
Talend ESB
Talend Runtime
Content
Design and Development
Installation and Upgrade

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>