Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
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!
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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic