wood burning stoves 2.0*
The moose likes Web Services and the fly likes Diff b/w RPC / Document / MSG Style Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Diff b/w RPC / Document / MSG Style" Watch "Diff b/w RPC / Document / MSG Style" New topic
Author

Diff b/w RPC / Document / MSG Style

Baskaran Ragav
Greenhorn

Joined: Apr 13, 2007
Posts: 14
Hi,

Thanks for opening this.

I am a beginner to web service and i have a basic question.

What a web service style is all about.

and i heard that there are some style's like RPC, Document, Message..

Can any one tell me what is the difference b/w these and how does the style going to decide the web service.


Appreciate speedy response.

Thanks
- R
michael warren
Ranch Hand

Joined: Oct 20, 2006
Posts: 50
The style for a SOAP message can be RPC or Document, not sure where Message style comes in.

RPC means that the body of the SOAP message represents a Remote Procedure Call, with procedure name and in and out parameters - i.e. think of it as invoking a method provided by the webservice.

Document means that the body of the SOAP message is an XML document to be sent to the service, the document could still be thought of as the parameter to a procedure call, but its more flexible in what is sent and how its interperated by the web service.

Not a speedy response, but since no one else has replied I thought I'd have a go, note that this is just my understanding - feel free to correct me if its wrong
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 507
Hi there
Read the good article from IBM developerworks.

http://www-128.ibm.com/developerworks/webservices/library/ws-whichwsdl/

regds
amit


Regards,
Amit
Ephraim Paka
Ranch Hand

Joined: Apr 12, 2007
Posts: 37
Michael,

You said, "Document means that the body of the SOAP message is an XML document to be sent to the service..."

Does that mean for Document style we have to do mashalling/unmarshalling of
xml doc? I am using Webspheres SOAP runtime engine
Thanks
michael warren
Ranch Hand

Joined: Oct 20, 2006
Posts: 50
Yes, I think thats right, something has to do the translation from XML in a HTTP message to something meaningful to the code implementing the webservice.

If its RPC style then JAX-RPC can be used to handle the translation between XML and parameters/return values for a method call.

If its document style the code implementing the webservice will need to handle the XML contained in the SOAP body and produce any XML required to be returned in the body. The SAAJ API could still be used to deal with the SOAP messages as a whole though - just contents of the SOAP body (the "document") that would need to be delat with.

I don't know anything about Websphere though, but think the above will still be true.
Ephraim Paka
Ranch Hand

Joined: Apr 12, 2007
Posts: 37
My web service is going to interface a .net client ( VB.net), what do you think is the best messaging style, considering the interoperability and also the disadvantages of Marshalling/Unmarshalling?

Thanks Michael
michael warren
Ranch Hand

Joined: Oct 20, 2006
Posts: 50
There's various advantages/disadvantages to either, I don't think it being a .NET client should make any difference.

Using document style makes it easier to return more complicated data, and also makes it more flexible to changes in the future. Using RPC allows JAX-RPC to simplify the coding removing the need to parse XML.
Ephraim Paka
Ranch Hand

Joined: Apr 12, 2007
Posts: 37
Micheal,

Any thoughts on the following design question?

I am designing serivce class ( EJB Session bean) WSAD SOAP env.
I have 17 invokable methods in this service class, is it ok to have as
many method in one service class? What is a general rule about # of methods
in one serivce endpoint on which a WSDL is based?

Thanks
E
michael warren
Ranch Hand

Joined: Oct 20, 2006
Posts: 50
I saw that question posted in another thread and thought "I have no idea", but thinking about it I suppose its like asking how many methods should there be in a class - it just depends ....
If all the methods logically belong together then I would say keep them together.
Ephraim Paka
Ranch Hand

Joined: Apr 12, 2007
Posts: 37
If they donot belong together and we are looking at more than one endpoint and hence more than one wsdl? How do my service method invoke each other
if they have to interact ( lets say Order service and Customer service RUNNING ON THE SAME APPLICATION SERVER for simplicity)?

Thanks
E
michael warren
Ranch Hand

Joined: Oct 20, 2006
Posts: 50
Just to correct something I said earlier - I've found that you can use JAX-RPC with document style - just a setting on the generator of the stub classes (wscompile.bat -f ocumentliteral on Sun - but probably varies for different app servers). In fact since the Basic Profile 1.0 (not sure about later ones) specifies that only document literal or rpc literal styles are valid (i.e. encoded either document or literal is not valid) then the default setting of rpc encoded for wscompile should probably be overridden with document literal or rpc literal unless theres a good reason not to.

If you're generating a Webservice from a Java interface I think theres probably not any difference between document and RPC, from a simple experiment I've done the SOAP messages seem to be the same. - Feel free to correct me if I'm still wrong

Not sure about your last question - not sure if I understand it and don't think its really related to this thread. Perhaps try rephrasing it and starting a new thread ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Diff b/w RPC / Document / MSG Style
 
Similar Threads
Document Style
Procedure-style Web Services
How to determine if it is Document style or RPC looking at SOAP request ?
wsdl says binding style document , can client be of rpc style ?
Apache Axis wsdl2java tool