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 bu...@apache.org on 2003/12/03 21:16:10 UTC

DO NOT REPLY [Bug 25179] New: - BeanDeserializer cannot deserialize child array unless xsi:type="SE:Array" provided

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25179>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25179

BeanDeserializer cannot deserialize child array unless xsi:type="SE:Array" provided

           Summary: BeanDeserializer cannot deserialize child array unless
                    xsi:type="SE:Array" provided
           Product: Axis
           Version: 1.1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: rob_dippel@yahoo.ca


I seem to have uncovered an issue when trying to deserialize a string array in 
a complex type.
 
I've been able to reproduce using axis 1.1, as well as the nightly build from 
Dec. 1.  The string array in the complex type is interpreted by axis as a 
string, rather than an array, because the xsi:type="SE:Array" attribute is
missing from the arrayType.  The reason it is missing is that a third party 
toolkit is generating the xml request which axis is trying to deserialize.
 
The xml that axis is trying to deserialize looks something like this:
 <AMethod
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:SE="http://schemas.xmlsoap.org/soap/encoding/"
 <options SE:arrayType="rci0:option[1]"
   <item xsi:type="rci0:optionStringArray"
     <rci0:name
 xsi:type="rci0:optionEnum"someOption</rci0:name
     <rci0:value SE:arrayType="xsd:string[1]"
     <item
 xsi:type="xsd:string"someOptionHere</item
     </rci0:value
   </item
 </options
 </rci0:AMethod
 
 Axis throws this exception:
 org.xml.sax.SAXException: SimpleDeserializer encountered a child element, 
which is NOT expected, in something it was trying to deserialize.
 	at

org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild
(SimpleDeserializer.java:189)
 	at

org.apache.axis.encoding.DeserializationContextImpl.startElement
(DeserializationContextImpl.java:1036)
 	at

org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
 	at

org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:845)
 	at

org.apache.axis.encoding.DeserializerImpl.startElement
(DeserializerImpl.java:409)
 	at

org.apache.axis.encoding.DeserializationContextImpl.startElement
(DeserializationContextImpl.java:1049)
 	at

org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
 	at

org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:845)
 	at

org.apache.axis.encoding.DeserializerImpl.startElement
(DeserializerImpl.java:409)
 	at

org.apache.axis.encoding.ser.BeanDeserializer.startElement
(BeanDeserializer.java:165)
 	at

org.apache.axis.encoding.DeserializationContextImpl.startElement
(DeserializationContextImpl.java:1049)
 	at

org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
 	at

org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:845)
 	at

org.apache.axis.message.RPCElement.deserialize(RPCElement.java:325)
 	at

org.apache.axis.message.RPCElement.getParams(RPCElement.java:349)
 
 If this line in the xml:
 <rci0:value SE:arrayType="xsd:string[1]"
 is changed to:
 <rci0:value xsi:type="SE:Array"
 SE:arrayType="xsd:string[1]"
 
 then axis is fine.
 
 However, I looked at section 5.1 of the SOAP 1.1 spec, and it seems to me that 
axis should be able to determine that the value element is a string array
 (i.e. the xsi:type is optional when the arrayType attribute exists).
 
 I dropped this in a debugger to verify that it was the string array that was 
producing the exception. From looking at the code in axis, the
 BeanDeserializer class needs a 1 line change to fix this issue:
 
 On line 266, change :
         QName childXMLType =
 context.getTypeFromXSITypeAttr(namespace, 
 
 to:
         QName childXMLType =
 context.getTypeFromAttributes(namespace, 
 
The getTypeFromXSIType method isn't used anywhere else in the code (except 
within the getTypeFromAttributes method).
 
I'd previously posted this to the axis-dev and axis-user lists, but didn't get 
any reply.  The postings contained a test case to demonstrate the problem.