I have application1 that connects to webService1. I have a second
application that references the same webservice (webService1). I need
to pass an instance of a class returned from webService1 from
application1 to application2. I have a reference (assembly.load) of
application2 in application1, but when it won't let me cast it -
saying they're different types. What are my options?
Thanks in advance,
Joshua Moore
>I have application1 that connects to webService1. I have a second
> application that references the same webservice (webService1). I need
> to pass an instance of a class returned from webService1 from
> application1 to application2. I have a reference (assembly.load) of
> application2 in application1, but when it won't let me cast it -
> saying they're different types. What are my options?
They are different types. They are unrelated to each other. That's how it's
supposed to be.
webService1 did not return an instance of a class. It returned some XML
which was later deserialized into a class instance.
John
Try this.
Create a library which contains your class definition. The class must be
serializable. All three projects should reference this library. The Web
Service should send back an instance of your class definition. This class
should then be transportable between application1 and application2. This
should work, since all three applications are using the same definition of
the class.
Haven't had time to test this out specifically, but I think this should
work. Let me know if I'm wrong about this.
Hope this helps.
- Joseph Geretz -
>I have application1 that connects to webService1. I have a second
> application that references the same webservice (webService1). I need
[quoted text clipped - 5 lines]
> Thanks in advance,
> Joshua Moore
John Saunders - 24 Feb 2007 01:40 GMT
> Try this.
>
[quoted text clipped - 7 lines]
> Haven't had time to test this out specifically, but I think this should
> work. Let me know if I'm wrong about this.
Joseph, this doesn't work at all.
The Web Services platform erects a "chinese wall" between the client and the
server. The client is NOT using the classes exposed by the server. A .NET
client will be using proxy classes created by .NET. These proxy classes will
be unrelated to the original classes exposed by the server.
This becomes obvious when the exposed classes contain methods which are not
[WebMethod]s. Those methods are not part of the interface that the client
sees, even if they are public. Neither will the client see any constructors
other than a default constructor, nor will it see indexers, events, etc.
These things are not part of the Web Services Platform.
John