axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: Document style web services
Date Mon, 25 Nov 2002 19:08:00 GMT
Excellent description! The few books that I've read on web services give 
very superficial presentations on the different styles and encodings, 
(it's so typical of some authors to gloss over the meat of the matter). 
Which leads me to the question, can you refer me to any good books, or 
other materials, that describes the different styles and encoding in some 
detail and clarity?

"Anne Thomas Manes" <>
11/22/2002 01:43 PM
Please respond to axis-user

        To:     <>
        Subject:        RE: Document style web services

SOAP supports two different ways to structure messages. A SOAP message can
be structured as an RPC or a document.

The RPC style simulates an RPC invocation and response. An RPC input 
specifies the name of the procedure to be invoked, and it contains a set 
input parameters. An RPC output message contains the return value and any
output parameters of the procedure. The format of the RPC input and output
messages can be defined by literal XML schema definitions, or they can be
structured using a data model called SOAP encoding. This SOAP encoding 
model allows you to easily map complex object-oriented data structures
(graphs) to XML. So for example, an RPC message looks something like this:

    <m:methodName xmlns:m="someURI">

Document style does not impose any particular structure to the message.
There's no automatic convention for how to specify a method name or a list
of parameters. The format of the document input and output messages are
defined by XML schema definitions, which may be defined within the Web
service's WSDL document or within a separate schema. Formatting a SOAP
message according to a specified schema is called literal encoding. 
style can be used for request/response messages or for one-way messages.
It's up to the SOAP listener to figure out where to direct the message. In
many cases the method name is specified in the SOAPAction HTTP header 
than in the SOAP message.

>From a practical point of view, there's very little difference from RPC 
document style. Your parameters in RPC style can be as complex as you 
For example, you can pass a purchase order as a document or as a parameter
in a method called placeOrder. It's your choice:

Document style:
    <m:purchaseOrder xmlns:m="someURI">

RPC style:
    <m:placeOrder xmlns:m="someURI">

The bigger difference is how you encode the message. In most 
you use literal encoding with Document style and SOAP encoding with RPC
style. Literal encoding means that the Body contents conform to a specific
XML Schema. SOAP encoding uses a set of rules based on the XML Schema
datatypes to encode the data, but the message doesn't conform to a
particular schema. SOAP encoding is particularly useful is you're passing
cyclic object graphs. For example, if you have an element which is
referenced repeatedly within the object graph, when using SOAP encoding, 
would specify the element once and then reference the element as needed.
When using literal encoding, you would have to repeat this element each 
it's referenced.

The advantage of using document or RPC messages structured using a literal
XML schema definition is that the messages can be validated using the 
and transformed using an XSLT stylesheet. RPC messages structured using 
encoding cannot be validated and transformed using standard XML tools. The
advantage of using SOAP encoding is that it provides a simpler and more
efficient method to represent and transfer object-oriented data in XML, 
it limits flexibility.


> -----Original Message-----
> From: Paul Faulkner []
> Sent: Friday, November 22, 2002 2:02 PM
> To:
> Subject: RE: Document style web services
> would you mind explaining what RPC-Style and Document-Style messages 
> Sorry I'm very new to this technology.
> thanks,
> Paul Faulkner

View raw message