This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
diego santos
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic