Re: How to return a user-defined data type object from a webservice?
- From: "John Saunders [MVP]" <john.saunders at trizetto.com>
- Date: Wed, 5 Mar 2008 22:11:52 -0500
"Bradley Plett" <plettb@xxxxxxxxxxxxxxxx> wrote in message
news:p28us3pka1v47mj23pg8njg36ldsgok4va@xxxxxxxxxx
What John is saying is all true, but it's a bit of an ivory tower
approach. Sometimes we developers have to bend the rules because it's
the easiest way to get the job done!
Anyway, I'm guessing that you have shared code between your server and
your client (probably using the same class code, shared in VSS). If
that's the case, what you're up against is simply the fact that the
object coming from the server via the web service is in a different
namespace from the object you want to use in your client. There are a
variety of ways of getting around this problem. For example, you can
use reflection and generics to change the namespace of the object in
question. Here's a code sample that will simply copy everything from
one object to another, assuming all their public properties are
identical:
Sorry, Bradley, you're wrong. It's not that the classes are in different
namespaces. They're different classes that happen to have a lot of names in
common. Try returning a custom type that has a non-default constructor, or
methods, or indexers. None of them will show up in the proxy classes because
none of them are described by XML Schema or WSDL.
Remember: they're _proxy_ classes. They are stand-ins for the real classes,
which never leave the server to travel over the wire. They only exist in
order to stand as proxy for the real classes, handling serialization and
deserialization.
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer
.
- Follow-Ups:
- Re: How to return a user-defined data type object from a webservice?
- From: Bradley Plett
- Re: How to return a user-defined data type object from a webservice?
- References:
- Re: How to return a user-defined data type object from a webservice?
- From: John Saunders [MVP]
- Re: How to return a user-defined data type object from a webservice?
- From: nano2k
- Re: How to return a user-defined data type object from a webservice?
- From: nano2k
- Re: How to return a user-defined data type object from a webservice?
- From: John Saunders [MVP]
- Re: How to return a user-defined data type object from a webservice?
- From: nano2k
- Re: How to return a user-defined data type object from a webservice?
- From: John Saunders [MVP]
- Re: How to return a user-defined data type object from a webservice?
- From: nano2k
- Re: How to return a user-defined data type object from a webservice?
- From: Bradley Plett
- Re: How to return a user-defined data type object from a webservice?
- Prev by Date: Re: How to return a user-defined data type object from a webservice?
- Next by Date: RE: Progress bar for web service?
- Previous by thread: Re: How to return a user-defined data type object from a webservice?
- Next by thread: Re: How to return a user-defined data type object from a webservice?
- Index(es):
Relevant Pages
|
Loading