The referenced chapter is in error.
On page 329 it reads:
>> "In document/literal style, the contents between <SOAP-ENC:Body>
>> and </SOAP-ENC:Body> are sent as an XML string to the application,
>> which is responsible for parsing the XML."
Also on page 333 it reads:
>> "In general, however, the effort and complexity involved in document
>> style service is greater than for RPC style..."
This information is incorrect. First -- it uses the wrong namespace
prefix -- it should be SOAP-ENV rather than SOAP-ENC. Second,
document/literal does not mandate that the SOAP payload be delivered as a
string, nor does it require the application to parse the XML. The message
style (RPC/Encoded versus Document/Literal) simply defines the format of the
message on the wire, and it really has nothing to do with the programming
model. A JAX-RPC implementation should be able to automatically marshal both
formats. If you prefer to let your application parse the XML, you can return
the data as a string, but it's not required. JAX-RPC should be able to
return document/literal data as Java objects. In fact, from a programming
point of view, the only difference that you should see between RPC/encoded
versus doc/literal is a configuration setting or generation switch.
The chapter is correct when it says that RPC messages cannot be validated
using an XML Schema -- which I view as a major draw-back to RPC messages.
My advice is to always use doc/literal. The WS-I Basic Profile disallows the
use of SOAP encoding, therefore you shouldn't use RPC/encoded. (SOAP
encoding was designed as a stop-gap measure in the original SOAP spec
because XML Schema wasn't final. Now that XML Schema is final, we really
don't need SOAP encoding anymore.) The JAX-RPC spec doesn't require support
for RPC/Literal, and lots of systems don't support RPC/Literal, therefore
you shouldn't use RPC/Literal. So that only leaves Document/Literal.
Anne
----- Original Message -----
From: "Samuel D Jackson" <bytecode_at_PHREAKER.NET>
To: <JAXRPC-INTEREST_at_JAVA.SUN.COM>
Sent: Saturday, June 28, 2003 12:41 PM
Subject: Re: literal / encoded style - ri behaviour?
> The JAX-RPC chapter from the web service book has a good explaination and
when to use each.
>
> http://www.theserverside.com/resources/article.jsp?l=JWSA
>
>
> Hope this helps
> =samuel
>
>
> On Sun, 9 Feb 2003 04:53:42 -0700, Mischa <yawningrascal_at_HOTMAIL.COM>
wrote:
>
> >hi,
> >
> >i am newbie in soap and web services and i wonder
> >what are the differences, when i want to work with
> >jax-rpc either in encoded or in literal style in a rpc
> >way.
> >
> >does literal style mean that i got to write my
> >own serializers, dezerializers based on my own schemas?
> >what happens, if the jax-ri recieves a literal style
> >soap document and what will happen with encoded style
> >messages?
> >
> >thanx,
> >mischa
>