Use Case:
A QA engineer or developer needs to validate a legacy SOAP web service provided by an enterprise application. However, there is no UI available for direct interaction and using tools like SOAP UI feels heavy. They prefer a lightweight, quick alternative—Postman.
Solution Steps:
Step 1: Gather SOAP Endpoint and WSDL
Obtain the following from the service provider:
- SOAP endpoint URL
- WSDL (Web Services Description Language) URL or XML
- Sample SOAP Request XML (if available)
Step 2: Open Postman
Launch Postman and open a new tab for a new request.
Step 3: Configure Request
- Method:
POST
- URL: Enter the SOAP endpoint (e.g.,
https://example.com/soap/Service
) and not the wsdl url(except ?wsdl part) - Headers:
Content-Type
:text/xml;charset=UTF-8
SOAPAction
: (Optional — required for some services. Use the action URL from WSDL.)
Step 4: Add the SOAP Envelope in the Body
- Switch to the Body tab
- Select raw
- Choose XML (text/xml) from the dropdown
- Paste your SOAP XML envelope. Example:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservice.example.com/">
<soapenv:Header/>
<soapenv:Body>
<web:getUser>
<web:userId>12345</web:userId>
</web:getUser>
</soapenv:Body>
</soapenv:Envelope>
Step 5: Send Request
Click Send. You’ll receive a SOAP XML response in the same format.
Step 6: Validate the Response
- Check for the correct tags in the SOAP Body.
- Look for fault tags (
<soap:Fault>
) to debug errors.
How to Select a SOAP Operation in Postman
Step 1: Understand the WSDL File
Open the WSDL URL in a browser or download the XML. Look for the <wsdl:operation>
tags. Each one represents an operation you can call.
Example:
<wsdl:operation name="getUser">
...
</wsdl:operation>
Step 2: Identify SOAPAction (Optional but often required)
Under each operation, the WSDL may define a soapAction
attribute:
<operation name="getUser">
<soap:operation soapAction="http://example.com/getUser"/>
</operation>
You’ll use this value in the SOAPAction header in Postman.
Step 3: Copy the Request XML for the Operation
Often, the WSDL (or service documentation) includes a sample request for each operation. If not, you can generate one based on the operation’s input schema.
Example SOAP request for getUser
:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://example.com/webservice/">
<soapenv:Header/>
<soapenv:Body>
<web:getUser>
<web:userId>12345</web:userId>
</web:getUser>
</soapenv:Body>
</soapenv:Envelope>
Step 4: Paste in Postman Body
Paste the envelope into Postman's body (as described earlier), and update the SOAPAction header (if required) with the operation’s SOAPAction URL.
No comments:
Post a Comment