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 "Steve Green (JIRA)" <ax...@ws.apache.org> on 2005/02/01 22:47:17 UTC

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

Base attributes not serialized when simpleContent extends another simpleContent
-------------------------------------------------------------------------------

         Key: AXIS-1797
         URL: http://issues.apache.org/jira/browse/AXIS-1797
     Project: Axis
        Type: Bug
  Components: WSDL processing  
    Versions: current (nightly)    
    Reporter: Steve Green


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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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

Posted by "Gregory M. Baumgardner (JIRA)" <ax...@ws.apache.org>.
    [ 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


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

Posted by "Steve Green (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-1797?page=comments#action_66610 ]
     
Steve Green commented on AXIS-1797:
-----------------------------------

Jayachandra,

The Test.java program is a demonstration of what is not working with unpatched axis.  Because the patch changes simple type extension from a "has-a" relationship to an "is-a" relationship, the same test program cannot be used to demonstrate proper behaviour.  I will attach another test program to be used after the patch is applied.

> Base attributes not serialized when simpleContent extends another simpleContent
> -------------------------------------------------------------------------------
>
>          Key: AXIS-1797
>          URL: http://issues.apache.org/jira/browse/AXIS-1797
>      Project: 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


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

Posted by "Gregory M. Baumgardner (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-1797?page=comments#action_12319768 ] 

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

Ooops.  I did not copy the correct WSDL.  It is this one:

<?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:sequence>
      <xs:element name="test" type="xs:string"/>
    </xs:sequence>
    <xs:attribute name="a" type="xs:string" use="optional"/>
    <xs:attribute name="b" type="xs:string" use="optional"/>
  </xs:complexType>

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

    </xs:schema>
  </types>

</definitions>

> 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


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

Posted by "Steve Green (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-1797?page=history ]

Steve Green updated AXIS-1797:
------------------------------

    Attachment: Test.java

This test program show the problem in action.  Note that the attributes called 'a' and 'b' are not displayed.  Also note that EncryptableNameIdentifierType does not extend NameIdentifierType thus making it impossible to use these types polymorphically.

> Base attributes not serialized when simpleContent extends another simpleContent
> -------------------------------------------------------------------------------
>
>          Key: AXIS-1797
>          URL: http://issues.apache.org/jira/browse/AXIS-1797
>      Project: Axis
>         Type: Bug
>   Components: WSDL processing
>     Versions: current (nightly)
>     Reporter: Steve Green
>  Attachments: 1797.wsdl, 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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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

Posted by "Steve Green (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-1797?page=all ]

Steve Green updated AXIS-1797:
------------------------------

    Attachment: PostTest.java

Use this test program to see the proper behavior.

> Base attributes not serialized when simpleContent extends another simpleContent
> -------------------------------------------------------------------------------
>
>          Key: AXIS-1797
>          URL: http://issues.apache.org/jira/browse/AXIS-1797
>      Project: 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


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

Posted by "Steve Green (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-1797?page=all ]

Steve Green updated AXIS-1797:
------------------------------

    Attachment: 1797.patch

Attached is a patch to fix the problem

> Base attributes not serialized when simpleContent extends another simpleContent
> -------------------------------------------------------------------------------
>
>          Key: AXIS-1797
>          URL: http://issues.apache.org/jira/browse/AXIS-1797
>      Project: Axis
>         Type: Bug
>   Components: WSDL processing
>     Versions: current (nightly)
>     Reporter: Steve Green
>  Attachments: 1797.patch, 1797.test.tar, 1797.wsdl, 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


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

Posted by "Steve Green (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-1797?page=all ]

Steve Green updated AXIS-1797:
------------------------------

    Attachment: 1797.test.tar

Attached is a test case

> Base attributes not serialized when simpleContent extends another simpleContent
> -------------------------------------------------------------------------------
>
>          Key: AXIS-1797
>          URL: http://issues.apache.org/jira/browse/AXIS-1797
>      Project: Axis
>         Type: Bug
>   Components: WSDL processing
>     Versions: current (nightly)
>     Reporter: Steve Green
>  Attachments: 1797.patch, 1797.test.tar, 1797.wsdl, 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


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

Posted by "Steve Green (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-1797?page=history ]

Steve Green updated AXIS-1797:
------------------------------

    Attachment: 1797.wsdl

> Base attributes not serialized when simpleContent extends another simpleContent
> -------------------------------------------------------------------------------
>
>          Key: AXIS-1797
>          URL: http://issues.apache.org/jira/browse/AXIS-1797
>      Project: Axis
>         Type: Bug
>   Components: WSDL processing
>     Versions: current (nightly)
>     Reporter: Steve Green
>  Attachments: 1797.wsdl
>
> 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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-1797?page=all ]
     
Davanum Srinivas resolved AXIS-1797:
------------------------------------

    Resolution: Fixed

Applied Patch.

thanks,
dims

> 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


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

Posted by "Jayachandra Sekhara Rao Sunkara (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-1797?page=comments#action_66594 ]
     
Jayachandra Sekhara Rao Sunkara commented on AXIS-1797:
-------------------------------------------------------

Hi Steve,
running the given Test.java against the artifacts created from the SimpleTypes.wsdl you have provided yielded me following results

Using 1.2 source without applying your patch.
---------------------------------------------
<ns1:localpart DerivedAttr1="nonce" xsi:type="ns2:DerivedSimpleType" xmlns:ns1="
http://namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns
2="http://test.com/reference">abc123</ns1:localpart>

After applying your patch:
--------------------------
<ns1:localpart DerivedAttr1="nonce" xsi:type="ns2:DerivedSimpleType" xmlns:ns1="http://namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://test.com/reference">abc123</ns1:localpart>

Actually even after the patch is applied, I couldn't see in the serialized piece of XML the values of BaseAttr1 and BaseAttr2. However I noticed that the DerivedSimpleType class created by WSDL2Java came out extending BaseSimpleType class without the _value datamember in it. Is the patch complete enough? or did I miss something? Can you post the response you got after running Test.java with your patch applied. Does it have in total three attributes?

Thanks
Jayachandra

> Base attributes not serialized when simpleContent extends another simpleContent
> -------------------------------------------------------------------------------
>
>          Key: AXIS-1797
>          URL: http://issues.apache.org/jira/browse/AXIS-1797
>      Project: Axis
>         Type: Bug
>   Components: WSDL processing
>     Versions: current (nightly)
>     Reporter: Steve Green
>  Attachments: 1797.patch, 1797.test.tar, 1797.wsdl, 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