Youโ€™re the Expert!

pynfinity

SOAP API Playground

SOAP API Playground

Practice SOAP web service calls with real XML request/response โ€” no setup, no install

SOAP 1.1 / XML 4 Mock Services Fully In-Memory โ€” Server-Safe
Step 1 โ€” Select a Service
๐Ÿงฎ
Calculator
Add, Subtract, Multiply, Divide
๐ŸŒค๏ธ
Weather
Current weather & forecasts
๐Ÿ‘ค
User
Get, create & authenticate users
๐Ÿ’ฑ
Currency
Exchange rates & conversion
SOAP Response
๐Ÿ“จ
No response yet
Select a service, pick an operation, fill params, and hit Send.
Quick Examples โ€” Click to Load
๐Ÿ”ข 25 + 17
Add two numbers
CalculatorService โ€บ Add
โž— 100 รท 3
Floating point division
CalculatorService โ€บ Divide
๐ŸŒค๏ธ London Weather
Current conditions
WeatherService โ€บ GetWeather
๐Ÿ“… Tokyo 5-day
Multi-day forecast
WeatherService โ€บ GetForecast
๐Ÿ‘ค Fetch User #2
Get user by ID
UserService โ€บ GetUser
๐Ÿ” Auth Login
Get a mock JWT token
UserService โ€บ AuthenticateUser
๐Ÿ’ฑ $100 โ†’ INR
Currency conversion
CurrencyService โ€บ Convert
๐Ÿ“Š EUR Rates
All exchange rates
CurrencyService โ€บ GetRates

What is SOAP? (Explained for Beginners!) ๐Ÿงผ

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.

The SOAP "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:

  • The Envelope (<soap:Envelope>): The package itself. It tells the receiving computer "Hey, this is a SOAP message!"
  • The Header (<soap:Header>): (Optional) This is like the postage stamp or the return address. It contains extra info like passwords, security tokens, or tracking IDs.
  • The Body (<soap:Body>): The actual message or request. For example, "Please give me the weather for London."
  • The Fault (<soap:Fault>): If things go wrong, SOAP sends back a special error message called a Fault instead of breaking down.
Example: Asking for the weather (The Request)
<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>

What is a WSDL? (The Rulebook) ๐Ÿ“–

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).

How to Use SOAP in Python ๐Ÿ

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)

Why do people still use SOAP? ๐Ÿฆ

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.

  • Built-in Security: SOAP has something called WS-Security which is incredibly strict and safe.
  • Reliability: It has WS-ReliableMessaging, meaning if the network crashes halfway, the system ensures the message is re-sent or cancelled safely. (Imagine transferring $10,000 when the internet drops!)
  • Strict Contracts: WSDLs mean that you absolutely cannot send the wrong data type. If it asks for an integer and you send text, it rejects it immediately, preventing crashes deep inside the database.

Use the playground above to practice reading and sending SOAP envelopes before using Zeep in your Python code! ๐Ÿš€



Pynfinity
Install Pynfinity Add to home screen for the best experience