The-Web-of-Services-Binding Style to use – Document or RPC?09 Jul 2006
There are two communication style models that are used to translate a WSDL binding to a SOAP message body. They are:
- Document, and
The advantage of using a Document style model is that you can structure the SOAP body any way you want it as long as the content of the SOAP message body is any arbitrary XML instance. The Document style is also referred to as Message-Oriented style.
However, with an RPC style model, the structure of the SOAP request body must contain both the operation name and the set of method parameters. The RPC style model assumes a specific structure to the XML instance contained in the message body.
Furthermore, there are two encoding use models that are used to translate a WSDL binding to a SOAP message. They are:
- literal, and
When using a literal use model, the body contents should conform to a user-defined XML-schema(XSD) structure. The advantage is two-fold. For one, you can validate the message body with the user-defined XML-schema, moreover, you can also transform the message using a transformation language like XSLT.
With a (SOAP) encoded use model, the message has to use XSD datatypes, but the structure of the message need not conform to any user-defined XML schema. This makes it difficult to validate the message body or use XSLT based transformations on the message body.
The combination of the different style and use models give us four different ways to translate a WSDL binding to a SOAP message.
I would recommend that you read this article entitled Which style of WSDL should I use? by Russell Butek which has a nice discussion of the different style and use models to translate a WSDL binding to a SOAP message, and their relative strengths and weaknesses.
The final recommendation is to use document style with literal use for Web Services Interoperability(WS-I) compliance.
Another tip worth a read is Handle namespaces in SOAP messages you create by hand:Learn how WSDL maps to SOAP from the same author.
The samples Insurance Claim Composite Application presented here and the Loan Processing Composite Application presented here in this blog entry and here in this blog entry, use WSDL bindings that are document style with literal use, not only for WS-I compliance, but also for the other advantages that come with it.