msgField.addAttribute(soapFactory.createOMAttribute(FIXConstants.FIX_FIELD_ID,
null, String.valueOf(field.getTag())));
Object value = field.getObject();
if (value instanceof byte[]) {
DataSource dataSource = new ByteArrayDataSource((byte[]) value);
DataHandler dataHandler = new DataHandler(dataSource);
String contentID = msgCtx.addAttachment(dataHandler);
OMElement binaryData = soapFactory.createOMElement(
FIXConstants.FIX_BINARY_FIELD, null);
String binaryCID = "cid:" + contentID;
binaryData.addAttribute(FIXConstants.FIX_MESSAGE_REFERENCE, binaryCID, null);
msgField.addChild(binaryData);
} else {
soapFactory.createOMText(msgField, value.toString(),
OMElement.CDATA_SECTION_NODE);
}
header.addChild(msgField);
}
}
//process FIX body
convertFIXBodyToXML(message, body, soapFactory, msgCtx);
//process FIX trailer
iter = message.getTrailer().iterator();
if (iter != null) {
while (iter.hasNext()) {
Field<?> field = iter.next();
OMElement msgField = soapFactory.createOMElement(FIXConstants.FIX_FIELD, null);
msgField.addAttribute(soapFactory.
createOMAttribute(FIXConstants.FIX_FIELD_ID, null,
String.valueOf(field.getTag())));
Object value = field.getObject();
if (value instanceof byte[]) {
DataSource dataSource = new ByteArrayDataSource((byte[]) value);
DataHandler dataHandler = new DataHandler(dataSource);
String contentID = msgCtx.addAttachment(dataHandler);
OMElement binaryData = soapFactory.createOMElement(
FIXConstants.FIX_BINARY_FIELD, null);
String binaryCID = "cid:" + contentID;