Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Web Services and the fly likes Axis RPC vs Document style web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Axis RPC vs Document style web service" Watch "Axis RPC vs Document style web service" New topic

Axis RPC vs Document style web service

kalra kalra

Joined: Jan 10, 2007
Posts: 2
As we know RPC style use soap encoding (Java <-> XML <-> Java) where as Dcoument style use literal encoding.

1.Can somene please explain me what's the difference between two

2. How does Dcoument style web service gives better performance

3. I have generated the wsdl(using axis) for both document and rpc style web service i.e. style="rpc" and style="document" in server-config.wsdd. I have noticed the difference the way it generates the soap messgae. In case of RPC, soap request message conatin operation name where as in case document style , soap request message does not contain operation name. this is the only difference I can figure it out

Does Axis do something different for document style web service i.e. in terms of serialization/deserialization, parsing etc so that document style web service do have better performance

Tom George
Ranch Hand

Joined: Jan 28, 2004
Posts: 41
RPC makes sense when you want to convert an existing function to a web service call. Essentially you give provision to switch back and forth between java & xml to expose your methods for a web service call. This is usually the case when you migrate existing functionality as such to web services (which IMHO is a bad idea anyway !)

Document based services are used when you pack together a set of data as xml and send it over to the server, which does a set of functionality and give you back some data as xml. For example, add goods to inventory, update an order processing system, send mail etc (maybe as an asynchronous process) Here you are more concerned about grouping business rather than migrating your java functions as web services.

Performance improvements of one over the other? hmm.. none - if the same functionality involved is the same.

Folks, correct me if I'm wrong !!

kalra kalra

Joined: Jan 10, 2007
Posts: 2
RPC style web service uses SOAP encoding whereas Document style web service use literal encoding.

In case of SOAP encoding each element in the SOAP body includes the XML Schema definition type of the data element.SOAP encoding with the embedded data types increases the amount of data transferred in the Web services request. Thus it increase the time to parse the data.

In case of Document encoding indicates that the rules to encode and interpret the SOAP Body are specified by a XML schema. THus each element does not contain data type. So payload size is less in this case
subject: Axis RPC vs Document style web service
It's not a secret anymore!