You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by John Cowan <jc...@rainfinity.com> on 2000/11/27 18:59:12 UTC

Polymorphic SOAP calls ?

Dear all,
I want to be able to pass instances of derived classes
to remote methods. The server has a method that is specified
in terms of a base class. I want the client to be able to pass
in an instance of a class A, and for the server to create a
correct instance of the derived class.

When I try to invoke this remote method using SOAP, by
passing in an instance of A, the server creates an
instance of the base class instead, not one of the derived
class that is passed in.

I've stuck a basic skeleton example of the code below.
I'm using Apache's 2.0 implementation of SOAP.

How do I fix this? Any clues?

John.

-----

eg.
class Base {
...
}

class A extends Base {
...
}

class B extends Base {
...
}

// then:

class Server {
  public void doIt (Base b) {
  // do something polymorphically here...
  ...
  }
}