[ http://issues.apache.org/jira/browse/AXIS-1955?page=comments#action_66427 ] Jayachandra Sekhara Rao Sunkara commented on AXIS-1955: -------------------------------------------------------
Thanks Clint, for pointing out this subtle but major issue. This didn't appear in the first go as a serious issue to me, but now I totally agree with you that a concrete class if it has field declaration as abstract class, then all the mapped types extending (i.e. deriving from) that abstract class should be written out in the wsdl, otherwise it's not quite possible to create a client request properly for an unaware remote user of that service. In one sense written out WSDL is no longer self descriptive. I've worked on this and came up with a patch. I've noticed that in the BeanSerializer.java code when writing out type information for fields, they are just being written out using the types.writeType() method this method doesn't have the necessary logic to write out subTypes of the type we are trying to write out. So I tried to use the types.writeTypeAndSubTypeForPart() method that has the required functionality. I've tried to see I don't disturb *any* other functionality of the class. I'll attach the patch as a diff > Axis 1.2rc3 does not write derived types from abstract classes to wsdl > ---------------------------------------------------------------------- > > Key: AXIS-1955 > URL: http://issues.apache.org/jira/browse/AXIS-1955 > Project: Axis > Type: Bug > Components: WSDL processing > Versions: 1.2RC3 > Environment: os: ms windows xp pro build 2600 with sp 2 > app server: resin 2.1.14 > ide: eclipse 3.1M6 (used to launch and debug the app) > hardware: p4 3GHz + 1.0 G ram and ample hd space > Reporter: clint dovholuk > Attachments: Patch_BeanSerializer.diff, test.jar > > After upgrading to Axis 1.2rc3 I noticed that the wsdl is no longer being > written properly when using derived types from abstract classes. > Test Case: (i hope you perserve spaces as this is indented properly when i > submit it) > create these files and compile them: > TestObj.java > package test; > public class TestObj { > public void testShapeHolder(ShapeHolder shapeHolder) { > System.err.println("SHAPE CLASS: " + shapeHolder.getClass()); > } > /* > this is commented out on purpose, you will remove it in the last > steps of the test case > public void testAbstractShape(AbstractShape shape) { > System.err.println("SHAPE CLASS: " + shape.getClass()); > } > */ > } > > ShapeTester.java > package test; > public class ShapeTester { > private AbstractShape shape; > public AbstractShape getShape () { return shape; } > //public void setShape (AbstractShape shape) { this.shape = shape; } > } > > AbstractShape.java > package test; > public abstract class AbstractShape {} > > Square.java > package test; > public class Square extends AbstractShape {} > > Circle.java > package test; > public class Circle extends AbstractShape {} > > Add this service to the server-config.wsdd > <service name="absTest" provider="java:RPC"> > <parameter name="allowedMethods" value="*" /> > <parameter name="className" value="test.TestObj" /> > <beanMapping qname="THENS:ShapeTester" > xmlns:THENS="myWebApp:ShapeTester" > languageSpecificType="java:test.ShapeTester"/> > <beanMapping qname="THENS:Square" xmlns:THENS="myWebApp:Square" > languageSpecificType="java:test.Square" /> > <beanMapping qname="THENS:Circle" xmlns:THENS="myWebApp:Circle" > languageSpecificType="java:test.Circle" /> > </service> > > > install axis 1.1 and get it running > > hit the wsdl and look at the wsdl:types, on my box it looks like: > <wsdl:types> > <schema targetNamespace="http://test" > xmlns="http://www.w3.org/2001/XMLSchema"> > <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> > <complexType abstract="true" name="AbstractShape"> > <sequence /> > </complexType> > </schema> > <schema targetNamespace="myWebApp:Circle" > xmlns="http://www.w3.org/2001/XMLSchema"> > <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> > <complexType name="Circle"> > <complexContent> > <extension base="tns2:AbstractShape"> > <sequence /> > </extension> > </complexContent> > </complexType> > </schema> > <schema targetNamespace="myWebApp:ShapeTester" > xmlns="http://www.w3.org/2001/XMLSchema"> > <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> > <complexType name="ShapeTester"> > <sequence> > <element name="shape" nillable="true" type="tns2:AbstractShape" /> > </sequence> > </complexType> > </schema> > <schema targetNamespace="myWebApp:Square" > xmlns="http://www.w3.org/2001/XMLSchema"> > <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> > <complexType name="Square"> > <complexContent> > <extension base="tns2:AbstractShape"> > <sequence /> > </extension> > </complexContent> > </complexType> > </schema> > </wsdl:types> > > replace axis libraries (I replaced axis.jar, saaj.jar, and wsdl.jar) with > corresponding axis 1.2rc3 jars > > hit the wsdl and look at the wsdl:types, i NOW get: (that can't be right, > is it?) > <wsdl:types> > <schema targetNamespace="http://test" > xmlns="http://www.w3.org/2001/XMLSchema"> > <import namespace="myWebApp:ShapeTester" /> > <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> > <complexType abstract="true" name="AbstractShape"> > <sequence /> > </complexType> > </schema> > <schema targetNamespace="myWebApp:ShapeTester" > xmlns="http://www.w3.org/2001/XMLSchema"> > <import namespace="http://test" /> > <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> > <complexType name="ShapeTester"> > <sequence> > <element name="shape" nillable="true" type="tns2:AbstractShape" /> > </sequence> > </complexType> > </schema> > </wsdl:types> > > uncomment the method in TestObj named testAbstractShape > > restart the application > > hit the wsdl. you now get the FULL wsdl written out including the types: > <wsdl:types> > <schema targetNamespace="http://test" > xmlns="http://www.w3.org/2001/XMLSchema"> > <import namespace="myWebApp:ShapeTester" /> > <import namespace="myWebApp:Circle" /> > <import namespace="myWebApp:Square" /> > <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> > <complexType abstract="true" name="AbstractShape"> > <sequence /> > </complexType> > </schema> > <schema targetNamespace="myWebApp:ShapeTester" > xmlns="http://www.w3.org/2001/XMLSchema"> > <import namespace="myWebApp:Circle" /> > <import namespace="http://test" /> > <import namespace="myWebApp:Square" /> > <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> > <complexType name="ShapeTester"> > <sequence> > <element name="shape" nillable="true" type="tns2:AbstractShape" /> > </sequence> > </complexType> > </schema> > <schema targetNamespace="myWebApp:Square" > xmlns="http://www.w3.org/2001/XMLSchema"> > <import namespace="myWebApp:ShapeTester" /> > <import namespace="myWebApp:Circle" /> > <import namespace="http://test" /> > <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> > <complexType name="Square"> > <complexContent> > <extension base="tns2:AbstractShape"> > <sequence /> > </extension> > </complexContent> > </complexType> > </schema> > <schema targetNamespace="myWebApp:Circle" > xmlns="http://www.w3.org/2001/XMLSchema"> > <import namespace="myWebApp:ShapeTester" /> > <import namespace="http://test" /> > <import namespace="myWebApp:Square" /> > <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> > <complexType name="Circle"> > <complexContent> > <extension base="tns2:AbstractShape"> > <sequence /> > </extension> > </complexContent> > </complexType> > </schema> > </wsdl:types> > -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
