axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Levy" <>
Subject abstract types and substitution groups
Date Tue, 31 May 2005 23:28:57 GMT
Hi Developerinos,
I've got a problem which I thought was pretty obvious, but I've had to
work out a pretty backwards method to achieve my end, and figured there
must be an easier way.
I've got a Java class which will be the base for my WSDL file.
Generating the WSDL is giving me no problems, but I'm having a sticking
point with DTO's which are abstract. Say I've got an abstract class
called "AbstractCar" and then an implementation of that called
"BasicCar". In my method signatures for the exposed methods, I utilize
AbstractCar, staying away from whatever implementation is actually
passed over the wire.
The problem comes in when I wish to pass a BasicCar over the wire.
There are a few problems I've hit when trying to do this:
1.) The WSDL's type schema has no knowledge of BasicCar
2.) Any auto generated WSDD has no knowledge of type mappings for
3.) Any stubs generated from the WSDL have no knowledge of BasicCar,
but will try and generate stubs for AbstractCar only.
Doing some research, I was impressed to find that XML Schema lets us
model extentions similar to the OOP world via "substitutionGroups".
Further, it also lets us declare an abstract XML type abstract. Thinking
about this, maybe it would be possible to add some new functionality to
the Java2WSDL generator which:
1.) Declares an abstract java class as abstract in the WSDL
2.) Takes in new parameters so implementations can be listed for
particular classes. Looking at the Ant method signature, it could be
something like:

<axis-java2wsdl classname="${ws.interface.class}"
<!-- this first example would seek out anything which
extends AbstractCar on the classpath -->
 <impl-hint base="AbstractCar" seek="all"/>
<!-- or -->
<!-- this second example would be more targeted and
only add "BasicCar -->
<impl-hint base="AbstractCar">
  <impl name="BasicCar"/>

The output for this in the resulting WSDL would be something like
<element name="abstractCar" type="tns1:AbstractCar" abstract="true"/>
<element name="basicCar" type="tns1:BasicCar"

In order to currently get this functionality, I have to do a pretty
awful combination manual tweeking and auto generation so thought if
anyone has come up against this and knows a relatively easy way to get
this working, please, don't hold back.

Thanks for your time.

David Levy

View raw message