Can postman request web service interface, Transport level information does not match with SOAP Message namespace URI

1. Background

Can postman request the web service interface, and must the soap-UI software be installed?
No, the essence of requesting web service is HTTP request, you can use postman to request web service

2. How to use POSTMAN to request the web service interface

Not difficult, to do:

  1. To know what the requested URL is
  2. to use POST

Because there is a request body, you must not use GET. I haven’t tried PUT and the like, but this web service is so old. How could you think of using PUT when it was born in the age of GET/POST? You can just use POST

  1. The request body must have parameters

Even if the actual requested interface has no parameters, it always needs to be packaged into a soap message, that is, the xml request parameters are thrown into the request body

  1. To set the correct Content-Type

In the header, just set a header that is Content-Type

3. How to set the correct Content-Type

Depending on the version of the web service, the set Content-Type is slightly different

If the setting is incorrect, there will be an error message of soapenv:VersionMismatch and Transport level information does not match with SOAP Message namespace URI

What version is the key to see the declaration of the request parameter:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
<soap:Envelope xmlns:soap="http://www.w3 .org/2003/05/soap-envelope”

SOAP 1.1 : http://schemas.xmlsoap.org/soap/envelope/
SOAP 1.2 : http://www.w3.org/2003/05/soap-envelope

1.1 The content-type needs to be used text/xml, and encoding can also be added: text/xml; charset=utf-8
1.2 Use: application/soap+xmlor encoding can also be added:application/soap+xml; charset=utf-8

If the wrong Content-Type is set, for example, text/xml is set in 1.2, an error will be reported, which clearly indicates Version mis match

<?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>Transport level information does not match with SOAP Message namespace URI</faultstring>
            <detail></detail>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>

Guess you like

Origin blog.csdn.net/w8y56f/article/details/131342702