all groups > dotnet web services > february 2007 >
You're in the

dotnet web services

group:

Sharing web-service class between two local assemblies


Sharing web-service class between two local assemblies Josh
2/23/2007 9:05:39 AM
dotnet web services:
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
Re: Sharing web-service class between two local assemblies John Saunders
2/23/2007 1:27:58 PM
[quoted text, click to view]

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

Re: Sharing web-service class between two local assemblies Joseph Geretz
2/23/2007 3:41:51 PM
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 -

[quoted text, click to view]

Re: Sharing web-service class between two local assemblies John Saunders
2/23/2007 8:40:38 PM
[quoted text, click to view]

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

AddThis Social Bookmark Button