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/01/15 00:36:06 UTC

DO NOT REPLY [Bug 16082] New: - bug in ElementDeserializer

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=16082>.
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=16082

bug in ElementDeserializer

           Summary: bug in ElementDeserializer
           Product: Axis
           Version: 1.1beta
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: axis-dev@xml.apache.org
        ReportedBy: ema@nimble.com


there seems to be a problem with ElementDeserializer.onEndElement. i have run 
into it while trying out IBM's wsdk, specifically one of their sample apps. i 
can provide details if necessary.

the response was as follows:
RESPONSE: <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xm
lns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XML
Schema-instance">
 <SOAP-ENV:Body>
  <ns1:getAddressFromNameResponse SOAP-ENV:encodingStyle="http://schemas.xmlsoap
.org/soap/encoding/" xmlns:ns1="http://www.addressbookservice.com/AddressBook">
   <getAddressFromNameResult xsi:type="ns2:AddressType" xmlns:ns2="http://www.ad
dressbookservice.com/AddressBook-types">
    <streetNum xsi:type="xsd:int">111</streetNum>
    <streetName xsi:type="xsd:string">Main St.</streetName>
    <city xsi:type="xsd:string">Raleigh</city>
    <state xsi:type="xsd:string">NC</state>
    <zip xsi:type="xsd:int">27513</zip>
    <phoneNumber xsi:type="ns2:phoneNumberType">
     <areaCode xsi:type="xsd:int">919</areaCode>
     <exchange xsi:type="xsd:string">334</exchange>
     <number xsi:type="xsd:string">8765</number>
    </phoneNumber>
   </getAddressFromNameResult>
  </ns1:getAddressFromNameResponse>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

and what came out of the ElementDeserializer was this:
<streetNum xsi:type="xsd:int">111</streetNum>

seems to be caused by this chunk of code:
ArrayList children = msgElem.getChildren();
                if ( children != null ) {                    
                        msgElem = (MessageElement) children.get(0);
                        if ( msgElem != null ) {
                            value = msgElem.getAsDOM();      
                        }
                    }
                }

notice how only the first child is considered.

a potential fix, which worked ok for my case is to replace this code with the 
following:
ArrayList children = msgElem.getChildren();
                if ( children != null ) {
                    if (children.size() > 1) {
                        value = msgElem.getAsDOM();
                    }
                    else {                    
                        msgElem = (MessageElement) children.get(0);
                        if ( msgElem != null ) {
                            value = msgElem.getAsDOM();      
                        }
                    }
                }