jchaplin
jchaplin

Reputation: 211

WSO2ESB: SOAP Action header not what expected on response

Trying to figure out why my SOAP Envelope Action header is not what I expect. I am calling WSO2ESB and communicating with a another WCF service. I am using an NTLMmediator to authenticate to the backend service.

My input transaction looks like this

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <s:Header>
        <a:Action s:mustUnderstand="1">http://www.mycompany.com/services/GetProductsByCustomerNbr</a:Action>
        <a:MessageID>urn:uuid:448cb5ec-b2d8-4292-b245-5b0d42c0e52a</a:MessageID>
        <a:ReplyTo>
            <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
        </a:ReplyTo>
        <a:To s:mustUnderstand="1">https://hapq-vpwebtran1.afcorp.afg/AnnuityWebService/VpasAnnuityServiceAdaptor.svc/windows</a:To>
        <o:Security s:mustUnderstand="0" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
            <u:Timestamp u:Id="_0">
                <u:Created>2016-10-10T20:57:42.292Z</u:Created>
                <u:Expires>2016-10-14T21:02:42.292Z</u:Expires>
            </u:Timestamp>
            <o:UsernameToken u:Id="uuid-83e06bc8-c659-4ddc-845a-de86f0dd19f8-1">
                <o:Username>JoeTest</o:Username>
                <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">JoeTest</o:Password>
            </o:UsernameToken>
        </o:Security>
    </s:Header>
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        Transaction body
    </s:Body>
</s:Envelope>

What my transaction looks like when I write it from inside my mediator and from the value of Envelope from logging in my Proxy Service after my mediator has executed. This is what I exepect the value of Action to be: GetProducesByCustomerNbrResponse

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
    <s:Header>
        <a:Action s:mustUnderstand="1">http://www.mycompany.com/services/GetProductsByCustomerNbrResponse</a:Action>
        <a:RelatesTo>urn:uuid:448cb5ec-b2d8-4292-b245-5b0d42c0e52a</a:RelatesTo>
    </s:Header>
    <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        Transation body
    </s:Body>
</s:Envelope>

What it looks like in my wire logs is below. You can see the Action is now GetProductsByCustomerNbr instead of GetPRoductsByCustomerNbrResponse

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
    <s:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="true">
            <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-1">
                <wsu:Created>2016-10-13T22:49:45.858Z</wsu:Created>
                <wsu:Expires>2016-10-13T22:54:45.858Z</wsu:Expires>
            </wsu:Timestamp>
        </wsse:Security>
        <wsa:MessageID>urn:uuid:d5677050-3ce7-4f11-a269-83c626967b39</wsa:MessageID>
        <wsa:Action>http://www.mycompany.com/services/GetProductsByCustomerNbr</wsa:Action>
    </s:Header>
    <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        Transation body
    </s:Body>
</s:Envelope>

I do not understand why I am seeing the input transaction action and not the action from the output. I am sure there is something I am missing or not doing right but I am struggling to find it. If anyone has any thoughts or can point me in the right direction I would appreciate it. If there is any information I failed to provide that would be useful please let me know and I will post it.

Upvotes: 0

Views: 721

Answers (1)

jchaplin
jchaplin

Reputation: 211

I had to add properties to my proxy in order to get this working. Below are the 2 properties I had to add.

disableAddressingForOutMessages so that the ESB was not adding WS-Addressing headers to outgoing messages

PRESERVE_WS_ADDRESSING so that the ESB will forward it on without altering the existing WS-Addressing headers

<property name="disableAddressingForOutMessages" scope="axis2" value="true"/>
<property name="PRESERVE_WS_ADDRESSING" scope="default" value="true"/>

Upvotes: 1

Related Questions