aspose file tools*
The moose likes Web Services and the fly likes Returning an Array of user -defined objects from a JAX-WS Webservice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Returning an Array of user -defined objects from a JAX-WS Webservice" Watch "Returning an Array of user -defined objects from a JAX-WS Webservice" New topic
Author

Returning an Array of user -defined objects from a JAX-WS Webservice

Nitin Bhardwaj
Ranch Hand

Joined: Feb 02, 2007
Posts: 72

Hi Friends,
I am new to webservices. I've made a really simple WebService. I deploy it to the JBoss 5 AS and JBoss automatically generates the WSDL for it. I use SAAJ API to pass the SOAP Request Message(using an xml file) to this webservice and then I get the response. I am going to provide each of the resources below:
1. Webservice Code:


2. WSDL Generated when I deployed above webservice on JBoss AS:



3. The SAAJ Client Code that I am using:


4. The SOAP Request message (or the content of soapRequest.xml) that the above SAAJ Client Code is sending to Webservice:


5. The Response that the SAAJ Client Code gets from the Webservice:



My Question: The Response that we got from the webservice has a tag <item> under <companies> tag. I want that it should be named as <company>, and not <item>. I believe there should be an annotation for doing this which I may have to apply to the WebMethod in the Webservice code which I've listed.
Request you to let me know what should I do in order to get this done without changing the WSDL manually.

Best Regards,
Nitin


Wap Rau
Greenhorn

Joined: Dec 01, 2011
Posts: 11
Hello Nitin Bhardwaj,

Have you ever been able to get <item> named as <company>? If yes, how?

Thanks.

Wap Rau
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
I think that the reason for the element in question being named <item> may be related to the fact that you use RPC binding.
Have you tried using DOCUMENT style binding?
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
Wap Rau
Greenhorn

Joined: Dec 01, 2011
Posts: 11
Ivan Krizsan wrote:Hi!
I think that the reason for the element in question being named <item> may be related to the fact that you use RPC binding.
Have you tried using DOCUMENT style binding?
Best wishes!


Thanks Ivan Krizsan, for your reply. I am very new to Web Services. Could you provide me with links to the resources for such DOCUMENT style binding?

Thanks again,

Wap Rau
Arun Kumar
Ranch Hand

Joined: Oct 10, 2007
Posts: 30
Try this in your code
@SOAPBinding
(
style = SOAPBinding.Style.DOCUMENT,
use = SOAPBinding.Use.LITERAL,
parameterStyle = SOAPBinding.ParameterStyle.WRAPPED
)
Wap Rau
Greenhorn

Joined: Dec 01, 2011
Posts: 11
Arun Kumar wrote:Try this in your code
@SOAPBinding
(
style = SOAPBinding.Style.DOCUMENT,
use = SOAPBinding.Use.LITERAL,
parameterStyle = SOAPBinding.ParameterStyle.WRAPPED
)


Thanks Arun Kumar for your reply. I will try your solution. Thanks again for responding.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Returning an Array of user -defined objects from a JAX-WS Webservice