2

I'm trying to return a class Foo, which is located in solution A

public class Foo {
    // some data
}

from a webservice in solution B

[WebMethod]
public Foo Test() {
    return new Foo();
}

which is called from solution C.

The problem is that the type of the web method returns type B.Foo instead of Foo, which cannot be converted to type Foo.

Probably it is possible to serialize the object, and then deserialize it but it is kinda messy. Is there a way to just do it objectwise?

4
  • 3
    Is it possible for you to use WCF instead of the ancient .asmx web services? Because DataContracts will do exactly what you want. Commented Feb 16, 2016 at 14:22
  • Possible duplicate of : stackoverflow.com/questions/17147702/… Related: stackoverflow.com/questions/1599063/… Commented Feb 16, 2016 at 14:33
  • @Mark Thank you, WCF solved my problem, could you please post it as an answer so I can accept it? Commented Feb 16, 2016 at 16:10
  • @Aleksandar Done, thank you :) Commented Feb 16, 2016 at 16:38

1 Answer 1

2

Is it possible for you to use WCF instead of the ancient .asmx web services? Because DataContracts will do exactly what you want.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.