SOAP Interop and the First Class Document

From Dare Obasanjo, following up on Mark Baker:

The main problem with WS-* interop is that vendors decided to treat it as a distributed object programming technology but based it on a data typing language (i.e. XSD) which does not map at all well with traditional object oriented programming languages. On the other hand, if you look at other XML-Web-Services-as distributed-objects technology like XML-RPC, you don’t see as many issues. This is because XML-RPC was meant to map cleanly to traditional object oriented programming languages.

Unfortunately I don’t see the situation improving anytime soon unless something drastic is done.

I agree, but I’d put it differently. The problem is people continue to use the data representation of their native programming language as the first class citizen and the interface (eg. WSDL) and invocation (eg. SOAP) as second-class artifacts. If you’re going to publish a contract and expect documents as invocation mechanisms, then the contract and the document are the first class citizens and the mapping to the native language’s data representation is the second class citizen. The fact that something in the WSDL/SOAP doesn’t map well to a particular programming language’s data representation is simply a bug in the implementation of that particular service/client, not a SOAP problem.

We’re not going to have much luck as long as we expect the mapping between native representation and SOAP representation to be magic when our mapping language is so poorly suited and so poorly implemented for such a task. Assume what you’re getting is an XML document and figure out how to pull what you need out of it. My take is, write XPath statements. It’s not that scary, just use a tool to get the XPath statements that pull your desired data and put it into your favorite data structure. Skip the whole magic mapping thing, it won’t work for you for a long time to come.

Update: Here’s Steve talking about the same thing:

  1. The misguided attempt to seamlessly map XML documents into local structures and method calls
  2. The doomed attempt to seamlessly map from local structures and method calls into XML documents

Leave a Reply