Uploaded image for project: 'Axis'
  1. Axis
  2. AXIS-2914

Wrong deserialization of arrays

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.4
    • None
    • None
    • Java 1.8.0_66

    Description

      An external webservice returns a message

      <?xml version="1.0" encoding="UTF-8" standalone="no"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header><ns1:wosid xmlns:ns1="http://www.apple.com/webobjects/webservices/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xsi:type="soapenc:string">KMN8CSp2A5BOd0OOOPizng</ns1:wosid><ns2:woinst xmlns:ns2="http://www.apple.com/webobjects/webservices/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xsi:type="soapenc:string">1</ns2:woinst></soapenv:Header><soapenv:Body><ns3:projectDataResponse xmlns:ns3="http://ws.dc.xyz.de" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><projectDataReturn xmlns:ns4="http://results.ws.appserver.xyz.de" xsi:type="ns4:ProjectDataResult"><errorCode xsi:type="xsd:int">0</errorCode><message xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:nil="true" xsi:type="soapenc:string"/><statusCode xsi:type="xsd:int">1</statusCode><project xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:string">ZKS</project><centres xmlns:ns5="http://beans.eo.xyz.de" xsi:type="ns5:CentreBean"><name xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:string">Center 1</name></centres><centres xmlns:ns6="http://beans.eo.xyz.de" xsi:type="ns6:CentreBean"><name xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:string">Center 2</name></centres></projectDataReturn></ns3:projectDataResponse></soapenv:Body></soapenv:Envelope>
      

      But the Array contains only the last CentreBean object. I have seen in the code, that the set() method of the BeanPropertyDescriptor overwrites the previous CenterBean object in the target array. The object is casted to CentreBean[] with one entry and it is stored on the same place as the first CenterBean.

      It seems, that it should be necessary to use an index property value greater than 0 to access the right set() method (the one which can handle arrays), but the index is always -1, and so it will use the simple one.

      Within the DeserializerImpl.class I have a CentreBean.class as value object within the valueComplete() method (which is called after the endElement event during the XML parsing). The first call to the BeanPropertyDescriptor.set() throws an exception because the object type must be an array. After JavaUtils.convert() I have the right type, but the set() method doesn't recognize, that there is a value already stored within the BeanPropertyDescriptor. So the result will hold only the last one.

      Is this a problem with the deserializer or is there a problem with the Webservice description?

      Attachments

        Activity

          People

            Unassigned Unassigned
            witchi74 Andre Rothe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: