Monday, November 14, 2011

opaq:opaqueElement and base64Binary

If you want to write binary data to a FTP in OSB (or simply you want to avoid any nXSD transformation in your XML), you have the option of using

opaq:opaqueElement

You should in this case base64-encode your payload.
The bad news is that in Xquery 1.0 there is not a function to base64encode

You can do a Java Callout or a Custom XPath to a Java function.

There are plenty of BASE64Encoder classes around... from the BEA WLI framework, from Sun, from Apache....

In fact, Sun implementation
http://stackoverflow.com/questions/5549464/import-sun-misc-base64encoder-got-error-in-eclipse is not really an option.

We have identified the Apache Commons base64 encoder - in alternative to Sun implementation, since Sun (Oracle) itself recommends NOT to use sun packages http://www.oracle.com/technetwork/java/faq-sun-packages-142232.html - as the most commonly used encoder.


So, use this http://commons.apache.org/codec/ commons-codec-1.4.jar

No comments: