Practice SOAP web service calls with real XML request/response โ no setup, no install
SOAP (Simple Object Access Protocol) is an XML-based messaging protocol for exchanging structured information between systems over HTTP, SMTP, and other protocols. Unlike REST APIs that use JSON and flexible conventions, SOAP enforces a strict XML schema defined by a WSDL (Web Services Description Language) file. Every request is wrapped in a SOAP Envelope containing a Header and a Body, making it highly structured and suitable for enterprise integrations.
This playground lets you practice SOAP interactions without any external tools like SoapUI or Apache Axis. All 4 mock services โ Calculator, Weather, User, and Currency โ respond with real SOAP 1.1 XML envelopes including headers, namespaces, and fault handling. You can also view the auto-generated WSDL documents for each service to understand how SOAP defines its contracts. Every action runs entirely in-memory โ no server files are touched.
SOAP is widely used in banking, healthcare (HL7), government systems, and legacy enterprise software. Learning to read and construct SOAP envelopes is a key skill for backend developers, QA engineers, and integration specialists working with enterprise APIs and web services.
Imagine you are a detective, and you need to ask a library for a specific book. But the library is across the world, and they only understand a very specific, official language.
SOAP (Simple Object Access Protocol) is exactly like that official language. Itโs a way for two different computers to talk to each other over the internet, no matter what language they were programmed in (like Python, Java, or C#). It ensures the message is super strict, secure, and has a tracking number so nothing gets lost.
Unlike REST (which is like sending a quick, casual text message using JSON), SOAP is like sending a formal business letter packed in a specific envelope.
Every SOAP message is written in XML (eXtensible Markup Language). XML looks a bit like HTML because it uses tags (like <tag>), but it's used to carry data instead of styling web pages.
A SOAP message is always structured like a physical letter:
<soap:Envelope>): The package itself. It tells the receiving computer "Hey, this is a SOAP message!"<soap:Header>): (Optional) This is like the postage stamp or the return address. It contains extra info like passwords, security tokens, or tracking IDs.<soap:Body>): The actual message or request. For example, "Please give me the weather for London."<soap:Fault>): If things go wrong, SOAP sends back a special error message called a Fault instead of breaking down.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetWeather xmlns="http://pynfinity.com/soap/weather">
<city>London</city>
</GetWeather>
</soap:Body>
</soap:Envelope>
If you try to order food at a restaurant, you need a menu. A WSDL (Web Services Description Language) is the "menu" for a SOAP service.
It is a giant XML file that acts as a rulebook. It tells the programmer:
1. What operations exist (e.g., GetWeather).
2. What input it needs (e.g., it needs a city which is text).
3. What output it will give back (e.g., it will return the temperature and conditions).
In Python, we don't usually write all those XML tags by hand. We use a library! The most famous library for older Python code is `suds`, but modern developers use an awesome library called Zeep.
Step 1: Install Zeep
pip install zeep
Step 2: Basic Example (Calling a Service)
You literally just give Zeep the link to the WSDL file, and it does all the hard XML math for you!
import zeep # 1. Tell it where the WSDL menu is wsdl_url = "http://example.com/weather?wsdl" client = zeep.Client(wsdl=wsdl_url) # 2. Call the function directly as if it was normal python! result = client.service.GetWeather(city="London") print(f"The weather is: {result.temperature} degrees.")
Step 3: Advanced Example (Sending Headers/Security)
Sometimes, big bank or hospital servers require a username and password attached to the SOAP Header.
from zeep import Client from zeep.wsse.username import UsernameToken # Add a security token to the envelope header secure_token = UsernameToken('my_bank_username', 'super_secret_password') client = Client( 'http://mybank.com/api?wsdl', wsse=secure_token # Passes the security header ) # Call the secure function balance = client.service.GetAccountBalance(accountId="12345") print(balance)
You might think JSON and REST are much easierโand they are! But SOAP is heavily used by Banks, Government databases, Airlines, and Healthcare systems.
Use the playground above to practice reading and sending SOAP envelopes before using Zeep in your Python code! ๐