Gopalan Suresh Raj's Web Cornucopia
An Oasis for the parched Enterprise Services Engineer/Developer

    The-Web-of-Services-Binding Style to use – Document or RPC?


    There are two communication style models that are used to translate a WSDL binding to a SOAP message body. They are:

    1. Document, and
    2. RPC

    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:

    1. literal, and
    2. encoded

    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.

    • Document/literal
    • Document/encoded
    • RPC/literal
    • RPC/encoded

    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.

    Author Bibliography

    Gopalan Suresh Raj is a Senior Analyst, Software Architect, and Developer with expertise in multi-tiered systems development, enterprise service architectures, and distributed computing. He is also an active author, including contributions to Professional JMS Programming, Wrox Press, 2001, Enterprise Java Computing-Applications and Architecture, Cambridge University Press, 1999, and The Awesome Power of JavaBeans, Manning Publications Co., 1998. He has submitted papers at international fora, and his work has been published in numerous technical journals. Visit him at his Web Cornucopia© site ( or mail him at