• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

RPC vs Document Style

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

What makes or Why RPC Style Webservice is tightly coupled and Document style webservice is loosely coupled. I fail to find the difference other than the format of the message being exchanged.

SOAP Body of RPC-style Web Service
<SOAP-ENV:Envelope...>   
   <SOAP-ENV:Body>
      <m:GetStockQuote xmlns:m="urn:xmethods:example">
         <Symbol>Foo</Symbol>
      </m:GetStockQuote>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


SOAP Body of Document-style Web Service
<SOAP-ENV:Envelope ...>   
   <SOAP-ENV:Body>
      <StockQuoteRequest symbol="FOO"/>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


(Message taken from the link http://www.oracle.com/technology/sample_code/tech/java/j2ee/jintdemo/tutorials/webservices.html ) , how does the difference in the message makes an impact to tightly coupled or loosely coupled ?

Thanks
plrkannan

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I assume they mean that with RPC there are a few constraints on the message structure, e.g. the root element is the operation name and etc. In doc/lit you have more freedom. But I agree the statement in the link is a little vague.
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
My guess is:
RPC is more tightly coupled, because if you make any changes in the message structure, then you need to change all clients and servers processing that kind of message.
If you use Document style, then you can send an XML document to the web service.
- If you need to add a new attribute or element to the XML document, you can make it optional to preserve compatibility with older clients.
- If you need to dramatically change the document accepted by the service, or add a new document type, you can introduce an XML document in a different namespace. The server can be implemented to inspect the namespace of the payload of an incoming request to determine how the request is to be processed.

However, if you use RPC and have an operation parameter of the type anyType, then you can also accomplish the same for RPC.
Best wishes!
 
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends..

I'm wondering about how to make a Document Style in JAX-WS..
i think the Document Style is good for implementation, isn't it?..
i think with RPC its difficult to implemented in the client side, because i've to change it also, if there's any webservice change in the server side..

please correct me if i'm wrong..

Thanks..
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
@Leonardo
As you say, Document style probably is more flexible, but the effort of implementing the web service and clients may be slightly larger.
The likeliness of change is a factor that one has to consider when choosing whether to use RPC or Document style web services. Personally, I would not use RPC for a service that is likely to change or need to be more flexible.

Web service and web service data design and versioning is a difficult and very interesting area!
Best wishes!
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ivan..

Please tell me how to configure JAX-WS Metro implementation for Document Style..
and How to make a client side of it?..
currently if i use Metro, i use only Port interface to get all the methods that i've created in the server..

Thanks in advance..
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Selecting RPC or Document style is done in the WSDL. See http://www.w3.org/TR/wsdl#_soap:binding for details!
Best wishes!
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ivan..

Thanks Ivan for your reply..
I really appreciate it..
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i've tried to implements Document Literal as follows :
assume that my implementation like this :


is this code true for make Document style?..

please correct me if i'm wrong...
Thanks in advance..
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

Leonardo Carreira wrote:
please correct me if i'm wrong...


There is no need, because you are correct!
You can verify yourself - deploy the web service and take a look at the generated WSDL!
My apologies not having thought of the Java-first way of configuring a web service to be Document/Literal - my head is too set on WSDL-first.
Best wishes!
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ivan..

Yes, actually i prefer to use approach Java First while make WebService..
Okay, Thanks Ivan for your help..
I appreciate it..
 
A wop bop a lu bob a womp bam boom. Tutti frutti ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic