0

I have (to make things easy) 2 classes 1) abstract class A 2) inherited class B from A.

now i'm using a method "callMethod(A argument)" which is exposing my abstract class in the wsdl.

But the problem is that on the client side i want to be able to know if A is B or something else. And i want to be able to reach the Class B which is not available since it's not in wsdl.

I've tried KnownTypeAttribute and ServiceKnownTypeAttribute, but i'm not being able to getting it to work.

Now of course i can create a dummy method that uses a parameter of type B, and thus resulting in class B being exposed in WSDL, but that's unprofessional.

Any idea? Thanks a lot

LolaRun
  • 5,526
  • 6
  • 33
  • 45

1 Answers1

0

I've faced the same problem, and the only thing I found was to have a method that exposed the type (albeit I needed one in the long run).

The problem is that the wsdl has to contain the type in order that the properties of B are known on client side, otherwise you cannot ever use B client side. The wsdl for B will include the fact that it inherits A.

In otherwords on client side your object really is a A - as only public properties are serialized there's no difference between an A or a B if the webmethod passes an A.

Jon Egerton
  • 40,401
  • 11
  • 97
  • 129
  • Thanks for your reply, and concerning 'my object is really A' on client side, not accurate, because my "B" has public methods that A doesn't have. – LolaRun Jan 27 '11 at 16:10
  • That would only be the case where the B class has its full type def available on client side (is this the case?). If its passed from the WSDL then methods are not described, only public properties. – Jon Egerton Jan 27 '11 at 17:39
  • B is not available on the client side at all. And that's what i want to do. – LolaRun Jan 28 '11 at 08:20