Infer JSON Schema from a SOAP Response
Generate JSON Schema from SOAP XML responses with namespace prefixes, envelope structure, headers, and typed response bodies.
Detailed Explanation
SOAP Response to JSON Schema
SOAP (Simple Object Access Protocol) is an XML-based messaging protocol still widely used in enterprise applications. Converting SOAP responses to JSON Schema is essential for API migration and integration projects.
Example SOAP Response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<auth:Authentication xmlns:auth="http://example.com/auth">
<auth:Token>eyJhbGciOiJIUzI1NiJ9</auth:Token>
<auth:Timestamp>2024-01-01T00:00:00Z</auth:Timestamp>
</auth:Authentication>
</soap:Header>
<soap:Body>
<ns:GetOrderResponse xmlns:ns="http://example.com/orders">
<ns:Order>
<ns:OrderId>12345</ns:OrderId>
<ns:Status>shipped</ns:Status>
<ns:Total>99.99</ns:Total>
<ns:Items>
<ns:Item>
<ns:ProductId>A001</ns:ProductId>
<ns:Quantity>2</ns:Quantity>
<ns:Price>29.99</ns:Price>
</ns:Item>
<ns:Item>
<ns:ProductId>B002</ns:ProductId>
<ns:Quantity>1</ns:Quantity>
<ns:Price>40.01</ns:Price>
</ns:Item>
</ns:Items>
</ns:Order>
</ns:GetOrderResponse>
</soap:Body>
</soap:Envelope>
Namespace Handling
The converter preserves namespace prefixes in property names. soap:Envelope, soap:Header, ns:Order all appear as-is in the schema. This is intentional — it maintains a clear mapping between the XML element names and their schema representation.
Schema Structure
The generated schema mirrors the SOAP envelope pattern:
- Envelope → object
- Header → object (authentication data)
- Body → object
- Response → object (business data)
- Order → object with typed fields
- Items → array of Item objects
- Response → object (business data)
Type Inference in SOAP
SOAP responses often contain strongly typed data:
OrderId→ integer (12345)Total→ number (99.99)Quantity→ integerStatus→ stringToken→ string
Migration to REST/JSON
This schema becomes the bridge when migrating from SOAP to REST APIs. You can:
- Generate the schema from existing SOAP responses
- Simplify the schema by removing the SOAP envelope layers
- Use the inner schema as the response schema for your new REST API
- Validate that the transformation preserves data integrity
Use Case
When migrating enterprise SOAP services to REST/JSON APIs, or when building integration layers that need to validate SOAP-to-JSON transformed data. This is one of the most common real-world scenarios for XML-to-JSON-Schema conversion.