Hi everybody,

our company is using axis2 to make available to multiple platforms a document management service.

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.

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):

...<document><field1>foo</field1>... <documentText>...(base64 encoded content>...</documentText> ... <lastField>...</lastField></document>...

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:

                           } else if (parameters.isArray()) {
                               partObj = deserialize(parameters, (OMElement)parts.getParent(),
                                       objectSupplier, prty.getName());

Here "parts" is the element <documentText>, and its getParent() is "<document>".

Then the following code is executed:

           if (beanClass.isArray()) {
               ArrayList valueList = new ArrayList();
               Class arrayClassType = beanClass.getComponentType();
               if ("byte".equals(arrayClassType.getName())) {
                   return Base64.decode(beanElement.getFirstElement().getText());

Here "beanElement" is the second parameter of "deserialize", a structure representing the whole <document> element.

So the Base64 decoder is called on the text of the first element of "<document>", which is "foo" in the above example, and is actually the value of field1 - not good.

I modified the code deleting the call to getParent (passing directly "parts"), and calling the Base64 decoder on the text of the current element:

                       return Base64.decode(beanElement.getText());

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.

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?

TIA
  Andrea

-- 
dott. Andrea Spinelli - IMTeam
e-mail: andrea dot spinelli at imteam dot it
phone: +39-035-636029
fax: +39-035-638129
www: http://www.imteam.it/
IANA enterprise number: 1.3.6.1.4.1.30916


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to