Monday, May 10, 2010

WBI - Getting XML content

One problem with WBI is that the XML messages must follow its format (with its own header elements) or it will not be recognized properly and the content is just dumped to a BLOB.
But we have other programs that simply write their XML messages to our queues so we need to get the contents out.

Since WBI always passes you the root MbElement, the content can be retrieved this way:

MbElement data = (MbElement) ((List)root.evaluateXPath("BLOB/BLOB")).get(0);
String dataStr = new String((byte[])data.getValue());