axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dimitar Gospodinov <dkg_0...@hotmail.com>
Subject Error decoding base64Binary
Date Fri, 05 Aug 2011 18:24:46 GMT

Hello,

Recently I upgraded from Axis2 1.4.1 to Axis2 1.6.0.
I have a web service with operation Test. One of the Test parameters is of type base64Binary.
After
 upgrading to 1.6.0 Test stopped working - my code did not even get 
called. Some investigation revealed that the problem is with the base64 
data. An error is generated with the following message:

javax.xml.stream.XMLStreamException: Error during base64 decoding

Digging a bit more revealed that the root cause is:
java.io.IOException: Invalid base64 char '\n'
    at org.apache.axiom.util.base64.AbstractBase64DecodingWriter.decode(AbstractBase64DecodingWriter.java:80)
    at org.apache.axiom.util.base64.AbstractBase64DecodingWriter.decode(AbstractBase64DecodingWriter.java:91)
    at org.apache.axiom.util.base64.AbstractBase64DecodingWriter.write(AbstractBase64DecodingWriter.java:66)
    at org.apache.axiom.util.base64.AbstractBase64DecodingWriter.write(AbstractBase64DecodingWriter.java:57)
    at java.io.Writer.write(Writer.java:140)
    at org.apache.axiom.util.stax.XMLStreamReaderUtils.writeTextTo(XMLStreamReaderUtils.java:287)
    at org.apache.axiom.om.impl.SwitchingWrapper.writeTextTo(SwitchingWrapper.java:466)
    at org.apache.axiom.util.stax.XMLStreamReaderUtils.writeTextTo(XMLStreamReaderUtils.java:285)
    at org.apache.axiom.util.stax.XMLStreamReaderUtils.getDataHandlerFromElement(XMLStreamReaderUtils.java:237)
    ... 23 more

The
 base64 data passed to the web service looks like this(exact snapshot of
 the HTTP request, with just the first 3 lines shown):

<data xmlns="">MS4wMToxNDIdMS4wMjowMzAwHTEuMDM6MR8wMx4yHzAwHjQfMDEeNB8wMh0xLjA0OlBOUx0xLjA1
OjIwMTEwODAyHTEuMDY6Mh0xLjA3OkZMRkRMRUNWWh0xLjA4OkZMMDM3ODhXMB0xLjA5OjExMDgw
MjAwMDcdMS4xMToxOS42OR0xLjEyOjE5LjY5HDIuMDAxOjE4HTIuMDAyOjAwHAAAgngBAAL/////

There is \r\n between each line.

All this used to work with 1.4.1 and now suddenly stopped with the above error.
After
 some more investigation it turned out that if all \r\n are removed from
 the <data> element with the base64 data (basically make the 
base64 value a single line), everything works Ok.

Is this a bug or expected behavior? According to the xsd::base64Binary definition line breaks
should be Ok.

Thanks,

Dimitar

 		 	   		  
Mime
View raw message