• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Method identification in Document Style Web Service

 
Venkatesh Rangamani
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..,

In Case of Document Style webservice we dont pass the method name to be invoked in the SOAP request.If i have two methods in a webservice how does the server decides which method to call based on the SOAP request.

Thanks
Venkat
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In document oriented web services the type of document determines the method of processing. In some cases the service inspects the contents of the document before it decides what to do with it. This is why document oriented web services are more loosely coupled than RPC-style web services - the service inherently knows what to do with the document. There is no need for the client to identify a method.

Someone may suggest using the document/literal wrapped pattern - the document is placed in a wrapper and the wrapper identifies the method (Create Wrapped Document-Literal WSDL in WebSphere Studio Application Developer).

However that pattern is more appropriate when you need to submit multiple documents at once. The fact that you want to specify the method indicates that you want to superimpose RPC semantics on a document oriented web service which could be a sign of a flawed (document oriented) web service interface.

Document/literal is used in a document oriented web service - but it doesn't create a document oriented web service.

Patterns and Strategies for Building Document-Based Web Services
[ July 12, 2007: Message edited by: Peer Reynders ]
 
Venkatesh Rangamani
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peer,
I am still not getting the point . Let me put it this way:
I have a Doc/Literal web service with two methods and both the methods take the same argument data type. In the sense both the method takes an argument that complies to a single schema. So the SOAP request will be the same for both the methods.As the body element of SOAP complies to a single schema. So how does the server at the receiving end identifies which web service method to call? Hope i am clear!!

Thanks
Venkat
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Venkatesh Rangamani:
I have a Doc/Literal web service with two methods and both the methods take the same argument data type.


Exactly. This situation arises because your web service is RPC by design. Doc/Literal is for Document-Oriented web services where the 'Method' is either implied by the type of the document itself or by the content of the document (i.e. the service can inspect it and then decide what to do with).

Example: An RPC design may require two methods for a Purchase Order (PO), new(PO) and revise(PO). A document oriented web service would simply accept the PO - if it carries a known identifier the PO is sent to the revision process - if the identifier is new it is sent to the new PO process.

So if you are creating an RPC web service then use RPC/literal. If you are creating a document based Web service then use Document/literal.

There is one work around, the 'wrapped document pattern' that lets you do RPC things with the document/literal style - from a design perspective this is a bad idea. Essentially you define a different envelope document for each method that you wish to express and then you stuff your document into these envelopes.

So rather than simply handing your PO to the clerk (who doesn't want to bother with figuring out whether this pertains to an already existing PO) for processing, you are now required to put new POs in a blue envelope, while revised POs go into a yellow envelope ....
 
Venkatesh Rangamani
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peer,
I understand what you are trying to say!! you are trying to say from a design perspective. But what my doubt is, assuming that i have two such methods how does the server identifies which method to call based on the SOAP message.

Thanks
Venkat
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Document/literal doesn't have a method because of the way document oriented web services operate.
Hence the "Wrapped Document Pattern" workaround for RPC type interactions.
See Which style of WSDL should I use?.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic