Sure thing. Here it is:
IDataCursor pipelineCursor =pipeline.getCursor();
// documentSrc
String xmlString = IDataUtil.getString( pipelineCursor, "xmlString");
String encoding = IDataUtil.getString( pipelineCursor, "encoding");
pipelineCursor.destroy();
// pipeline
IDataCursor pipelineCursor_1 = pipeline.getCursor();
if (xmlString.length() == 0) return;
StringBuffer sb = new StringBuffer(xmlString);
if (sb.charAt(0) != '\uFEFF') {
sb.insert(0, '\uFEFF');
}
xmlString = sb.toString();
try {
pipelineCursor.insertAfter("bytes", xmlString.getBytes(encoding));
}
catch (UnsupportedEncodingException uex) {
ServiceException se = new ServiceException();
se.fillInStackTrace();
throw se;
}
IDataUtil.put( pipelineCursor_1, "xmlStringWithBOM", xmlString );
pipelineCursor_1.destroy();
The only thing is that now I’m trying to make it work depending on input encoding and just can’t get part where I’m setting BOM as ‘\uEFBBBF’ to work.
#Flow-and-Java-services#Integration-Server-and-ESB#webMethods