XML interview question · Most asked
What's the difference between SOAP and REST?
Summary
SOAP is an XML messaging protocol with an envelope, header and body, formal contracts in WSDL/XSD, faults as XML, and WS-* standards for message-level security and reliability. REST uses HTTP resources and verbs, usually with JSON, HTTP status codes for errors, and TLS/OAuth for security.
Longer Answer
SOAP is still common in banking, payments, travel, government and ERP integrations; new public APIs are almost always REST or GraphQL. Generated clients from WSDL make SOAP integration mostly about configuration and error handling.
Key Points
- SOAP: envelope, WSDL, faults.
- REST: resources, HTTP semantics.
- WS-Security vs TLS/OAuth.
- Where each is used today.
Deep dive: XML Tutorial: SOAP and WSDL
Explanation
What interviewers look for
Balanced comparison with real contexts.
More most-asked XML questions
- Explain XML namespaces and the default namespace.
- Your XPath query returns nothing, but the elements are clearly there. What's the likely cause?
- Compare DOM, SAX and StAX (or pull parsing).
- What's the difference between well-formed and valid XML?
- What is an XXE attack and how do you prevent it?
- How would you process a 10 GB XML file?
- What is XML and where is it still used today?
- Which characters must be escaped in XML, and what is CDATA?