WSO2ESB: SOAP Action header not what expected on response - wso2

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.

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"/>

Related

Internal Server Error in CreateItem operation of EWS

I'm using CreateItem Operation to save message in the Draft folder using EWS with gSOAP toolkit, but when i run the code I've response XML as follows:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">*</Action>
</s:Header>
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorInternalServerError</faultcode>
<faultstring xml:lang="en-US">An internal server error occurred. The operation failed.</faultstring>
<detail>
<e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorInternalServerError</e:ResponseCode>
<e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">An internal server error occurred. The operation failed.</e:Message>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
and in the terminal the fault which i've got is:
SOAP 1.1 fault: SOAP-ENV:MustUnderstand[no subcode]
"The data in element 'Action' must be understood but cannot be processed"
Detail: [no detail]
and there is no compile time error. If you need code, kindly let me know, I'll give that also. Please help me, I've tried a lot, but not find the solution, no matter I change in code, the response XML remains same.
Request XML is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ews="http://schemas.microsoft.com/exchange/services/2006/messages">
<SOAP-ENV:Body>
<ews:CreateItem xsi:type="ews:CreateItemType" MessageDisposition="SaveOnly"><ews:SavedItemFolderId xsi:type="ns1:TargetFolderIdType">
<ns1:DistinguishedFolderId Id="drafts" xsi:type="ns1:DistinguishedFolderIdType"></ns1:DistinguishedFolderId>
</ews:SavedItemFolderId>
<ews:Items xsi:type="ns1:NonEmptyArrayOfAllItemsType">
<ns1:Message xsi:type="ns1:MessageType">
<ns1:ItemClass xsi:type="ns1:ItemClassType">IPM.Note</ns1:ItemClass>
<ns1:Subject xsi:type="xsd:string">Project Action</ns1:Subject>
<ns1:Body BodyType="Text" xsi:type="ns1:BodyType">Priority - Update specification</ns1:Body>
<ns1:Sender xsi:type="ns1:SingleRecipientType">
<ns1:Mailbox xsi:type="ns1:EmailAddressType">
<ns1:EmailAddress xsi:type="ns1:NonEmptyStringType">markzuck93#live.com</ns1:EmailAddress>
</ns1:Mailbox>
</ns1:Sender>
<ns1:ToRecipients xsi:type="ns1:ArrayOfRecipientsType">
<ns1:Mailbox xsi:type="ns1:EmailAddressType">
<ns1:EmailAddress xsi:type="ns1:NonEmptyStringType">openuib#openuib.onmicrosoft.com</ns1:EmailAddress>
</ns1:Mailbox>
</ns1:ToRecipients>
</ns1:Message>
</ews:Items>
</ews:CreateItem>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I would suggest you get rid of all the xsi:type attributes eg how to remove xsi:type information from gSoap message?
Simplified your request should look like
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ews="http://schemas.microsoft.com/exchange/services/2006/messages">
<SOAP-ENV:Body>
<ews:CreateItem MessageDisposition="SaveOnly">
<ews:SavedItemFolderId>
<ns1:DistinguishedFolderId Id="drafts" />
</ews:SavedItemFolderId>
<ews:Items>
<ns1:Message>
<ns1:ItemClass>IPM.Note</ns1:ItemClass>
<ns1:Subject>Project Action</ns1:Subject>
</ns1:Message>
</ews:Items>
</ews:CreateItem>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Which works okay for me.
cheers
Glen
I recently explored the EWS api and found that a Sender tag causes the 500 response with the CreateItem request. Rather, you should be using the From tag.
<ns1:From xsi:type="ns1:SingleRecipientType">
<ns1:Mailbox xsi:type="ns1:EmailAddressType">
<ns1:EmailAddress xsi:type="ns1:NonEmptyStringType">markzuck93#live.com</ns1:EmailAddress>
</ns1:Mailbox>
</ns1:From>

WSO2 ESB SOAP headers lost

I'm trying to forward a simple web service call through ESB, however Send mediator removes all headers from SOAP message.
Source message:
<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://tempuri.org/TestService/SendMessage</a:Action>
<a:MessageID>urn:uuid:51d31061-2eab-41cf-b073-3dbee322e0e1</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">http://if-golubets-dn:8000/test</a:To>
</s:Header>
<s:Body>
<SendMessage xmlns="http://tempuri.org/">
<message>Test</message>
</SendMessage>
</s:Body>
Message after Send:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header />
<s:Body>
<SendMessage xmlns="http://tempuri.org/">
<message>Test</message>
</SendMessage>
</s:Body>
How can I preserve the Action header? I tried header mediator, but it didn't help.
I found the answer:
<property name="PRESERVE_WS_ADDRESSING" value="true"/>

Problems with SOAP request

I am trying to integrate Siebel CRM with SAP system via...
The problem is : the SOAP request that siebel is generating is giving me an error while if I use SOAP UI to generate the SOAP request, it is working fine. Following are the error mesages and SOAP requests generated
Error from siebel SOAP request :
CX_ST_MATCH_ELEMENT:.System expected element 'PiCopyreference'".(SBL-EAI-04308)
Unsuccessful Siebel generated SOAP Request:-
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<CustomerCreatefromdata1 xmlns="urn:sap-com:document:sap:soap:functions:mc-style">
<PiCompanydata xmlns="urn:sap-com:document:sap:soap:functions:mc-style"></PiCompanydata>
<PiCopyreference xmlns="urn:sap-com:document:sap:soap:functions:mc-style">
<Salesorg xmlns="urn:sap-com:document:sap:soap:functions:mc-style">0001</Salesorg>
<DistrChan xmlns="urn:sap-com:document:sap:soap:functions:mc-style">01</DistrChan>
<Division xmlns="urn:sap-com:document:sap:soap:functions:mc-style">01</Division>
<RefCustmr xmlns="urn:sap-com:document:sap:soap:functions:mc-style">0000000011</RefCustmr>
</PiCopyreference>
<PiOptCompanydata xmlns="urn:sap-com:document:sap:soap:functions:mc-style"></PiOptCompanydata>
<PiOptPersonaldata xmlns="urn:sap-com:document:sap:soap:functions:mc-style">
<Transpzone xmlns="urn:sap-com:document:sap:soap:functions:mc-style">0000000001</Transpzone>
</PiOptPersonaldata>
<PiPersonaldata xmlns="urn:sap-com:document:sap:soap:functions:mc-style">
<TitleP xmlns="urn:sap-com:document:sap:soap:functions:mc-style">MR</TitleP>
<Firstname xmlns="urn:sap-com:document:sap:soap:functions:mc-style">FirstN</Firstname>
<Lastname xmlns="urn:sap-com:document:sap:soap:functions:mc-style">lastN</Lastname>
<City xmlns="urn:sap-com:document:sap:soap:functions:mc-style">SomeCity</City>
<PostlCod1 xmlns="urn:sap-com:document:sap:soap:functions:mc-style">7866</PostlCod1>
<Country xmlns="urn:sap-com:document:sap:soap:functions:mc-style">AT</Country>
<LanguP xmlns="urn:sap-com:document:sap:soap:functions:mc-style">E</LanguP>
<Currency xmlns="urn:sap-com:document:sap:soap:functions:mc-style">INR</Currency>
</PiPersonaldata>
</CustomerCreatefromdata1>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Successfull SOAP UI generated request :-
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style">
<soapenv:Header/>
<soapenv:Body>
<urn:CustomerCreatefromdata1>
<PiCompanydata/>
<PiCopyreference>
<Salesorg>0001</Salesorg>
<DistrChan>01</DistrChan>
<Division>01</Division>
<RefCustmr>0000000011</RefCustmr>
</PiCopyreference>
<PiOptCompanydata/>
<PiOptPersonaldata>
<Transpzone>0000000001</Transpzone>
</PiOptPersonaldata>
<PiPersonaldata>
<TitleP>MR</TitleP>
<Firstname>FirstN</Firstname>
<Lastname>lastN</Lastname>
<City>SomeCity</City>
<PostlCod1>7866</PostlCod1>
<Country>AT</Country>
<LanguP>E</LanguP>
<Currency>INR</Currency>
</PiPersonaldata>
</urn:CustomerCreatefromdata1>
</soapenv:Body>
</soapenv:Envelope>
Also in siebel i'm generating the SOAP request using workflows(no scripting involved).
Could be namespace issue. In the Siebel external IO, you could try inactivating all the user properties for namespace at ICField level.

ReplyTo property missing in SOAPHeader

I have created a WS-BPEL workflow that would call an asynchronous web service and wait for a callback response. The carbon application is successfully deployed into BPS as well.
Details on my external Asynchronous web service
1. It requires basic authentication over http.
2. It requires the soap header to be available in the soap envelope.
3. It would process the request and send a callback to the ReplyTo address it receives in the soap header and use the MessageID to correlate the callback.
My deploy.xml file for the BPEL process looks like this ...
<?xml version="1.0" encoding="UTF-8"?>
<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
xmlns:callback.integration.service="http://callback.integration.service/"
xmlns:epr="http://wso2.org/bps/bpel/endpoint/config"
xmlns:sample="http://wso2.org/bps/sample"
xmlns:ws.integration.service="http://ws.integration.service/">
<process name="sample:Test">
<active>true</active>
<retired>false</retired>
<process-events generate="all"/>
<provide partnerLink="client">
<service name="sample:Test" port="TestPort"/>
</provide>
<provide partnerLink="IntegrationService">
<service name="callback.integration.service:IntegrationCallback" port="IntegrationResponsePort"/>
</provide>
<invoke partnerLink="IntegrationService">
<service name="ws.integration.service:IntegrationService" port="IntegrationRequestPort">
<epr:endpoint endpointReference="IntegrationService.epr"/>
</service>
</invoke>
</process>
</deploy>
The IntegrationService.epr file looks like this ...
<wsa:EndpointReference
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com uep_schema.xsd"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:wsdl11="http://schemas.xmlsoap.org/wsdl/">
<wsa:Address>http://http://server:8080/integration/IntegrationService</wsa:Address>
<wsa:Metadata>
<id>SInvokeEPR</id>
<qos>
<enableAddressing />
</qos>
<transport type="http">
<authorization-username>username</authorization-username>
<authorization-password>password</authorization-password>
</transport>
</wsa:Metadata>
</wsa:EndpointReference>
Now when I test the bpel process from carbon service management console, I do get a request to my asynchronous web service. However the soap envelope looks as followed and it is missing a proper ReplyTo address to send the callback.
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:To>http://server:8080/integration/IntegrationService</wsa:To>
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address>
</wsa:ReplyTo>
<wsa:MessageID>urn:uuid:91ac4ebd-b100-440e-a01d-c4a5c0d8a56f</wsa:MessageID>
<wsa:Action>http://ws.integration.service/IntegrationRequestPortType/createTask</wsa:Action>
</soapenv:Header>
<soapenv:Body>
...
</soapenv:Body>
</soapenv:Envelope>
Now my need is to reply to this request with a callback. The callback soap envelope would contain this MessageID so that the callback correlates with the correct process instance.
How do you get the proper ReplyTo address appended to the soap header?
If I assume correctly you use the WSO2 BPS (or something with Apache ODE), you can use this copy in an assign to set the Header by hand. (http://ode.apache.org/extensions/headers-handling.html)
<bpel:copy>
<bpel:from>
<bpel:literal>
<wsa:ReplyTo xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Address>http://localhost:9763/services/SIServerCallback</Address>
</wsa:ReplyTo>
</bpel:literal>
</bpel:from>
<bpel:to variable="ServiceInvokerIARequest" header="ReplyTo">
</bpel:to>
</bpel:copy>

Full SOAP syntax for a Sharepoint DspSts.asmx query including dsp:authentication and dsp:dataRoot

I'm trying to retrieve list data from a Sharepoint 2010 server using the webservice at DspSts.asmx. (Nope can't use oData here - long story). The WSDL suggests the following format:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp">
<SOAP-ENV:Header>
<dsp:authentication/>
<dsp:dataRoot>
<dsp:root>STRING </dsp:root>
</dsp:dataRoot>
<dsp:request document="" method=""/>
<dsp:versions>
<dsp:version>STRING </dsp:version>
</dsp:versions>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<dsp:queryRequest/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
So I created the following sample request code (and send it out using Oxygen XML):
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp">
<SOAP-ENV:Header>
<dsp:authentication/>
<dsp:dataRoot allowRemoteDataAccess="true" >
<dsp:root />
</dsp:dataRoot>
<dsp:request service="DspSts" document="content" method="query"></dsp:request>
<dsp:versions>
<dsp:version>1.0</dsp:version>
</dsp:versions>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<dsp:queryRequest>
<dsQuery select="/list[#id='{8F3269B6-02EA-44C5-BA2B-BA8A4D5E9C44}']" resultContent="dataOnly" columnMapping="element" resultRoot="Rows" resultRow="Row">
<Query QueryType="DSPQ">
<Fields>
<AllFields />
</Fields>
</Query>
</dsQuery>"
</dsp:queryRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
However when I send that query I do not get a login prompt (when I use the list web service I get one) and then an error result:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client.Dsp.InvalidSite</faultcode>
<faultstring>Failed to verify user permissions.</faultstring>
<detail>
<queryResponse xmlns="http://schemas.microsoft.com/sharepoint/dsp">
<dsQueryResponse status="failure"/>
</queryResponse>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I'm using a hosted Sharepoint, so I don't know if I can tweak any security setting. Now my questions:
How can I enforce authentication?
What do I need to put into dsp:authentication
What to put in dsp:root
All samples I found didn't have dsp:authentication or dsp:root in it.
Help is very much appreciated
There actually is a work around. If you read a different Sharepoint web service first, e.g. Lists.asmx, then you are properly prompted for credentials and the following calls to DspSts.asmx use the digest credentials created in the first call.