0
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope"
    xmlns="http://soap.sforce.com/schemas/class/ApexSoapIntegration">
    <soapenv:Header>
        <SessionHeader>
            <sessionId>00D2w00000NyplZ!ARIAQOTvyzYiiAEb9n3NsitGnTVtW1TRTPCA.5fzTg9pbJ.oGbKl.af7Q9rLFbRSsQZl7ipkRnT1tRx_yabR6rm0N0EceYET</sessionId>
        </SessionHeader>
    </soapenv:Header>
    <soapenv:Body>
        <getRecord>
            <name>Sample</name>
        </getRecord>
    </soapenv:Body>
</soapenv:Envelope>

I am sending this soap api request to the salesforce method, I have already set the headers SOAPAction = '' and Content-Type='text/xml'. But still I am getting this error.

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <soapenv:Fault>
            <faultcode>soapenv:VersionMismatch</faultcode>
            <faultstring>The SOAP request must use SOAP 1.1, did not recieve a SOAP 1.1 Envelope as the document root</faultstring>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>

How can I resolve this issue? Any help will be really appreciated. Thank you

1 Answer 1

0

You need to use the correct namespace for the SOAP envelope i.e., http://schemas.xmlsoap.org/soap/envelope/ (Observe the / at the end )

Change the line from

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope"
    xmlns="http://soap.sforce.com/schemas/class/ApexSoapIntegration">

to

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns="http://soap.sforce.com/schemas/class/ApexSoapIntegration">
1
  • 1
    Thank you so much Swetha, It worked.
    – Ameer
    Jun 14, 2023 at 6:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .