One thing people who hate SOAP say is that the XML for SOAP is ugly. That used to be a problem because of rpc/encoded style. But thanks mostly to WS-I the SOAP community has moved on to the simpler document/literal.

The nice thing about doc/lit is that it's really just any ol' XML message with two SOAP tags wrapped around it. SOAP says very little about what's inside your message, just that it should have a namespace and it should be describable via XML Schema. Here's an example:

<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope>
  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns="http://example.com/myAppSchema">
  <soap:Header>
    <username>nelson</username>
    <password>ossifrage</password>
  </soap:Header>
  <soap:Body>
    <purchase>
      <product>Soul Harvest</product>
      <isbn>0842329250</isbn>
    </purchase>
  </soap:Body>
</soap:Envelope>
The stuff in black is the app's data. The rest is what you need to turn some random XML into a SOAP message.

Even those two SOAP tags might seem like too much, but they give you a couple things. The headers give you a transport-neutral way to add header metadata to a message, and SOAP Faults (not shown) give you a structured way to indicate detailed errors.

If you're comfortable parsing XML, you're comfortable parsing doc/lit SOAP. But SOAP also offers the possibility of automatic data bindings (no parsing required) and WSDL (service description). Alas, those technologies still don't work so well in Perl, Python, or PHP where doc/lit support is weak. It does work pretty well in Java and .NET.

techwebservices
  2004-09-12 16:48 Z