aspose file tools*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes How could there be multiple wsdl:message parts for a response? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "How could there be multiple wsdl:message parts for a response?" Watch "How could there be multiple wsdl:message parts for a response?" New topic
Author

How could there be multiple wsdl:message parts for a response?

Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 519
    
    2

Hi All,

I saw several WSDLs where there were more than one part defined for response under wsdl:message. Eg is given below taken from specification.



I understand that having multiple parts for input is quite common as we may pass on several method arguments and I can think of each argument as one part defined. But a method call can return only one object (or primitives). Atleast I have not encountered any occasion where multiple items can be returned in java (not sure about other languages). Then how does it map to the output message defined like above.

Also under section of 2.4.6 Parameter Order within an Operation in the above specification

The part name order reflects the order of the parameters in the RPC signature
The return value part is not present in the list
If a part name appears in both the input and output message, it is an in/out parameter
If a part name appears in only the input message, it is an in parameter
If a part name appears in only the output message, it is an out parameter

Can somebody explain me this mapping this to a small java based SEI ?

Regards
KumarRaja

Hany Shafik
Ranch Hand

Joined: Jun 21, 2008
Posts: 80
Hi Kumar,

The style you are discussing is called RPC messaging style (opposed to Document style). In RPC messaging style, one can have more than one part in the request and more than one part in the output. In JAX-WS and it's predecessor JAX-RPC, the javax.xml.ws.Holder class are used to map out and in/out parameters to method parameters. This is a generic class that can hold any Java class as it's value.
Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 519
    
    2

Hany Shafik wrote:Hi Kumar,

The style you are discussing is called RPC messaging style (opposed to Document style). In RPC messaging style, one can have more than one part in the request and more than one part in the output. In JAX-WS and it's predecessor JAX-RPC, the javax.xml.ws.Holder class are used to map out and in/out parameters to method parameters. This is a generic class that can hold any Java class as it's value.


Ok, let me try to put this with an eg

say my method is defined as public Object method(Object o, Object b);

I can map this above method in WSDL using two message elements, request and response. Out of these the request has two parts and response has one part. So my argument is, the response element can not have more than one part at any point of time.But if not, then an example would be appreciated.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
First of all, have you seen the following from the WSDL 1.1 specification (section 2.6.4)?
http://www.w3.org/TR/wsdl#_parameter
In order to see what kind of Java code such constructs (in/out and out parameters) result in, I would recommend you to create a WSDL that contains operations that have such parameters.
Then you process the WSDL with wsimport and take a look at the generated code.
As Hany Shafik has already answered, the code will use the Holder class.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1180
Kumar,

Let's please keep in mind that WSDL was not designed just for Java. It's interesting to see the IN OUT implementation in ... PL/SQL for example, where the IN OUT design is very explicit - How to pass parameters to Procedures and Functions in PL/SQL ?

Regards,
Dan

William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Ravi C Kota
Ranch Hand

Joined: Jan 29, 2008
Posts: 61
Thanks Dan.

I'm struggling a bit to get these concepts straightened out... But I hope to get into a decent shape soon


Thanks & Regards, Ravi C.Kota
SCJP 5.0, OCDJWS 5.0
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How could there be multiple wsdl:message parts for a response?