It seems not a week goes by without some poor lost soul looking to me to help publish a Web service in a way which stands some chance of interoperating. I helped carefully craft guidelines published on an internal Wiki, but it says much about how we now work that policy published on an internal anything isn’t always authoritative, useful or readily available. This is especially true when dealing with people working for third party suppliers, consultancy groups, outsouring outfits and wot not, ironically the very users most Web services are targeted at. So in the interest of transparency, and to assist my moving on, here are some simple best practices you might like to follow when publishing a Web service:
- WS-I Basic Profile Conformance
- Although you may use other specifications yourself, don’t expect your customer to understand anything beyond SOAP 1.1 and WS-Addressing, I’d suggest using 2004/08 namespace, but most tools now understand the W3C WS-Addressing recommendation. Following the WS-I Basic Profile 1.2 is pretty much all you need, and is easily checked using the testing tools.
- WSDL First
- You don’t have to publish a WSDL document, but most people using Web services will expect one. Don’t entrust this task to generalised tooling such as XMLSpy, and avoid like the plague tools which generate WSDL from Java or C# which spew out WSDL almost as an afterthought which doesn’t interoperate, exposes the wrong information, and can be very brittle when recompiling or regenerating your code. Instead consider using a simplified model and some simple templating technology, such as XSLT, to generate your WSDL under your control, consistently. As an example of simple WSDL you can follow, see ThirdPartyCall.wsdl.
- W3C XML Schema Patterns for Databinding Conformance
- Although not obligatory, most consumers of your Web service will expect to be abstracted away from the contents of the messages being exchanged using databinding tools. WSDL which only contains XML Schema constructs offered by the W3C XML Basic Schema Patterns for Databinding specification is far likelier to interoperate with toolkits. Note very few standard schemas interoperate with databinding tools, so forget generating Java etc from the likes of SPML, HL7, OAGIS, etc wrapped up in WSDL.
- XML Schema Killed Message Evolution
- At some point you’ll likely as not want to make minor changes to your interface without breaking existing interactions. This is neigh impossible if you use XML Schema to describe your message contents, and care about interoperability with tools. In WSDL, you can add another operation, and in XML Schema, you can add additional elements and types, but the cleanest way is to communicate a breaking change by publishing another WSDL document with a different namespace. Yeah, I know, it sucks, but heck, we tried!
- Expect to Document WS-Security
- If you do use WS-Security, then follow the WS-I Basic Security Profile and expect to have to write documentation to describe the message contents, as we have for the Web21C SDK. This is the point where most customers will thank you for providing an SDK, rather than exposing description in one of the many flavors of WS-Policy containing one of the myriad of versions of assertion languages, few, if any of which, will interoperate with tools.
Of course things continue to slowly improve, and this advice will date, eventually. However, and this is really important, if you care about not wasting lots of your customers’ time and money, unless you are developing a service for a single consumer who demands them, I would strongly advise you DO NOT use WS-* at all. Stick to exposing data as simple Web pages, secured using the OAuth pattern, or similar method employed by the likes of Google Base, BT Mojo, Amazon S3, Yahoo! BBAuth, Flickr, Facebook, etc, etc. IOW what Dare said.
Technorati Tags: Web services

Hmm, I do, of course, wholeheartedly agree with your “WSDL First” approach and also concur that one shouldn’t generate the WSDL from Java or C# code. But I am wondering what you mean by “Don’t entrust this task to generalised tooling such as XMLSpy” - especially since we just released a greatly improved visual WSDL editor with super design and documentation capabilities in XMLSpy this past year (see http://www.altova.com/products/xmlspy/graphical_wsdl_editor.html).
Yeah, I hate to name and shame a particular product, and I’m sure you’ve made lots of improvements over the years, but most of the most problematic WSDL and XML Schema documents I’ve encountered over the years published by the likes of companies and OASIS are headed by the “editied using XMLSpy” comment.
Hi Paul,
Just sharing a quick note with you..
The “edited with XMLSpy..” comment you see in the WSDL & Schema files doesn’t always mean that the files themselves were originally created or last modified with XMLSpy. All it really means is that at one point or another, someone opened and made modifications to these files and saved them using XMLSpy. Doesn’t mean the files are valid or not. It’s just simply a comment that can be turned off by any licensed user of XMLSpy. I wouldn’t regard it as a signature by XMLSpy that the files were generated or deemed valid by XMLSpy. I hope that helps explain things. With over 3 million users worldwide, this is typical.
I understand that, but based on my experience my comment stands. If you want to be sure of producing *interoperable* WSDLs, don’t trust state of the art generic editors such as XMLSpy to do so for you.
Over the years I have suffered Paul’s bemused scorn for my dependence on tools such as Spy/Oxygen but have kept faith and now things are *so* much better. (Early versions of xml tools did have a nasty habit of creating invalid xml never mind interoperable schema/wsdl!)
There is still a distinction to be made here between interoperable wsdl and interoperable schema but the problem with both is that they are very rich languages and a generic tool does not make value judgements as to how it *should* be done. Hence all our core wsdls get generated from a model (but if I need to tweak one I use an editor which keeps me sane scrolling through pages of angle brackets )
[...] full story here [...]
How is Turbo XML tool [Tibco product].