Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Spring in Action (5th edition) this week in the Spring 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

returning the class object from the webservice  RSS feed

 
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.
 
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.
 
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!
 
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!