Amit
Amit

Reputation: 463

Version mismatch from SOAP API

I am calling SOAP API from postman with following request.

<?xml version="2.0" ?>
<Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <Body>
    <get xmlns:S="http://xml.abc.com/cde/2.xsd" xmlns:S="http://ws.abc.com/cde.2">
      <sid>2</sid>
    </get>
  </Body>
</Envelope>

But, it is giving following response.

<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
            <faultcode>S:VersionMismatch</faultcode>
            <faultstring>Couldn't create SOAP message. Expecting Envelope in namespace http://schemas.xmlsoap.org/soap/envelope/, but got  </faultstring>
        </S:Fault>
    </S:Body>
</S:Envelope>

Can someone help me, what am I doing wrong.

Upvotes: 3

Views: 13883

Answers (2)

Abdelfateh ABDA
Abdelfateh ABDA

Reputation: 1

It is related to the SOAP version. SOAP 1.2 uses http://www.w3.org/2003/05/soap-envelope for the namespace and SOAP 1.1 uses http://schemas.xmlsoap.org/soap/envelope/.

For reference, see http://www.w3.org/TR/soap/ and look at the envelope section in the different version specs.

Upvotes: 0

Red Boy
Red Boy

Reputation: 5719

Your Soap Envelope namespace is incorrect, your request should be something like--

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
    <soap:Body>
        <ns1:get xmlns:ns1="http://ws.abc.com/cde.2">
            <ns1:sid>2</ns1:sid>
        </ns1:get>
    </soap:Body>
</soap:Envelope>

Upvotes: 2

Related Questions