This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
i am very new to webservice stuff and i have a question about the java data mapping of called webservices.
The situation is: i have a wsdl file which i imported in to eclipse and generate all artifacts which seems necessary, invoking the webservice works fine, no problem.
Based on the wsdl file eclipse generates the webservice data structure of course, which isn't very suitable for the client i think.
So i have on the one side the webservice, with the generated data structures, which get filled if i call the webservice. On the other side i have my hand written objects.
What is the best practice to map incoming webservice structures to a custome data structure? I expected something like in JPA (Annotation Based Mapping), or do you write some glue code to map the two structures "by hand"?
You can use Apache Axis2 to generate java classes(stubs) from a wsdl. This would be very simple and easy to understand if you're thinking of writing a client. Axis2 contains a tool called WSDL2JAVA which creates wsdl-mapped java classes (i.e. Stub).
Using this stub you can simply invoke service you want and then whatever response you get for that request, you can map that to bean you created.
Also this WSDL2JAVA tools provides various data binding option. Just visit "http://axis.apache.org/axis2/java/core/docs/quickstartguide.html" . It will give you basic idea of using wsdl2java tool and some more info.It contains very useful info.
In my opinion this is very simple and easiest approach if you have a wsdl ready.