10
votes

What is the difference between XML and SOAP? I've been reading some introductory articles about SOAP but I am very confused. This is the first time I am reading about SOAP so maybe that's natural.

Could somebody please explain to me what SOAP is and what it is used for? Maybe give me some examples of its usage?

3
I once ran across a programmer who also needed to ask the question "Could somebody please explain to me what SOAP is and what it is used for?", but without the capitalization.Larry Lustig
seriously, i'm still laughing @ this comment...Derek Adair
Programmers and good hygiene do not always go hand in hand.Jhourlad Estrella

3 Answers

20
votes

After reading all of the other good answers, I thought it might be helpful to provide a "super laymans" version. I hope it helps.


SOAP is like the computer version using the postal service. A message (like a letter) is placed in an envelope and sent off to the person it is intended for.

Primarily, SOAP is an XML vocabulary. It defines a language, using the XML specification, for how to address and send send messages.

Specifically, it standardizes what we refer to as:

  • "an envelope" (actually called a SOAP envelope)
  • "the letter" (called "the body")
  • various annotations (called "headers" - think of these like stamps, signature request, sender information, etc - which the post-office uses to route the message)

In addition, SOAP defines a type-system, much like the type definitions you find in .Net, Java or XSD. I won't elaborate on this - as there is plenty of documentation out there as mentioned in previous answers.

The primary design focus of this language/vocabulary was to allow interoperability across platforms. So, Java calling COM, calling .Net, calling J2EE and the rest while remaining extendable for the foreseeable future. Instead of building yet another bridge between a COM object and a Java class, we can simply use SOAP to expose the functionality of our object so that other platforms can use them without the need for bridges. Or, to put it differently - SOAP was one last bridge, designed to replace all of the previous bridges.

By now, all major development toolkits have some form of SOAP support. This has made interoperability more and more available - but in most environments, a certain level of configuration is still necessary in order to make communication truly seamless.

I should note also that SOAP no longer stands for what its original intent was. At some point, I think some important person will (re)name it: Service Oriented Access Protocol.

I hope this helps!

10
votes

Wikipedia has a wonderful article, including a good example.

SOAP, originally defined as Simple Object Access Protocol, is a protocol specification for exchanging structured information in the implementation of Web Services in computer networks.

A really good practical example:

As a layman's example of how SOAP procedures can be used, a SOAP message could be sent to a web-service-enabled web site (for example, a house price database) with the parameters needed for a search. The site would then return an XML-formatted document with the resulting data (prices, location, features, etc). Because the data is returned in a standardized machine-parseable format, it could then be integrated directly into a third-party site.

2
votes

SOAP is a messaging protocol used over networks to invoke web-services.
The message formats use XML, and are described by WSDL's - pronounced wizdil.

WSDL's are also XML documents.

XML is a document format that uses tags to identify the contents of the file, its usage is wider than SOAP and WSDL which are specific types of XML.
See the w3schools tutorial for XML at http://www.w3schools.com/xml/default.asp