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 "Michael Hu (JIRA)" <ax...@ws.apache.org> on 2007/03/07 20:59:24 UTC

[jira] Commented: (AXIS-2095) Items in an array seems to have the wrong name compared to what the WSDL says.

    [ https://issues.apache.org/jira/browse/AXIS-2095?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12478872 ] 

Michael Hu commented on AXIS-2095:
----------------------------------

Can the priority of this bug be updated to blocker? Serialization of sequences is basic functionality and has been broken since 1.3.

With an XSD definition like this:

  <xs:complexType name="widgetRequestEntity">
    <xs:element name="widgetList" minOccurs="0">
  </xs:complexType>
  
  <xs:element name="widgetList" minOccurs="0">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="widget" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="widget">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="widgetName" type="xs:string"/>
        ...
      </xs:sequence>
    </xs:complexType>
  </xs:element>

Axis 1.3/1.4 converts this:

Widget widget1 = new Widget();
widget1.setWidgetName("AAA");
Widget widget2 = new Widget();
widget2.setWidgetName("BBB");
Widget[] widgetList = new Widget[2];
widgetArray[0] = widget1;
widgetArray[1] = widget2;
widgetRequestEntity.setWidgetList(widgetList);

to this (which is wrong):

  <ns:widgetList>
    <ns:widgetName>AAA</ns:widgetName>
  </ns:widgetList>
  <ns:widgetList>
    <ns:widgetName>BBB</ns:widgetName>
  </ns:widgetList>

when it should be converting it to this:

  <ns:widgetList>
    <ns:widget>
      <ns:widgetName>AAA</ns:widgetName>
    </ns:widget>
    <ns:widget>
      <ns:widgetName>BBB</ns:widgetName>
    </ns:widget>
  </ns:widgetList>
  

> Items in an array seems to have the wrong name compared to what the WSDL says.
> ------------------------------------------------------------------------------
>
>                 Key: AXIS-2095
>                 URL: https://issues.apache.org/jira/browse/AXIS-2095
>             Project: Axis
>          Issue Type: Bug
>    Affects Versions: 1.2.1
>            Reporter: Ted Sanne
>
> My WSDL describes an array (this is only a small fragment of the complete WSDL):
> <complexType name="PropertyValueDTO">
> 	<sequence>
> <element name="URI" type="xsd:boolean"/>
> <element name="dateTime" type="xsd:boolean"/>
> <element name="hasHistory" type="xsd:boolean"/>
> <element name="id" nillable="true" type="xsd:string"/>
> <element name="label" nillable="true" type="xsd:string"/>
> <element name="source" nillable="true" type="xsd:string"/>
> <element name="timestamp" nillable="true" type="xsd:dateTime"/>
> <element name="unit" nillable="true" type="xsd:string"/>
> <element name="updated" nillable="true" type="xsd:dateTime"/>
> <element name="value" nillable="true" type="xsd:string"/>
> </sequence>
> </complexType>
> <complexType name="ArrayOfPropertyValueDTO">
>         <sequence>
>              <element maxOccurs="unbounded" minOccurs="0" name="item" type="impl:PropertyValueDTO"/>
>         </sequence>
> </complexType>
> <complexType abstract="true" name="TraceableDetailsDTO">
>   <sequence>
>    <element name="hasExternalLinks" type="xsd:boolean"/>
>    <element name="label" nillable="true" type="xsd:string"/>
>    <element name="properties" nillable="true" type="impl:ArrayOfPropertyValueDTO"/>
>    </sequence>
> </complexType>
> When calling the webservice the return looks like this:
> <properties>
>    <properties>
>    ...
>    </properties>
> <properties>
> and the client throws the following:
> org.xml.sax.SAXException: Invalid element in com.tracetracker.enterprise.twa.ArrayOfPropertyValueDTO - properties
> 	at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:258)
> 	at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
> 	at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
> 	at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
>         ...
> It seems the client expects a structure like this:
> <properties>
>    <item>
>    ...
>    </item>
> <properties>
> Having a go at debugging the ArraySerializer I can see in my debugger that both itemQName and componentQName is null, so elementName is never changed from "properties" to "item":
> // For the maxOccurs case, each item is named with the QName
> // we got in the arguments.  For normal array case, we write an element with
> // that QName, and then serialize each item as <item>
> QName elementName = name;
> Attributes serializeAttr = attributes;
> if (!maxOccursUsage) {
>       serializeAttr = null;  // since we are putting them here
>       context.startElement(name, attributes);
>       if (itemQName != null)
>              elementName = itemQName;
>       else if(componentQName != null)
>               elementName = componentQName;
> } 
> Can anyone tell me what has gone wrong here?

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