Transport level information does not match with SOAP Message namespace URI error - axis2

I'm getting below error while posting soap message to other third party Vendor. Soap versions are same at both sides and 1.2. Could anyone suggest?
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding">
<env:Body>
<env:Fault>
<axis2ns1:Code xmlns:axis2ns1="http://www.w3.org/2003/05/soap-envelope">
<axis2ns1:Value>env:Receiver</axis2ns1:Value>
</axis2ns1:Code>
<axis2ns1:Reason xmlns:axis2ns1="http://www.w3.org/2003/05/soap-envelope">
<env:Text xml:lang="en">org.apache.axiom.soap.SOAPProcessingException: Transport level information does not match with SOAP Message namespace URI</env:Text>
</axis2ns1:Reason>
</env:Fault>
</env:Body>
</env:Envelope>

See
https://issues.apache.org/jira/browse/AXIS2-5928
Or
https://wso2.org/jira/browse/ESBJAVA-4873
Or
https://wso2.org/jira/browse/ESBJAVA-4873
This usually happens when SOAP 1.2 message has been sent to a SOAP 1.1 binding endpoint or vice versa.

Ensure the Content-Type in the headers of this request is application/soap+xml and not text/xml as the latter is used for SOAP version 1.1.

Related

WCF - I have been given a SOAP request and I need to create a SOAP web service to consume this SOAP request

The sample SOAP request will come through like this:
<soapenv:Envelope xmlns:soapenv=http://www.w3.org/2003/05/soap-envelope>
<soapenv: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 soapenv:mustUnderstand="0">
<wsse:UsernameToken xmlns:wsu=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd wsu:Id="UsernameToken-1">
<wsse:Username>soapUserName</wsse:Username>
</wsse:UsernameToken>
</wsse:Security>
<wsa:To>https://wcfexample.com/Service.svc</wsa:To>
<wsa:MessageID>ABC123</wsa:MessageID>
<wsa:Action>SoapRQ</wsa:Action>
</soapenv:Header>
<soapenv:Body>
<ABC>
<DETAIL>
...
</DETAIL>
</ABC>
</soapenv:Body>
</soapenv:Envelope>
The Body of the soap envelope is xml, which I think would be best handled as a string and then I can serialise this once it hits the server.
I think the trickiest thing for me is setting up the configuration of WCF to handle the security portion of this.
Any help with this would be greatly appreciated.
The wcf setting security section usually selects the binding you want, then sets a security mode for the binding, and on the client side you can also set the client credential type. You can refer to the docs for more info.

HttpWebRequest works with only asmx or wsdl also

HttpWebRequest works with only asmx or wsdl also ?
https://incometaxindiaefiling.gov.in/e-FilingWS/ditws/Get26asInfo.wsdl
can b used ? with following data for - HttpWebRequest
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:v="http://incometaxindiaefiling.gov.in/ditws/tds/v_1_0">
<soapenv:Header/>
<soapenv:Body>
<v:getTDSDetails>
<v:LoginInfo>
<v:userName>xxxxxxxxxx</v:userName>
<v:password>xxxxxxxxxx</v:password>
</v:LoginInfo>
<v:ClientInfo>
<v:pan>xxxxxxxxxx</v:pan>
<v:dob>xxxxxxxxxx</v:dob>
<v:assessmentYear>xxxxxxxxxx</v:assessmentYear>
</v:ClientInfo>
</v:getTDSDetails>
</soapenv:Body>
</soapenv:Envelope>
if not, how to get Response Envelope xml while consuming wsdl(service reference)
The WSDL exists as a framework to tell external entities how to consume the web service - you should send all actual web service requests to the ASMX file to ensure they are handled properly.
See the W3 specification

WCF client talking to Java WS, exception: The content type application/xop+xml; type="application/soap+xml" of the response message

I'm having problems talking to Java WS. I'm using "wsHttpBinding" binding with client certificates for authentication, message encoding is set "Text", .net framework is 4.0. Server side is Java and I have no control over it. Connection is being proxied through Fiddler (this is how I see requests on the wire, much more user friendly than tracing "System.Net").
Exception I get is following:
The content type application/xop+xml; type="application/soap+xml" of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8).
If I change message encoding to "Mtom", then the exception changes:
The content type application/xop+xml; type="application/soap+xml" of the response message does not match the content type of the binding (multipart/related; type="application/xop+xml").
Server is accepting both "Text" and "Mtom" message encodings for request, and response is always the same. This is the raw response that I'm getting from the server:
HTTP/1.1 200 OK
X-Backside-Transport: OK OK
Connection: Keep-Alive
X-Powered-By: Servlet/3.0
SOAPAction: ""
Content-Type: application/xop+xml; type="application/soap+xml"
Content-Language: en-US
Date: Thu, 25 Jul 2013 13:05:09 GMT
Content-Length: 628
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope ... </env:Envelope>
From all the docs which I have been reading, response that is being returned is somewhere between regular SOAP message and MTOM message. I'm saying this because every example which I've seen says that the MTOM request and response use MIME as an envelope for communication: regular SOAP message is enveloped in XOP package, and then this XOP message is enveloped with MIME. Even the W3C recommendation uses MIME for XOP packages: W3C: XML-binary Optimized Packaging. Excerpt from this link:
Content-Type: Multipart/Related;boundary=...
If I try calling web service using tool "soapUI" (written in Java, available from "www.soapui.org"), service call is successfully executed and response is parsed without any problem.
FYI, this is a cross-post from MSDN WCF forum., but no responses there yet.
Any idea is appreciated, thanks in advance,
Alex
I'm also using CXF, and has a C# client. Try modifying your binding setting, replace textMessageEncoding with mtomMessageEncoding. Something like this:
<binding name="yourSoapBinding">
<mtomMessageEncoding messageVersion="Soap12"/>
<httpTransport />
</binding>
Try setting the message encoding in the binding configuration to messageEncoding="Mtom" and basicHTTPBinding instead of wsHTTP one...
Hope it helps!

Direct POST to WCF WSDL-first web service

I need some help posting some XML to a WCF service. In essence, the issue I am experiencing is a HTTP response of "400: Bad request" - as descriptive as that sounds, i'm struggling to find any answers!
First of all, the service I have built in WCF is based on an existing WSDL, originally from an IBM WebSphere web service. After some manipulation (removal of MIME attachments, downloading of some remote schemas) I managed to get svcutil to generate a service interface which for all intents and purposes seems valid.
I have implemented the interface in to my WCF service and when running the WCF test client, I can attach to the service, submit a request and receive a response no problems. So far so good!
When moving to a test application for posting XML to web services via the HttpWebRequest class I start receiving "400: Bad request" responses even though I am using the XML provided by the WCF test client.
I've used WCF tracing to dump out the messages it is receiving and there is one striking difference - all of the WCF test client messages are populating correctly and displaying their header information etc, all of the once from my SOAP test utility are showing as "Malformed". Looking in to the message tab, the manual POST messages I am sending have the body wrapped in a element:
<MessageLogTraceRecord><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://localhost:57567/Service1.svc</To>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://www.nowhere.co.uk/RequestService/RequestOperation</Action>
</s:Header>
</s:Envelope>
]]></MessageLogTraceRecord>
Whereas the WCF messages appear as:
<MessageLogTraceRecord>
<HttpRequest xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace">
<Method>POST</Method>
<QueryString></QueryString>
<WebHeaders>
<Connection>Keep-Alive</Connection>
<Content-Length>185</Content-Length>
<Content-Type>text/xml; charset=utf-8</Content-Type>
<Accept-Encoding>gzip, deflate</Accept-Encoding>
<Expect>100-continue</Expect>
<Host>localhost:57567</Host>
<VsDebuggerCausalityData>uIDPo4VLDcJD5AZDjB5sdmoeakEAAAAAH/hWABuWQ0iiq47QDHh0GlelCLcEx7FLibxRvpq1tTgACQAA</VsDebuggerCausalityData>
<SOAPAction>"http://www.nowhere.co.uk/RequestService/RequestOperation"</SOAPAction>
</WebHeaders>
</HttpRequest>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://localhost:57567/Service1.svc</To>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://www.nowhere.co.uk/RequestService/RequestOperation</Action>
</s:Header>
</s:Envelope>
</MessageLogTraceRecord>
I've tried tracing in Fiddler to no avail - I can't get the WCF test client to submit requests through the proxy it creates despite modifying it's app.config file. I have traced my SOAP request however can can see the following:
Content-Type: text/xml; charset="utf-8"
Accept-Encoding: gzip, deflate
Host: 127.0.0.1:57567
SOAPAction: "http://www.nowhere.co.uk/RequestService/RequestOperation"
Content-Length: 459
Expect: 100-continue
Connection: Keep-Alive
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://localhost:57567/Service1.svc</To>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://www.nowhere.co.uk/RequestService/RequestOperation</Action>
</s:Header>
</s:Envelope>
As far as I can tell, the message I am sending should be ok - outside of the headers and the message content I can't see what else could be sent.
Last thing I should say is that I am by no means a WCF expert and I have had to change the specific SOAPAction value due to commercial sensitivity..
Can anyone offer any help on this rather frustrating problem?
Thanks in advance
Thanks for the Fiddler comment - I managed to get the WCF request traced and using the xml from the request seems to work! I've since tried a full message which works against the WebSphere service against the WCF client and that works too!
I think the issue was the Action header. I believe WCF only support a couple of revisions of WSA, none of which are the one this particular WSDL was using. Looking at the original requests that were failing (pulled out of the WCF Test Client front end) the addressing namespace it was using was declared as:
xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none"
Whereas the actual WCF request that goes across to the service is declared as:
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
The actual element itself was populated with the same value, just the difference in namespace:
<wsa:Action>http://www.nowhere.co.uk/RequestService/RequestOperation</wsa:Action>
So using the correct addressing version and omitting the newer, WCF compatible version appears to have fixed the problem!

Preventing BizTalk from emitting a "To" Soap header in an outgoing request to a WCF BasicHttp service

Using BizTalk 2010 to consume a WCF webservice with BasicHttp binding.
My service is rejecting the requests coming from BizTalk. I can see using tracing and soapUI that the reason is the "To" header emitted by BizTalk in the outgoing message:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://biztalk01:81/StuffServices.svc</To>
</s:Header>
<s:Body>
<ns0:GetMyStuff xmlns:ns0="http://example.com/stuff" xmlns:ns1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<ns0:inputArray>
<ns1:string>80220</ns1:string>
</ns0:inputArray>
</ns0:GetMyStuff >
</s:Body>
</s:Envelope>
This request gives a fault back both in BizTalk and in soapUI, but if I try in soapUI to send the exact same request without the To header (deleting the "<To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://biztalk01:81/StuffServices.svc
"), then it works fine and returns the correct response.
Thus my question: what are my options to make BizTalk not emit that "To" soap header in that outgoing request?
Actually that header was never in the request sent by BizTalk, it was added by WCF tracing in the log. Using Fiddler to capture the real request sent allowed me to see that the problem was elsewhere. It's possible to get the BizTalk query to go through fiddler by adding the proxy http://127.0.0.1:8888 in the binding configuration of the send port.