axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amit Chauhan (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AXIS2-4308) base64Binary decoding works incorrectly: data is taken from the wrong element in XML
Date Mon, 20 Apr 2009 10:35:48 GMT

    [ https://issues.apache.org/jira/browse/AXIS2-4308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12700751#action_12700751
] 

Amit Chauhan commented on AXIS2-4308:
-------------------------------------

There is a workaround to solve this issue.  Always wrap your raw image data (byte[]) within
a complex type. For example:

<xs:complexType name="ImageType"> 
 <xs:sequence>
     <xs:element minOccurs="0" name="image" nillable="true" type="xs:base64Binary" />

   </xs:sequence>
  </xs:complexType>

So in the example given in the bug, now the data will be like:
 <zla:request> 
             <xsd:id>4748392</xsd:id> 
             <xsd:responseData>
                         <xsd:Image>AAECAwQ=</xsd:image>
               </xsd:responseData> 
         </zla:request> 

Now, beanElement.getFirstElement().getText(), for this element (image), will always give correct
base64 encoded text which we have to decode

> base64Binary decoding works incorrectly: data is taken from the wrong element in XML
> ------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4308
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4308
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: databinding
>    Affects Versions: 1.4.1
>            Reporter: Kirill Tsibriy
>
> I am deploying services as a POJO.
> I am looking at two code snippets from 1.4.1 src.
> BeanUtil.java:446
>                             } else if (parameters.isArray()) {
>                                 partObj = deserialize(parameters, (OMElement)parts.getParent(),
>                                         objectSupplier, prty.getName());
> BeanUtil.java:372
>                 if ("byte".equals(arrayClassType.getName())) {
>                     return Base64.decode(beanElement.getFirstElement().getText());
> This leads to data being sourced from wrong element, so with request like 
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:zla="schema1"
xmlns:xsd="schema1/xsd">
>    <soapenv:Header/>
>    <soapenv:Body>
>       <zla:request>
>           <zla:request>
>              <xsd:id>4748392</xsd:id>
>              <xsd:responseData>AAECAwQ=</xsd:responseData>
>          </zla:request>
>       </zla:request>
>    </soapenv:Body>
> </soapenv:Envelope>
> lead to decoding data from id element instead of contents of response data.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message