File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between RPC and Document web-services ?

 
Mikhael Jenings
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2198
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2198
1
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ivan !!!

Helps while I get my head wrapped around this ;-)
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic