Thanks for the valuable help.
With that help to start me off, I managed to build a toy example using Vehicle with a subclass Truck, which adds a property
to Vehicle. Using --extraClasses on java2wsdl, I got Axis to de/serialize the runtime type correctly. (The WSDL is below.)
Anne, you said "I discourage you from substituting derived types in
SOAP messages." But the value of inheritance is unquestionable. To take a simple example, I might want a Service register_for_license(Vehicle), and a basic
Vehicle would have some properties; a Truck would have those properties, plus others that are also essential for registering it for a license.
Of course, the loosely coupled nature of the document-passing paradigm means that I can send whatever document I want, but my developmers need easy de/serialization between XML and software languages -- they don't want to do this manually.
Inheritance is such a widespread and useful tool (including in XSD!) that it seems clear that this should be standard, even across platforms.
Joshua
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:VehicleServices" xmlns:apachesoap="
http://xml.apache.org/xml-soap" xmlns:impl="urn:VehicleServices" xmlns:intf="urn:VehicleServices" xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/
" xmlns:xsd="http://www.w3.org/2001/XMLSchema
">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="urn:VehicleServices" xmlns="
http://www.w3.org/2001/XMLSchema">
<element name="getVehicleColor">
<complexType>
<sequence>
<element name="in0" type="impl:Vehicle"/>
</sequence>
</complexType>
</element>
<complexType name="Vehicle">
<sequence>
<element name="make" nillable="true" type="xsd:string"/>
<element name="size" type="xsd:int"/>
</sequence>
</complexType>
<element name="getVehicleColorResponse">
<complexType>
<sequence>
<element name="getVehicleColorReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
<complexType name="Truck">
<complexContent>
<extension base="impl:Vehicle">
<sequence>
<element name="numTrailers" type="xsd:int"/>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="getVehicleColorResponse">
<wsdl:part element="impl:getVehicleColorResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="getVehicleColorRequest">
<wsdl:part element="impl:getVehicleColor" name="parameters"/>
</wsdl:message>
<wsdl:portType name="VehicleLogic">
<wsdl:operation name="getVehicleColor">
<wsdl:input message="impl:getVehicleColorRequest" name="getVehicleColorRequest"/>
<wsdl:output message="impl:getVehicleColorResponse" name="getVehicleColorResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="VehicleServicesSoapBinding" type="impl:VehicleLogic">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http
"/>
<wsdl:operation name="getVehicleColor">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getVehicleColorRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getVehicleColorResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="VehicleLogicService">
<wsdl:port binding="impl:VehicleServicesSoapBinding" name="VehicleServices">
<wsdlsoap:address location="
http://localhost:8080/axis/services/VehicleServices"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
- Re: passing objects of subtypes Joshua Fox
- Re: passing objects of subtypes Martin Gainty
- Re: passing objects of subtypes Joshua Fox
- Re: passing objects of subtypes Xinjun Chen
- Re: passing objects of subtypes Xinjun Chen