axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Spinelli <andrea.spine...@imteam.it>
Subject BUG [?] in BeanUtil
Date Wed, 10 Sep 2008 14:06:25 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<div class="moz-text-html" lang="x-western">
<div class="moz-text-flowed"
 style="font-family: -moz-fixed; font-size: 13px;" lang="x-western">Hi
everybody,
<br>
<br>
our company is using axis2 to make available to multiple platforms a
document management service.
<br>
<br>
Documents are represented by Java beans, with a property of type
byte[], the content of the document. We have a method which sends a
document from the client to the server.
<br>
<br>
I noticed that the content of the document is received empty or garbled
at the server side. I googled a lot about this issue, but found
nothing. So I tried to debug the axis2 code (using Eclipse) and I think
I isolated the problem. The XML SOAP request contains a fragment like
(simplified and translated):
<br>
<br>
...&lt;document&gt;&lt;field1&gt;foo&lt;/field1&gt;...
&lt;documentText&gt;...(base64 encoded
content&gt;...&lt;/documentText&gt; ...
&lt;lastField&gt;...&lt;/lastField&gt;&lt;/document&gt;...
<br>
<br>
The axis2 code is contained in the ADB module, in the class
org.apache.axis2.databinding.utils.BeanUtil. The program iterates over
the properties of the javabean "document" until it finds the property
"documentText"; it recognizes it is an array and calls recursively the
deserialize method:
<br>
<br>
                           } else if (parameters.isArray()) {
<br>
                               partObj = deserialize(parameters,
(OMElement)parts.getParent(),
<br>
                                       objectSupplier,
prty.getName());
<br>
<br>
Here "parts" is the element &lt;documentText&gt;, and its getParent()
is "&lt;document&gt;".
<br>
<br>
Then the following code is executed:
<br>
<br>
           if (beanClass.isArray()) {
<br>
               ArrayList valueList = new ArrayList();
<br>
               Class arrayClassType = beanClass.getComponentType();
<br>
               if ("byte".equals(arrayClassType.getName())) {
<br>
                   return
Base64.decode(beanElement.getFirstElement().getText());
<br>
<br>
Here "beanElement" is the second parameter of "deserialize", a
structure representing the whole &lt;document&gt; element.
<br>
<br>
So the Base64 decoder is called on the text of the first element of
"&lt;document&gt;", which is "foo" in the above example, and is
actually the value of field1 - not good.
<br>
<br>
I modified the code deleting the call to getParent (passing directly
"parts"), and calling the Base64 decoder on the text of the current
element:
<br>
<br>
                       return Base64.decode(beanElement.getText());
<br>
<br>
and it works fine for me, both from a .NET client and a axis1 client.
Moreover, all the tests of the ADB module are OK.
<br>
<br>
After all this explanation, my question is: is this a bug, or I
misunderstood something? If my modifications are actually a fix, how
can I submit it?
<br>
<br>
TIA
<br>
  Andrea
<br>
<br>
<div class="moz-txt-sig"><span class="moz-txt-tag">-- <br>
</span>dott. Andrea Spinelli - IMTeam
<br>
e-mail: andrea dot spinelli at imteam dot it
<br>
phone: +39-035-636029
<br>
fax: +39-035-638129
<br>
www: <a class="moz-txt-link-freetext" href="http://www.imteam.it/">http://www.imteam.it/</a>
<br>
IANA enterprise number: 1.3.6.1.4.1.30916
<br>
<br>
</div>
</div>
<br>
</div>
</body>
</html>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message