• Post Reply Bookmark Topic Watch Topic
  • New Topic

returning the class object from the webservice

 
Niteen Patil
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

Is there any way through which I can return a object of a class from the webservice method?
Thanks in advance.
 
Srikanth Kumar
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even if you return the class object from the web service, at the time we generate the client the class "Class" is generated again by axis which is not compatible to java.lang.Class class.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
When using web services, you cannot pass objects from the service to clients or in the other direction.
Think of it as passing a representation of some data from client or server to the other party. Data to be sent is "translated" (marshalled) to XML (or some other representation format, like JSON). Marshalling involves querying one or more objects of their state and generating a representation.
When arriving at the recipient, the representation is "translated" (unmarshalled) back to data. Unmarshalling involves creation of new objects and setting their state according to the representation.
Best wishes!
 
Aneesh Vijendran
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

What you need to do is unmarshall and xml document to a java class.

You can use Jaxb or Castor api (castor.org)

Cheers
Aneesh
 
Niteen Patil
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!