This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Web Services and the fly likes Problem passing object parameter to Ws method (JAX-RS + JAXB) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Problem passing object parameter to Ws method (JAX-RS + JAXB)" Watch "Problem passing object parameter to Ws method (JAX-RS + JAXB)" New topic
Author

Problem passing object parameter to Ws method (JAX-RS + JAXB)

diego santos
Greenhorn

Joined: Nov 15, 2012
Posts: 1
Hi there.

I am using Jersey to develop a web service that will be used as a middleware between an application and a database.

I am having a lot of trouble with one of my first methods, I am trying to insert new data into the database, from the test application using a simple web form I´m collecting some data and in the end calling the post method and trying to pass all I get from the form to the web service. I can reach the method but I´m not getting exactly the data I had when I called the service from the client.

The test Application has 4 classes, and one of them is the root of the XML, I mean, it has an instance of the other 3 and all of the got the @XmlRootElement and @XmlElement annotations from JAXB.

Here is how I am calling the service:



The atdn object is the "root" class.

And here is the post method:



My problem is that when I call the getValue() on the atdn (line above) it returns an object with most of its parameter as null. Curiously, the attributes of one of the inner classes has its values but I cannot figure out why.

Before calling the service I used the Marshall method just to print the XML structure on console and it appears quite right, but for some reason it is not in the same way in the WS side.

What is the problem?

Althogh the classes have the JAXB annotations I am passing an instance of the root class to the method because the tutorial I was following uses this way, but it doesn´t have other objects inside just simple attributes, could it be the problem? And what if I need to call the service from a PHP page or a .Net client?

thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem passing object parameter to Ws method (JAX-RS + JAXB)
 
Similar Threads
Apache axis dateTime type problem
long post IBM.158
Difference between (Java to XML) binding and serialization, JAXB and XStream
JBoss-RESTEasy-Jackson problem
Difference between RPC and Document web-services ?