aspose file tools*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Difference between RPC and Document web-services ? 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 » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "Difference between RPC and Document web-services ?" Watch "Difference between RPC and Document web-services ?" New topic
Author

Difference between RPC and Document web-services ?

Mikhael Jenings
Greenhorn

Joined: Apr 14, 2009
Posts: 25
I needed to understand the difference between RPC and Document web-services, or binding.
Appreciate it if someone can clarify the difference with a code example.

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hello!
With Document/Literal encoding, the payload of a message is an XML fragment that can be validated against the corresponding XML schema, for instance:


RPC (remote procedure call)/Literal more closely corresponds to remote procedure invocations.
For instance, the method: public float getBookPrice(String inISBN) would correspond to the following RPC/Literal request message:

There is a SOAP standard XML format for RPC-style messaging. However, use and implementation of this standard is optional.
Hope this makes things more clear!
Mikhael Jenings
Greenhorn

Joined: Apr 14, 2009
Posts: 25
Thanks, that clarifies things a bit.

To further take things, what is the effect of choosing either mode on (java) code ?
How are the generated artifacts different, when we do wsdl-to-java ?
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hello again!
When doing WSDL-to-Java, you will, in both cases, see JAXB generated wrapper classes for the request and response (and for any additional objects).
As far as I can tell, the only potential difference is the complexity of the JAXB bean hierarchy, as far as Document/Literal is concerned. However, the parameter(s) to a RPC invocation may also consist of an object hierarchy.
By looking only at the Java classes, I wouldn't dare to say that the web service uses either RPC/Literal or Document/Literal.

<IK:WARNING message="SECTION WITH PERSONAL OPINIONS AND WILD SPECULATIONS AHEAD!">
Personally, I feel that RPC/Literal and Document/Literal are just different ways of thinking about the request and response data being passe to, and received from, a web service. RPC/Literal seems, from all the examples and code I have seen, to be a special case of Document/Literal, following a certain pattern for creating request and response messages from the signature of the procedure/method that is to be invoked.
Perhaps this distinction made more sense when RPC/Encoded is taken into consideration, something that I will not do due to RPC/Encoded not being sanctioned by the WS-I Basic Profile.
Perhaps RPC/Literal is some kind of remains from the early days of web services, when, I imagine, people began with doing RPC invocations.
</IK:WARNING>
Best regards!
Mikhael Jenings
Greenhorn

Joined: Apr 14, 2009
Posts: 25
Thanks Ivan !!!

Helps while I get my head wrapped around this ;-)
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hello!
After having come to new insights, I feel I need to update my earlier reply, which was not entirely clear on this point:
One important difference between RPC and Document web services is that with RPC web services, XML schema will only be created for complex type parameters. It is thus not possible to validate the entire XML fragment contained in the SOAP body.
With Document web services, however, the XML schema needs to define the ENTIRE XML fragment contained in the SOAP body. Consequently, the entire message can be validated against the XML schema.
Best wishes!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between RPC and Document web-services ?
 
Similar Threads
Difference between rpc web service and document web service
RPC/literalor, Document/literal and WS-I Basic Profile
could anybody suggest me the major points
What's the difference between payload and message mode?
Difference between Message and RPC based Web Services ?