Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Nitin Bhardwaj
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Nitin Bhardwaj,

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

Thanks.

Wap Rau
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Wap Rau
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this in your code
@SOAPBinding
(
style = SOAPBinding.Style.DOCUMENT,
use = SOAPBinding.Use.LITERAL,
parameterStyle = SOAPBinding.ParameterStyle.WRAPPED
)
 
Wap Rau
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic