>I have a .net framework 2.0 client (Pocket PC) and a .net 2.0 webservice
>that
[quoted text clipped - 8 lines]
> the
> PocketPC and Webservice.
If it was identical, you wouldn't have received the InvaliCastException!
> I've verified the object is being returned to the
> PocketPC intact (debugging indicates all correct types exist and values
[quoted text clipped - 6 lines]
> compact
> framework?
It's not supported by web services at all!
Have you (or anyone else who's been asking the same question) ever seen an
example where this works? Where it's really the same class on both client
and server? You have not seen such a thing, because it doesn't exist.
There is a big, think, opaque wall between the client and the server. There
are only a few small openings in this wall. One set of openings is the
openings through which you actually send requests and receive the responses.
Another set is in the form of the WSDL describing the web service, and any
XML Schemas referenced by or contained in the WSDL. The WSDL and the schemas
represent the contract between the client and server. There is no other
contract, implied or explicit. This is by design.
Anything which cannot be "seen" through one of these small openings should
be ignored. You cannot, for instance, assume that a class called "Foo" on
the server bears any relationship to a class called "Foo" on the client. No
such relationship was "visible" through one of the openings. What was
visible is that (for instance), a given web service operation promised to
return a response matching the XML ComplexType called "Foo" in namespace
"urn:some.namespace". As long as the server sends you something that matches
that schema, it's kept its promise to you.
It did not promise you an instance of a class, so you shouldn't be surprised
not to receive one.
John
Jim S - 06 Sep 2006 18:16 GMT
Thanks John. I understand now that the object itself never crosses, nor are
they "the same". However, the ObjectA class on each side do contain the same
code (copy/paste) so shouldn't I be able to cast one to the other?
> >I have a .net framework 2.0 client (Pocket PC) and a .net 2.0 webservice
> >that
[quoted text clipped - 49 lines]
>
> John
John Saunders - 06 Sep 2006 18:20 GMT
> Thanks John. I understand now that the object itself never crosses, nor
> are
> they "the same". However, the ObjectA class on each side do contain the
> same
> code (copy/paste) so shouldn't I be able to cast one to the other?
No. They're not the same thing at all.
John
Jim S - 06 Sep 2006 18:40 GMT
How would you recommend solving the problem of moving a .net object between
systems via web services?
> > Thanks John. I understand now that the object itself never crosses, nor
> > are
[quoted text clipped - 5 lines]
>
> John
John Saunders - 06 Sep 2006 21:22 GMT
> How would you recommend solving the problem of moving a .net object
> between
> systems via web services?
If you have to move a .NET object between .NET systems, then you should use
.NET Remoting, not web services. .NET Remoting can be very simple to use,
and can also use SOAP over HTTP, helping remove issues with firewalls. It
can be much more powerful than web services, but it doesn't have to be - a
simple Remoting setup can be very simple and easy to maintain, and need not
require much study to use.
If you want platform independence, then you want Web Services, but Web
Services don't move objects - at best, they move XML. The XML may have come
from an object, and may happen to be destined to become an object again, but
it's safer to think of it in a totally abstract way - or to assume it will
be manipulated by a scripting language, shell script, or similar. Most shell
scripts don't know about objects, so when thinking about Web Services, don't
think about objects.
John
Jim S - 06 Sep 2006 21:29 GMT
Thanks John, I'll look into remoting.
> > How would you recommend solving the problem of moving a .net object
> > between
[quoted text clipped - 16 lines]
>
> John