Tuesday, March 18, 2008

WSDL Styles (continued...)

Just in case my explanation given in my last post wasn't clear on the difference between document and RPC styles, I thought I'd give a little bit more detail.

The document style stipulates that the SOAP body XML element contains one or more child elements (which the WSDL specification calls parts). Note that WS-I Basic Profile 1.0 stipulates that only a single part be specified for each message with the document style. There are no explicit formatting rules for these parts. The only requirement is that the service producer and consumer both agree on the representation.

The RPC style stipulates that the SOAP body XML element contains a single element with the name of the method being invoked. This element in turn contains an element for each method parameter with the element name matching the parameter name. Each WSDL part describes a single parameter.

The RPC style is simply more prescriptive than the document style. For every RPC/literal WSDL description, an equivalent document/literal WSDL description can be created such that the messages are identical on the wire.

Moreover with the RPC/literal style, the XML elements in the SOAP body corresponding to the method name and parameter names are known only by convention. The XSD schemas included in the WSDL document define only the structure of the parameters, not the elements binding them all together.

With document/literal assuming we conform to WS-I Basic Profile, we have a single XSD document describing the entire contents of the SOAP body. This is a lot simpler. So to reiterate, we only want to use the document/literal style.

No comments: