PDA

View Full Version : WebServiceProxyFactory limits


Bruno Baia
10-29-2005, 04:08 PM
Hi,

i'm testing the WebServiceProxyFactory class.
It works fine with WebMethods using value types (int, string, etc...), but it fails with object types.

here is my service interface :

public interface ICustomerService
{
Customer[] GetCustomers();
}


an implementation :

public class CustomerService : ICustomerService
{
[WebMethod]
public Customer[] GetCustomers()
{
// ...
}
}


The VS Proxy generator will generate another Customer class for the client :

public class Customer
{
/// <remarks/>
public int ID;

/// <remarks/>
public string Name;
}


So the proxy class will not implement the interface and the WebServiceProxyFactory will launch an exception.
It can works if u remove the Customer implementation and add a reference to ur model namespace who contains Customer definition in the proxy generated class.

Aleks Seovic
10-31-2005, 07:08 PM
Hi Bruno,

As you noted at the end of your post, client-side interface and proxy implementation have to match, which means that you have two options:

1. Define your client-side interface in terms of WSDL-generated classes

2. Remove generated classes and change proxy code to use classes from your domain model.

For many reasons I strongly prefer option 2, but option 1 might be appropriate in some cases.

Hopfully we'll have your proxy generation code soon that will take care of this automatically so users don't have to deal with it :)

Later,

Aleks

Bruno Baia
10-31-2005, 08:10 PM
Yes, i'm on the option 2 for the new webservicefactory , it's the one which use the service interface.

For the option 1, VS generated proxy is enought.