views:

220

answers:

2

I have a .NET WCF service which exposes an object that uses polymorphism.

Apparantly, Websphere Integration Developer is unable to handle this properly (I am not the Websphere developer), except by adding all fields of all possible polymorphisms and using a enum or such to say that it is an object of such and such type.

I can't possibly believe that IBM has created a product that doesn't support polymorphism! so.. Can anyone explain how to handle this, or point to resources which I can pass on?

+1  A: 

This may not be the problem, but you should be aware that web services, in general, do not support virtual methods. As such, they don't really support polymorphism.

In fact, web services are not object oriented at all. They're all about XML, which is not object oriented. Any resemblance to classes with methods and properties is a figment of the imagination of your tools - specifically the tools that produce your proxy classes look at the (XML) description of the web service and produce classes that are more or less like what is described.

Sometimes more, and sometimes less.

John Saunders
Agreed. But inheritance hierarchies can be modeled with complex types and complexContent/extension in an interoperable manner.
Rune Sundling
@Rune: True. I read the question as being about OO-style polymorphism, not about "data polymorphism".
John Saunders
I understand why, could have been more clear.
Rune Sundling
A: 

The problem is that your client only knows about your service via the contract or wsdl.

The wsdl just defines the inputs and outputs of the methods in your contract (as well as the data contracts used by those methods) - it doesn't expose any of the base classes, etc of the service class (or any of the data contracts) your client will be calling.

It's not that WebSphere can't handle polymorphism - it's more that the wsdl can't express it the way you might expect.

Terry Donaghe