• Post Reply Bookmark Topic Watch Topic
  • New Topic

WSDL with both SOAP versions

 
Hendrik Gaedke
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe somebody can help me with the following problem using saaj:

I try to access a web service which is using an wsdl file with SOAP 1.1 and SOAP 1.2. My client code was tested successfully on several public web services. Unfortunately I cannot
connect to the company service for several reasons:

1. By default my client assumes the SOAP standard 1.1 to be used. If I run it I get the message:
"Bad Response; Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'." since the service
expects the content type compliant with SOAP 1.2


2. After explicitly setting the protocol to SOAP 1.2 with: "MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);"
the error does not occur anymore but I also don't get any response. I tested the generated XML (see below) in SoapUI and the behaviour there was the same.


<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="http://www.mt.com/LabX/2010/03">
<soapenv:Header/>
<soapenv:Body>
<ns:GetPublicKey/>
</soapenv:Body>
</soapenv:Envelope>


Afterwards I generated the XML with SoapUI (after importing the wsdl file) and sent a request to the service and got the correct reply. The code from soapUI looks like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.mt.com/LabX/2010/03">
<soapenv:Header/>
<soapenv:Body>
<ns:GetPublicKey/>
</soapenv:Body>
</soapenv:Envelope>



As you can see it is basically the same expect for the namespace. The generated XML in the soapUI contains the namespace "http://schemas.xmlsoap.org/soap/envelope/" whereas my
client is generating "http://www.w3.org/2003/05/soap-envelope" which is associated with SOAP 1.2.

I already tried to overwrite it but without success. It automatically sets it to the SOAP 1.2 default namespace.

Does anybody have an idea how to communicate with such a service (using saaj) where the wsdl file supports both SOAP versions?

Thanks a lot for suggestions...
 
Sujeeth Pakala
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Do you have 2 explicit bindings for both SOAP1.1 and SOAP1.2 versions in WSDL ?
2. Which binding are you using to invoke an operation from your code?
3. Make sure to use correct SOAP version for the corresponding binding.
4. Based on your analysis, it have a feeling that the service provider supports only SOAP1.1
5. Try with:
 
Sujeeth Pakala
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Do you have 2 explicit bindings for both SOAP1.1 and SOAP1.2 versions in WSDL ?
2. Which binding are you using to invoke an operation from your code?
3. Make sure to use correct SOAP version for the corresponding binding.
4. Based on your analysis, it have a feeling that the service provider supports only SOAP1.1
5. Try with:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!