Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

WebServices - Passing the user defined object

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a webservice that exposes a method which takes an Object as a parameter. Hence, the client invoking this webservice can pass any type of object including user defined class objects.
e.g.: public String invokeMe(Ojbect obj);

From Client webservice: I am passing my user defined class object as a parameter to the exposed method.
Pitta obj = new Pitta(); // Pitta is the name of a class.
e.g.: String result = invokeMe(obj);

When invoked on stub from client side, it gives me the exception saying that 'Pitta' needs to have a deserializer.

I have even tried by extending 'Serializer' interface to class 'Pitta' but it was of no use. I understand that all the objects passed over the SOAP protocol need to be capapble of serializing and deserializing.

My Question: How do we pass the different objects over SOAP Protocol?

Thanks for your time.

Regards,
Pitta.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at this article (Using Complex Types in Web Services) by Balaji Loganathan explaining how to pass complex objects to webservice
 
Srinivas Pitta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JaiKiran,

Thanks for your reply. But my question was passing the complex object (user defined object) from Client Side when WebService exposes the method of OBJECT type as a parameter. I am getting exception while passing the user defined object (as mentioned in my previous posting).

Regards,
Pitta.
 
Srinivas Pitta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone please respond to my question below?

Regards,
Pitta.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks for your reply. But my question was passing the complex object (user defined object) from Client Side when WebService exposes the method of OBJECT type as a parameter.



Why would you expect this to work?

How can the web service possibly know in advance about all the possible user defined objects?

Bill
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Srinivas Pitta:
my question was passing the complex object (user defined object) from Client Side when WebService exposes the method of OBJECT type as a parameter.



I don't think this will work. Objects don't have deserializers, so you'd need to cast it into something that was known to support Serializable. And if you're going to do that, you might as well just declare your parameter as a Serializable (at the very least).

What exactly is it you're trying to do? Why would you want to accept unknown objects into your service?
 
Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic