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 "Gregory M. Baumgardner (JIRA)" <ax...@ws.apache.org> on 2005/08/23 20:10:09 UTC

[jira] Commented: (AXIS-1797) Base attributes not serialized when simpleContent extends another simpleContent

    [ http://issues.apache.org/jira/browse/AXIS-1797?page=comments#action_12319766 ] 

Gregory M. Baumgardner commented on AXIS-1797:
----------------------------------------------

Note that this patch only fixes the attribute serialization problem for extensions of complex types with simple content, like in your example.  The same problem still occurs for extensions of complex types that have complex content.  It also breaks the sequencing of the elements in the complex content.  See AXIS-2099 for an example of that problem.  A similar patch for SchemaUtils.getContainedElementDeclarations around line 274 beginning in:

            if (complexContent != null) {

I am by no means an expert in the Axis code, so I am not a good one to try this.

Here is a modification to your example WSDL:

<?xml version="1.0" encoding="utf-8" ?>

<definitions targetNamespace="urn:auth:epok:com"
       xmlns:tns="urn:auth:epok:com"
       xmlns:xs="http://www.w3.org/2001/XMLSchema"
       xmlns="http://schemas.xmlsoap.org/wsdl/">

  <types>
    <xs:schema targetNamespace="urn:auth:epok:com">

      <xs:complexType name="NameIdentifierType">
        <xs:simpleContent>
          <xs:extension base="xs:string">
            <xs:attribute name="a" type="xs:string" use="optional"/>
            <xs:attribute name="b" type="xs:string" use="optional"/>
          </xs:extension>
        </xs:simpleContent>
      </xs:complexType>

      <xs:complexType name="EncryptableNameIdentifierType">
        <xs:simpleContent>
	  <xs:extension base="tns:NameIdentifierType">
	    <xs:attribute name="c" type="xs:string"/>
	    <xs:attribute name="d" type="xs:string"/>
	  </xs:extension>
        </xs:simpleContent>
      </xs:complexType>

    </xs:schema>
  </types>

</definitions>

>From NameIdentifierType.java:

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:auth:epok:com", "NameIdentifierType"));
        org.apache.axis.description.AttributeDesc attrField = new org.apache.axis.description.AttributeDesc();
        attrField.setFieldName("a");
        attrField.setXmlName(new javax.xml.namespace.QName("", "a"));
        attrField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        typeDesc.addFieldDesc(attrField);
        attrField = new org.apache.axis.description.AttributeDesc();
        attrField.setFieldName("b");
        attrField.setXmlName(new javax.xml.namespace.QName("", "b"));
        attrField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        typeDesc.addFieldDesc(attrField);
        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("test");
        elemField.setXmlName(new javax.xml.namespace.QName("", "test"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
    }

>From EncryptableNameIdentifierType.java:

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:auth:epok:com", "EncryptableNameIdentifierType"));
        org.apache.axis.description.AttributeDesc attrField = new org.apache.axis.description.AttributeDesc();
        attrField.setFieldName("c");
        attrField.setXmlName(new javax.xml.namespace.QName("", "c"));
        attrField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        typeDesc.addFieldDesc(attrField);
        attrField = new org.apache.axis.description.AttributeDesc();
        attrField.setFieldName("d");
        attrField.setXmlName(new javax.xml.namespace.QName("", "d"));
        attrField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        typeDesc.addFieldDesc(attrField);
    }

Note that "a", "b" and "test" are all missing.  The attributes "a" and "b", if used, will be serialized as elements.

> Base attributes not serialized when simpleContent extends another simpleContent
> -------------------------------------------------------------------------------
>
>          Key: AXIS-1797
>          URL: http://issues.apache.org/jira/browse/AXIS-1797
>      Project: Apache Axis
>         Type: Bug
>   Components: WSDL processing
>     Versions: current (nightly)
>     Reporter: Steve Green
>  Attachments: 1797.patch, 1797.test.tar, 1797.wsdl, PostTest.java, Test.java
>
> When a simpleContent extends another simpleContent, and the base type has attributes, those attributes are not serialized.
> I believe that the problem is with the code generation, and not a serialization bug.  The code generator uses a has-a model for this, and I believe that it should be an is-a model.  This is also necessary to allow for polymorphic behavior in the generated classes.

-- 
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