Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / February 2007

Tip: Looking for answers? Try searching our database.

Sharing web-service class between two local assemblies

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Josh - 23 Feb 2007 17:05 GMT
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
John Saunders - 23 Feb 2007 18:27 GMT
>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
Joseph Geretz - 23 Feb 2007 20:41 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.