You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2002/10/17 17:33:31 UTC

DO NOT REPLY [Bug 13737] New: - WSDL2Java creating invalid bean when using ref attribute

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13737>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13737

WSDL2Java creating invalid bean when using ref attribute

           Summary: WSDL2Java creating invalid bean when using ref attribute
           Product: Axis
           Version: 1.0
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: WSDL processing
        AssignedTo: axis-dev@xml.apache.org
        ReportedBy: mstiver@yahoo.com


Given the following schema fragment:

    <complexType name="MyMessage">
      <sequence>
         <element ref="foo:MyElement" />
         <element name="otherStuff" type="string" />
      </sequence>
   </complexType>

...where foo.xsd contains:

   <element name="MyElement" type="tns:MyElementType" />
   <complexType name="MyElementType">
      <all>
         <element name="a" type="string" />
         <element name="b" type="string" />
      </all>
   </complexType>

...WSDL2Java generates the MyMessage.java bean class as follows:

    ...etc...
    static {
        org.apache.axis.description.FieldDesc field = new 
org.apache.axis.description.ElementDesc();
        field.setFieldName("myElement");
        field.setXmlName(new javax.xml.namespace.QName
("http://foo.com", "MyElement"));
        field.setXmlType(new javax.xml.namespace.QName
("http://foo.com", "MyElement"));
        typeDesc.addFieldDesc(field);
   ...etc...

However, the XmlType should have been associated with "MyElementType" as is 
reflected in the server-config.wsdd file:

   ...etc...
   <typeMapping 
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" 
encodingStyle="" qname="ns6:MyElementType" 
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" 
type="java:com.foo.MyElementType" xmlns:ns6="http://foo.com"/>
   ...etc...

Since the MyMessage bean incorrectly maps MyElement to a non-existent type 
(i.e. MyElement), the axis engine uses a SimpleDeserializer, which throws an 
exception when it encounters the <a> sub-element in an incoming message.