Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

How to work with Complex Type Data in JAX WS

 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have deployed a Web service developed using JAXWS in Glass Fish v3 .

My service accepts a String and returns a double[] .

I am able to work with the above mentioned operation (Writtena client for my wsdl and passed a String and got back a double[])

Now my question is , i want to pass a DTO Object to my web service method , please guide me what are the things i need to take care ??

Thanks in advnace .

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure I follow. You have created a web service e.g. using annotations? Create the class you want and declare it as a parameter in your web service. Then use the wsgen tool to generate the wsdl and the required artifacts.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am concerned about jaxrpc-mapping.xml file where all Java to WSDL mappings will be mentioned . Any idea Jim ??
 
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not very clear, bug here is a suggestion. If you are using code-first approach, then just declare the method as you dish, and use the Pptoktiate tools go generate the WSDL and other artifacts.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
by reading your information, if you are following code first approch, jax-ws supports complex data type and you can use collection class there. you also need to use annotation to define them.

By sugession is keep your DTO objects aside and create "beans" which will input/output of your message/method that way you will be able to split the layers. and have some code to map these dto to beans and viseversa. Having the beans will help you creating versions also.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Karim for the reply ,



can you please as what are the annotations are there to define on Collection classes ??


and have some code to map these dto to beans and viseversa.



I assume that Bean and DTO are same , please tell me what is the difference between them ??

Thanks in advance .
 
Karim Gunjarge
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I refere annotation like : this will help not to create xml tag when there is no values/empty. When you use Collection class, you dont need to have setter method insead you getter to get collection object and add values to that. but for that you need initialize collection object at declaration. see below code.

@XmlElement(required = false, nillable = true)
private List<Integer> myInteger = new ArrayList<Integer>();


When you say DTO i was Considering as Data Transfer Objects. and i was thinking to have Seperate Beans and these dto will b used to transfer beans values to controller.

hope this information will help you.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic