Re: How to return a user-defined data type object from a webservice?
- From: Bradley Plett <plettb@xxxxxxxxxxxxxxxx>
- Date: Thu, 06 Mar 2008 00:17:58 -0700
Yes, I understand that they're different classes and different
objects. That is, after all, the implication of different namespaces.
I also understand that there can be issues around the constructor and
any hidden data, but pragmatically the solution I suggested will
handle the majority of the situations common programmers deal with
between server-side and client-side objects. :-)
Sure, remoting might be a preferable solution to maintain the full,
true object, but sometimes remoting is overkill and I think sometimes
we tend to over-think/over-analyze and ignore simple solutions which
may be less elegant and less pure, but do the job.
Brad.
On Wed, 5 Mar 2008 22:11:52 -0500, "John Saunders [MVP]"
<john.saunders at trizetto.com> wrote:
"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.
- Follow-Ups:
- Re: How to return a user-defined data type object from a webservice?
- From: Relaxin
- 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?
- 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?
- From: John Saunders [MVP]
- Re: How to return a user-defined data type object from a webservice?
- Prev by Date: RE: Progress bar for web service?
- 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