axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Chisholm (JIRA)" <j...@apache.org>
Subject [jira] Updated: (AXIS2-2594) Using attributeFormDefault="qualified" in a schema causes null attribute values in Java objects
Date Thu, 26 Apr 2007 07:10:16 GMT

     [ https://issues.apache.org/jira/browse/AXIS2-2594?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Paul Chisholm updated AXIS2-2594:
---------------------------------

    Description: 
When the schema that appears in the wsdl:types section of a WSDL file specifies attributeFormDefault="qualified"
then the the getter corresponding to an attribute returns null even though an attribute value
is specified in the XML.

Example:

Schema is

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           attributeFormDefault="qualified"
           elementFormDefault="qualified"
           targetNamespace="http://quickstart.samples/xsd">
  <xs:element name="attribute">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="value" nillable="true" type="xs:string" />
      </xs:sequence>
      <xs:attribute name="status" type="xs:string" />
    </xs:complexType>
  </xs:element>
  <xs:element name="attributeResponse">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="value" nillable="true" type="xs:string" />
      </xs:sequence>
      <xs:attribute name="status" type="xs:string" />
    </xs:complexType>
  </xs:element>
</xs:schema>

Message/port definition is

<wsdl:message name="attributeMessage">
  <wsdl:part name="part1" element="ns:attribute"/>
</wsdl:message> 
<wsdl:message name="attributeResponseMessage">
  <wsdl:part name="part1" element="ns:attributeResponse"/> 
</wsdl:message>
<wsdl:portType name="MyServicePortType">
  <wsdl:operation name="attribute">
    <wsdl:input message="axis2:attributeMessage"/>
    <wsdl:output message="axis2:attributeResponseMessage"/>
  </wsdl:operation>
</wsdl:portType>

Client code is

   public static void attribute(MyServiceStub stub){
        try{
            AttributeDocument reqDoc = AttributeDocument.Factory.newInstance();
            AttributeDocument.Attribute req = reqDoc.addNewAttribute();
            req.setStatus("OK");
            req.setValue("Testing");
            AttributeResponseDocument res = stub.attribute(reqDoc);
            System.err.println("Status="+res.getAttributeResponse().getStatus());
            System.err.println("Value="+res.getAttributeResponse().getValue());
        } catch(Exception e){
            e.printStackTrace();
            System.err.println("\n\n\n");
        }
   }

Service code is

    public AttributeResponseDocument attribute(AttributeDocument param1) {
        String status = param1.getAttribute().getStatus();
        String value = param1.getAttribute().getValue();
        System.err.println();
        System.err.println("Status="+status);
        System.err.println("Value="+value);
        AttributeResponseDocument resDoc =
                AttributeResponseDocument.Factory.newInstance();
        AttributeResponseDocument.AttributeResponse res =
                resDoc.addNewAttributeResponse();
        res.setStatus(status);
        res.setValue(value);
        return resDoc;
    }

When the client is run tracing of the element values displays as expected, but tracing of
the attributes always shows null.

If the schema is changed to attributeFormDefault="unqualified" the attribute values are displayed
successfully.

  was:
When the schema that appears in the wsdl:types section of a WSDL file specifies attributeFormDefault="qualified"
then the the getter corresponding to an attribute returns null even though an attribute value
is specified in the XML.

Example:

Schema is

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           attributeFormDefault="qualified"
           elementFormDefault="qualified"
           targetNamespace="http://quickstart.samples/xsd">
  <xs:element name="attribute">
    <xs:complexType>
      <xs:attribute name="status" type="xs:string" />
      <xs:sequence>
        <xs:element name="value" nillable="true" type="xs:string" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="attributeResponse">
    <xs:complexType>
      <xs:attribute name="status" type="xs:string" />
      <xs:sequence>
        <xs:element name="value" nillable="true" type="xs:string" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Message/port definition is

<wsdl:message name="attributeMessage">
  <wsdl:part name="part1" element="ns:attribute"/>
</wsdl:message> 
<wsdl:message name="attributeResponseMessage">
  <wsdl:part name="part1" element="ns:attributeResponse"/> 
</wsdl:message>
<wsdl:portType name="MyServicePortType">
  <wsdl:operation name="attribute">
    <wsdl:input message="axis2:attributeMessage"/>
    <wsdl:output message="axis2:attributeResponseMessage"/>
  </wsdl:operation>
</wsdl:portType>

Client code is

   public static void attribute(MyServiceStub stub){
        try{
            AttributeDocument reqDoc = AttributeDocument.Factory.newInstance();
            AttributeDocument.Attribute req = reqDoc.addNewAttribute();
            req.setStatus("OK");
            req.setValue("Testing");
            AttributeResponseDocument res = stub.attribute(reqDoc);
            System.err.println("Status="+res.getAttributeResponse().getStatus());
            System.err.println("Value="+res.getAttributeResponse().getValue());
        } catch(Exception e){
            e.printStackTrace();
            System.err.println("\n\n\n");
        }
   }

Service code is

    public AttributeResponseDocument attribute(AttributeDocument param1) {
        String status = param1.getAttribute().getStatus();
        String value = param1.getAttribute().getValue();
        System.err.println();
        System.err.println("Status="+status);
        System.err.println("Value="+value);
        AttributeResponseDocument resDoc =
                AttributeResponseDocument.Factory.newInstance();
        AttributeResponseDocument.AttributeResponse res =
                resDoc.addNewAttributeResponse();
        res.setStatus(status);
        res.setValue(value);
        return resDoc;
    }

When the client is run tracing of the element values displays as expected, but tracing of
the attributes always shows null.

If the schema is changed to attributeFormDefault="unqualified" the attribute values are displayed
successfully.


> Using attributeFormDefault="qualified" in a schema causes null attribute values in Java
objects
> -----------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-2594
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2594
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.1.1
>         Environment: Windows XP
> Java 1.6.0
> XMLBeans data binding
>            Reporter: Paul Chisholm
>            Priority: Minor
>
> When the schema that appears in the wsdl:types section of a WSDL file specifies attributeFormDefault="qualified"
then the the getter corresponding to an attribute returns null even though an attribute value
is specified in the XML.
> Example:
> Schema is
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>            attributeFormDefault="qualified"
>            elementFormDefault="qualified"
>            targetNamespace="http://quickstart.samples/xsd">
>   <xs:element name="attribute">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element name="value" nillable="true" type="xs:string" />
>       </xs:sequence>
>       <xs:attribute name="status" type="xs:string" />
>     </xs:complexType>
>   </xs:element>
>   <xs:element name="attributeResponse">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element name="value" nillable="true" type="xs:string" />
>       </xs:sequence>
>       <xs:attribute name="status" type="xs:string" />
>     </xs:complexType>
>   </xs:element>
> </xs:schema>
> Message/port definition is
> <wsdl:message name="attributeMessage">
>   <wsdl:part name="part1" element="ns:attribute"/>
> </wsdl:message> 
> <wsdl:message name="attributeResponseMessage">
>   <wsdl:part name="part1" element="ns:attributeResponse"/> 
> </wsdl:message>
> <wsdl:portType name="MyServicePortType">
>   <wsdl:operation name="attribute">
>     <wsdl:input message="axis2:attributeMessage"/>
>     <wsdl:output message="axis2:attributeResponseMessage"/>
>   </wsdl:operation>
> </wsdl:portType>
> Client code is
>    public static void attribute(MyServiceStub stub){
>         try{
>             AttributeDocument reqDoc = AttributeDocument.Factory.newInstance();
>             AttributeDocument.Attribute req = reqDoc.addNewAttribute();
>             req.setStatus("OK");
>             req.setValue("Testing");
>             AttributeResponseDocument res = stub.attribute(reqDoc);
>             System.err.println("Status="+res.getAttributeResponse().getStatus());
>             System.err.println("Value="+res.getAttributeResponse().getValue());
>         } catch(Exception e){
>             e.printStackTrace();
>             System.err.println("\n\n\n");
>         }
>    }
> Service code is
>     public AttributeResponseDocument attribute(AttributeDocument param1) {
>         String status = param1.getAttribute().getStatus();
>         String value = param1.getAttribute().getValue();
>         System.err.println();
>         System.err.println("Status="+status);
>         System.err.println("Value="+value);
>         AttributeResponseDocument resDoc =
>                 AttributeResponseDocument.Factory.newInstance();
>         AttributeResponseDocument.AttributeResponse res =
>                 resDoc.addNewAttributeResponse();
>         res.setStatus(status);
>         res.setValue(value);
>         return resDoc;
>     }
> When the client is run tracing of the element values displays as expected, but tracing
of the attributes always shows null.
> If the schema is changed to attributeFormDefault="unqualified" the attribute values are
displayed successfully.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Mime
View raw message