How to generate proxy for a child class when my web service return a parent class?

Posted by Amir Borzoei on Stack Overflow See other posts from Stack Overflow or by Amir Borzoei
Published on 2010-03-29T07:51:55Z Indexed on 2010/03/29 7:53 UTC
Read the original article Hit count: 457

Filed under:
|
|

Hi *

I have a web method like this:

public class ParentClass{
    public String str1;
}
public class ChildClass : ParentClass{
    public String str2;
}

public class WebService{
    public ParentClass WebMethod(){
        return GetFirstChildClass();    //Return a child class
    }
}

When I generate proxy for this web service by Visual Studio, VS just generate proxy for ParentClass but I need ChildClass too. For workaround I add a dummy method to WebService that return ChildClass to generate proxy for ChildClass in client.

public class WebService{
    ...
    //This is a dummy method to generate proxy for ChildClass in client.
    public ChildClass DummyWebMethod(){
        return null;
    }
}

In addition I write web service in java (JAX-WS) and my client is a SilverLight Application. Is there a better solution for this problem?

tanx for your help ;)

© Stack Overflow or respective owner

Related posts about webservice

Related posts about jax-ws