0

Soap-request generated Java application [Failed]

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
   xmlns:dir="http://xxxxxxxxxx">
  <soapenv:Body>
    <xxxxxxxxxxx>       
  </soapenv:Body>
</soapenv:Envelope>

Soap-request generated by SoapUI [Successful]

 <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
   xmlns:dir="http://xxxxxxxxxx">
 <soap:Header/>
   <soap:Body>
     <dir:ping/>
   </soap:Body>
 </soap:Envelope>

How to change namespace uri "http://schemas.xmlsoap.org/soap/envelope/" to "http://www.w3.org/2003/05/soap-envelope". I haven't created any client, i have just created java class and running i'm able to send request and getting faultcode response because of the above uri links. I found it is version mismatch but i dont know how to change.

2
  • Add your java soap client code snippet without it, its hard to answer. Commented Jun 28, 2018 at 7:52
  • Link to code snippet I have used the same code in the answer shown in this link..... Commented Jul 2, 2018 at 4:05

2 Answers 2

1

I feel that you must be using the default SOAP implementation(which is SOAP 1.2) as provided into the Statckoverflow question. Your web service may be expecting SOAP 1.1.

If you could change it SOAPMessageFactory1_1Impl implementation it should solve your problem. Your namespace will changed to xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

Change callSoapWebService method first line to following and it should resolve the issue.

SOAPMessage soapMessage = SOAPMessageFactory1_1Impl.newInstance().createMessage();

Hope it helps.

Sign up to request clarification or add additional context in comments.

1 Comment

Change between schemas.xmlsoap.org/soap/envelope and w3.org/2003/05/soap-envelop worked fine for me!
1

MessageFactory factory = MessageFactory.newInstance(); ------ it will give 1.1 version default

change to following to get the 1.2 version of soap namespace

MessageFactory factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);

you can find it in SAAJ tutorials

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.