WSO2: Address Endpoint seems to overwrite wsa:To WS-Addressing property

2.2k views Asked by At

Forwarding a SOAP message from WSO2ESB via another ESB to a backend web-service does not seem possible, because the original wsa:To value is modified to the URL of the intermediate ESB. The following configuration shows this behavior:

<header name="To" value="http://ws.backend.com/service"/>
<property name="PRESERVE_WS_ADDRESSING" value="true"/>
<send>
    <endpoint name="IntermediateESB">
        <address uri="http://esb.intermediate.com/proxy">
            <enableAddressing/>
        </address>
    </endpoint>
</send>

The SOAP header now contains the following wsa:To:

<wsa:To>http://esb.intermediate.com/proxy</wsa:To>

The address uri seems to overwrite the original wsa:To value.

This will fail in the intermediate ESB, because it expects the URL of the backend web-service in wsa:To. The SOAP header should have contained the following for the intermediate ESB to work properly:

<wsa:To>http://ws.backend.com/service</wsa:To>

What configuration is possible to fix this?

2

There are 2 answers

1
jayalalk On

You need to provide your backend address in wsa:ReplyTo header tag. So your intermediate will proceed the response to backend service.

<header name="ReplyTo" value="http://ws.backend.com/service"/>

More info : http://www.w3.org/Submission/ws-addressing/

0
Erno Marks On

The solution is that you have to build the WS-Addressing headers yourself explicitly, and not use <enableAddressing/>!

Example:

<header xmlns:wsa="http://www.w3.org/2005/08/addressing" name="wsa:To" value="http://ws.backend.com/service"/>
<header xmlns:wsa="http://www.w3.org/2005/08/addressing" name="wsa:MessageID" expression="get-property('MessageID')"/>
<header xmlns:wsa="http://www.w3.org/2005/08/addressing" name="wsa:Action" value="http://ws.backend.com/operation"/>
<header name="To" value="http://esb.intermediate.com/proxy"/>
<header name="Action" value="http://ws.backend.com/operation"/>
<property name="PRESERVE_WS_ADDRESSING" value="true" scope="default" type="STRING"/>
<send>
    <endpoint name="IntermediateESB">
        <address uri="http://esb.intermediate.com/proxy"/>
    </endpoint>
</send>

Note that you have to set 'Action' twice with the same value. Also note that you can use 'To' with a different value, and use a 'default' endpoint instead of the 'address' endpoint above.

The SOAP message is posted to 'http://esb.intermediate.com/proxy', and the WS-Addressing headers are:

<wsa:To xmlns:wsa="http://www.w3.org/2005/08/addressing">http://ws.backend.com/service</wsa:To>
<wsa:MessageID xmlns:wsa="http://www.w3.org/2005/08/addressing">urn:uuid:52aad1f4-9295-43f6-90c0-304e87922c27</wsa:MessageID>
<wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing">http://ws.backend.com/operation</wsa:Action>

The 'IntermediateESB' can now forward this SOAP message to 'http://ws.backend.com/service'.