views:

43

answers:

2

I've got webservice which has multiple classess

My winforms application see theirs, but not everyone.

This application has webreference to this webservice.

I think that this application see every class which is used in WebMethod, but I using parent class in WebMethod and I wanna casting it to another class,which is not used at webmethod.

+1  A: 

In the referencing application you don't "see" any of the classes of the webservice. There is a proxy-class generated for all classes used in webmethods. So in your client application you are not using the parent class, but a proxy of the parent class.

Try to:

  1. Put all data classes in a separate assembly, which you reference from the webservice and from the client.
  2. Build a method that (or get a solution that) copies every property of the proxy-class to the original.
  3. Then cast the original to the derived class.

There are existing solutions that copy proxies to the original-classes.

Hinek
A: 

I found simply solution:

http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlincludeattribute.aspx

It works !