Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing custom objects between webservices.

Status
Not open for further replies.

JustBarno

Programmer
Jun 21, 2004
46
0
0
US
I have two web services, one of them returns a custom object, the other has
the same object type as a parameter.

CustomObject = Webservice1.Function1(param1, param2, param3)
Webservice2.Function2(CustomObject)

The CustomObject is defined in a class library, and both web services
reference that library when typing the variable.

Even though the objects "should" be the same, I am getting a "can not
convert" error, and if I try to cast the object myself it says invalid cast.

Please Advice!
 
I ended up just changing the second web service to accept individual paramaters instead of the object. It appears that despite typing from the same class, each web service creates its own type in a seperate file and uses that.
 
I've never had much luck with passing custom objects around. What works for me is to create my own serialization routine in the custom object which converts it to a string (XML or otherwise). Since everything takes strings, it works.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top