Search code examples
asp.net.netproxy-classes

How do I avoid web method parameters using proxy classes?


I have a serializable POCO called DataUnification.ClientData.ClientInfo in a .NET class library project A.

It's used in a parameter for a web service defined in project B:

public XmlDocument CreateNewClient(ClientInfo ci, string system)

I now wish to call this web method from project C and use the original DataUnification.ClientData.ClientInfo type in the parameter. However due to the generated proxy class it has now become a different type: WebServices.ClientDataUnification.DataUnificationWebService.ClientInfo.

As far as .NET is concerned these are not the same types.

How can I get around this?


Solution

  • My first suggestion would be to use hand-written proxies instead of generated proxies, so you have full control over which types are used.

    My second suggestion would be to use a tool like the Web Services Factory, which has an option to let you reuse existing classes when it generates code (if the classes are appropriate.)