Still looking at WSDL 2.0 – just looking at the primer, so far (will dip into the bowels of the http extensions later). It has some awesome stuff.
WSDL has always had the notion of a message. Rather than treating function parameters as a separate things, the set of parameters is treated as a whole multivalued message. It simplifies things a great deal. WSDL2 takes it a step further and simply uses XSD to define its types. An operation’s input and output are simply a reference to an element. Bing! No need anymore for a whole slab of spec involving types.
Of course … binding the types to a technology is tricky. What they do do is define certain patterns. We have (as far as I can make out) the notion of “an XML type that’s simple enough to be turned into a querystring” – something like:
<getFoo> <param1>Bar</param1> <param2>Bar</param2> </getFoo>
Just one level of structure. Anything more complex than that cannot be turned into a querystring type message binding. But you can always use a POST and state that the message is passed as a literal XML document. Job done. The point being – with WSDL2, there is less you have to learn.
One of the things I was very concerned about was that we pass around semweb URIs. It used to me the case that the http wsdl gear involved fiddling with the query string and attaching that to a root URL. How would to talk about a thing where the whole of the string was a “message”? Where there was no “base”?
Silly me. Of course they’d been working on that. You can define in your XSD that a particular item (of xs:URI type) is actually a reference to some physical HTTP binding – a specific “operation” on some declared “endpoint”. But … the repercussions of that are … . After all, these endpoints return messages that are typed.
You can state that a “message” is passed around as an XML literal. A WSDL “compiler” (Apache AXIS, for instance) might understand that and do it as DOM objects. But equally, it might turn the XML into a set of beans. So, it can generate a Foo object with getter methods. But, if one of the entries in the message object is a URI that is declared to be a reference to some sort of HTTP endpoint, (which is typed, naturally), then the generating code could generate a stub that makes the HTTP call.
The example they give is:
<xs:attribute name="url" type="xs:anyURI" wsdlx:interface="svc:BookInterface" wsdlx:binding="svc:BookHTTPBinding"/<
(nb: an xml namespace prefix such as “svc” above is not necessarily a schema – it may be used for xml content that uses abbreviated uris)
Geddit? A full internet of objects, accessible by java getters, defined in the platform-independent WSDL. The key technologies being XML and HTTP. You don’t write the code to make HTTP calls and serialise/deserialise: AXIS does. (hopefully).
Our XML here at biodiversity.org uses URI references all over the place – a Name is in a Publication and so on. In our new-style XMLm (which we have not released), we use XML types for these. Piggybacking this functionality onto the data we already have is as simple as defining it properly in the schema document.
I’m more convinced that ever that Web Services Description Language is the right way to describe Web Services – which is what these “cool uris” are, after all.