axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Fox" <>
Subject Re: passing objects of subtypes
Date Mon, 26 Jun 2006 16:22:52 GMT
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

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.


<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:VehicleServices" xmlns:apachesoap="" xmlns:impl="urn:VehicleServices"
xmlns:intf="urn:VehicleServices" xmlns:wsdl=""
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
  <schema elementFormDefault="qualified"
targetNamespace="urn:VehicleServices" xmlns="">
   <element name="getVehicleColor">
      <element name="in0" type="impl:Vehicle"/>
   <complexType name="Vehicle">
     <element name="make" nillable="true" type="xsd:string"/>
     <element name="size" type="xsd:int"/>
   <element name="getVehicleColorResponse">
      <element name="getVehicleColorReturn" type="xsd:string"/>
   <complexType name="Truck">
     <extension base="impl:Vehicle">
       <element name="numTrailers" type="xsd:int"/>

   <wsdl:message name="getVehicleColorResponse">

      <wsdl:part element="impl:getVehicleColorResponse" name="parameters"/>


   <wsdl:message name="getVehicleColorRequest">

      <wsdl:part element="impl:getVehicleColor" name="parameters"/>


   <wsdl:portType name="VehicleLogic">

      <wsdl:operation name="getVehicleColor">

         <wsdl:input message="impl:getVehicleColorRequest"

         <wsdl:output message="impl:getVehicleColorResponse"



   <wsdl:binding name="VehicleServicesSoapBinding" type="impl:VehicleLogic">

      <wsdlsoap:binding style="document" transport=""/>

      <wsdl:operation name="getVehicleColor">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getVehicleColorRequest">

            <wsdlsoap:body use="literal"/>


         <wsdl:output name="getVehicleColorResponse">

            <wsdlsoap:body use="literal"/>




   <wsdl:service name="VehicleLogicService">

      <wsdl:port binding="impl:VehicleServicesSoapBinding"

         <wsdlsoap:address location="




View raw message