javax.xml.namespace.QName partQName =
new javax.xml.namespace.QName(
fieldMessageModel.getQName().getNamespaceURI(),
partModel.getName());
JMSFormatHandler fh = getFormatHandler(partName);
if (fh != null) {
fh.setPartQName(partQName);
fh.setObjectPart(parts.get(partName));
fh.write(message);
} else {
// No format handler
Object part = parts.get(partName);
message.setText(part.toString());
}
} else {
// Use my own XML Structure
// Prepare the stream writers and the serializers
java.io.ByteArrayOutputStream os =
new java.io.ByteArrayOutputStream();
java.io.OutputStreamWriter writer =
new java.io.OutputStreamWriter(os);
org.apache.xml.serialize.OutputFormat format =
new org.apache.xml.serialize.OutputFormat();
org.apache.xml.serialize.XMLSerializer serializer =
new org.apache.xml.serialize.XMLSerializer(writer, format);
String namespace = "";
// Start the document
serializer.startDocument();
// Add the message tag
serializer.startElement(
namespace,
fieldMessageModel.getQName().getLocalPart(),
"",
new org.xml.sax.helpers.AttributesImpl());
// Cycle the parts, invoking each format handler
for (int i = 0; i < partNames.length; i++) {
String partName = partNames[i];
// Add a beginning tag
serializer.startElement(
namespace,
partName,
"",
new org.xml.sax.helpers.AttributesImpl());
javax.wsdl.Part partModel =
fieldMessageModel.getPart(partName);
javax.xml.namespace.QName partQName =
new javax.xml.namespace.QName(
fieldMessageModel.getQName().getNamespaceURI(),
partModel.getName());
// Determine the format handler
JMSFormatHandler fh = getFormatHandler(partName);
if (fh != null) {
fh.setPartQName(partQName);
fh.setObjectPart(parts.get(partName));
// Send the message since it is the native format
// Reinitialize the message content
message.setText("");
fh.write(message);
char[] c = message.getText().toCharArray();
serializer.characters(c, 0, c.length);
} else {
// No format handler
Object part = parts.get(partName);