[ https://issues.apache.org/jira/browse/AXIS-2914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15362110#comment-15362110 ]
Andre Rothe commented on AXIS-2914: ----------------------------------- It seems to work with this XML if you use public member variables within the bean classes. If you use a public member array, then it works, if you change the visibility and use getter /setter methods for the array, the XML is wrong to fill the values into the CentreBean[]. My current workaround uses SOAP handler on client side, which adds the array description into an additional tag of type ArrayOfCentreBean into the webservice response just before Axis processes the XML. > Wrong deserialization of arrays > ------------------------------- > > Key: AXIS-2914 > URL: https://issues.apache.org/jira/browse/AXIS-2914 > Project: Axis > Issue Type: Bug > Components: Serialization/Deserialization > Affects Versions: 1.4 > Environment: Java 1.8.0_66 > Reporter: Andre Rothe > > An external webservice returns a message > {code:xml} > <?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> > {code} > 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? -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org For additional commands, e-mail: java-dev-h...@axis.apache.org