SOAP & XML
The SOAP/XML stack an analyst still meets in enterprise integrations — SOAP message parts, WSDL, XSD, XML namespaces, XML vs JSON/HTML, JSON Schema, and SOAP faults.
12 questions
JuniorTheoryVery commonHow does SOAP differ from REST in transport, contract, security, and error handling?
How does SOAP differ from REST in transport, contract, security, and error handling?
SOAP is a strict XML protocol over many transports, with a formal WSDL contract, built-in WS-Security, and errors as SOAP Faults. REST is an HTTP style, usually JSON, with a looser contract, HTTPS-level security, and HTTP status codes for errors. REST is lighter; SOAP suits strict enterprise integration.
Common mistakes
- ✗Swapping which one is strict XML with a WSDL contract
- ✗Calling SOAP the lighter option for a simple public API
- ✗Thinking REST reports errors via
Faults rather than HTTP codes
Follow-up questions
- →Which style carries its security model inside the message itself?
- →Why is REST usually lighter on the wire than SOAP?
JuniorTheoryCommonWhat is SOAP, and which parts make up a SOAP message?
What is SOAP, and which parts make up a SOAP message?
SOAP is a protocol for exchanging structured messages as XML over a network. Each message is an Envelope wrapping an optional Header for metadata like security or routing, and a mandatory Body carrying the actual call, its response, or a Fault on error.
Common mistakes
- ✗Calling SOAP a data format rather than an XML-based messaging protocol
- ✗Thinking the
Headeris mandatory and theBodyoptional (it is the reverse) - ✗Forgetting a
Faultis returned inside theBody, not as a bare HTTP error
Follow-up questions
- →Which SOAP element is optional, and what typically goes in it?
- →How does a SOAP
Bodysignal that the call failed?
JuniorTheoryCommonWhat is WSDL, what does it describe, and who generates it?
What is WSDL, what does it describe, and who generates it?
WSDL is an XML contract describing a SOAP service — its operations, their input/output message types, the bindings that map them to a protocol, and the endpoint address. The server framework usually generates it; clients consume it to build matching stubs and call the service correctly.
Common mistakes
- ✗Confusing the WSDL contract with the actual SOAP request payload
- ✗Thinking a human writes WSDL by hand rather than a framework generating it
- ✗Believing WSDL is a transport, not a service description
Follow-up questions
- →Which WSDL parts describe operations versus the concrete endpoint?
- →How does a client turn a WSDL into callable code?
JuniorTheoryCommonWhat is the difference between an XML attribute and an XML element, and when do you use each?
What is the difference between an XML attribute and an XML element, and when do you use each?
An element is a node with its own tags that can hold text, child elements, and repeat; an attribute is a name-value pair on the opening tag. Use elements for structured or repeatable data that may grow; use attributes for simple, singular metadata like an id or a unit that won't need children.
Common mistakes
- ✗Thinking attributes can nest or repeat like elements
- ✗Putting repeatable or growing data in attributes instead of elements
- ✗Treating the choice as arbitrary with no modelling consequence
Follow-up questions
- →Why is repeatable data better modelled as elements than attributes?
- →Can an attribute hold child nodes? Why does that limit its use?
JuniorTheoryCommonHow does XML differ from HTML, and what separates a well-formed from a valid XML document?
How does XML differ from HTML, and what separates a well-formed from a valid XML document?
HTML has a fixed tag set for displaying a page; XML lets you define your own tags to carry data, with no presentation meaning. Well-formed means the syntax is correct — tags closed and properly nested. Valid is stronger: well-formed and also conforming to a schema such as an XSD.
Common mistakes
- ✗Treating well-formed and valid as synonyms
- ✗Thinking XML, like HTML, describes presentation rather than data
- ✗Believing valid is a weaker check than well-formed
Follow-up questions
- →Can a document be well-formed but not valid? Give an example.
- →Why does XML carry no presentation meaning of its own?
JuniorTheoryCommonWhat is XSD, and what can it validate that plain XML cannot?
What is XSD, and what can it validate that plain XML cannot?
XSD is an XML Schema — an XML document defining the allowed structure of other XML: which elements and attributes may appear, their order, cardinality, and data types. Plain XML can only be well-formed; validating against an XSD also confirms it is valid, matching the agreed contract.
Common mistakes
- ✗Thinking any well-formed XML is automatically valid without a schema
- ✗Confusing XSD (structure and types) with XSLT or CSS styling
- ✗Assuming XSD constrains only syntax, not element order or data types
Follow-up questions
- →What is the difference between well-formed and valid here?
- →Which XSD feature lets you restrict an element's data type?
MiddleTheoryCommonHow does XML differ from JSON in size, schema, and arrays, and when is XML still the right pick?
How does XML differ from JSON in size, schema, and arrays, and when is XML still the right pick?
JSON is compact, has native arrays and objects, and dominates web APIs; XML is verbose but offers namespaces, attributes, comments, and mature schema tooling like XSD and XSLT. Pick XML where a legacy or regulated system demands it — banking, government, SOAP — or where rich validation matters most.
Common mistakes
- ✗Claiming XML is more compact or faster than JSON
- ✗Thinking JSON has mature schema and transformation tooling matching XML's
- ✗Forgetting regulated or legacy systems can still mandate XML or SOAP
Follow-up questions
- →Which JSON feature makes it lighter for web APIs than XML?
- →Name one regulated context where XML is still mandated.
JuniorTheoryOccasionalWhat is JSON Schema, what can it constrain, and have you used one?
What is JSON Schema, what can it constrain, and have you used one?
JSON Schema is a JSON document describing the allowed shape of other JSON: required fields, their types, value ranges, enums, string patterns, and nested structure. Tools validate a payload against it — the JSON-world equivalent of XSD for XML — and analysts use it to pin down an API contract.
Common mistakes
- ✗Confusing JSON Schema (a contract) with an example payload
- ✗Thinking it validates XML or is itself written in XML
- ✗Assuming it constrains display rather than field types and structure
Follow-up questions
- →Which XML technology is JSON Schema most analogous to?
- →Name two constraints JSON Schema can express on a field.
JuniorTheoryOccasionalWhich tools do you use for XML, XSD, and WSDL, and how do you test a SOAP service?
Which tools do you use for XML, XSD, and WSDL, and how do you test a SOAP service?
For editing and validating XML against an XSD, use IDE plugins or online validators; for SOAP, a client like SoapUI or Postman imports the WSDL and generates sample requests. You test by sending crafted envelopes and checking the responses and Faults against the contract and the schema.
Common mistakes
- ✗Thinking a SOAP service is tested by viewing the WSDL in a browser
- ✗Skipping schema validation of the request and response payloads
- ✗Not using a client to import the WSDL and craft envelopes
Follow-up questions
- →What does importing the WSDL into the client give you?
- →How would you confirm a response matches the agreed schema?
MiddleTheoryOccasionalWhat is a SOAP Fault, what does it contain, and how does SOAP error handling differ from REST status codes?
What is a SOAP Fault, what does it contain, and how does SOAP error handling differ from REST status codes?
A SOAP Fault is the standard error element returned inside the Body. It holds a fault code (a category like Client or Server), a fault string for humans, and optional detail. REST signals errors through many HTTP status codes; SOAP uses one transport code, usually 500, and puts the error in the Fault.
Common mistakes
- ✗Thinking a
Faultis an HTTP header rather than an element in theBody - ✗Assuming SOAP uses many HTTP status codes the way REST does
- ✗Forgetting the fault code is a fixed category, not a free identifier
Follow-up questions
- →What kind of value is the SOAP fault code — free text or a category?
- →Why can't a SOAP client rely on the HTTP status to classify the error?
SeniorDebuggingOccasionalFind the errors in this XML snippet and say what a parser would report.
Find the errors in this XML snippet and say what a parser would report.
There are three well-formedness errors. The attribute value in id=42 is unquoted; <price> is closed by </Price>, but XML tag names are case-sensitive; and <b> and <note> overlap instead of nesting. A parser stops at the first fault — the unquoted attribute — and reports a fatal not-well-formed error.
Common mistakes
- ✗Thinking XML tag names are matched case-insensitively
- ✗Assuming a parser auto-corrects overlapping or unquoted markup
- ✗Believing well-formedness errors are warnings rather than fatal
Follow-up questions
- →Why does the parser stop at the first error instead of listing all of them?
- →How would proper nesting of
<b>and<note>look?
JuniorTheoryRareWhat is an XML namespace, why is it needed, and what is the prefix for?
What is an XML namespace, why is it needed, and what is the prefix for?
An XML namespace is a URI that qualifies element and attribute names so identically-named tags from different vocabularies don't collide in one document. A prefix is a short alias bound to that URI, letting you write soap:Body instead of the full URI. The URI only identifies; it is never fetched.
Common mistakes
- ✗Thinking the namespace URI is a URL the parser downloads
- ✗Believing the prefix itself carries meaning, not the URI it binds to
- ✗Assuming same-named tags can never collide, so namespaces are pointless
Follow-up questions
- →Does changing the prefix but keeping the URI change the meaning?
- →Why is a namespace URI not required to resolve to a real page?