XMLStreamWriter writer = xtw;
if (header instanceof SoapHeader) {
SoapHeader soapHeader = (SoapHeader)header;
writer = new SOAPHeaderWriter(xtw, soapHeader, soapVersion, soapPrefix);
}
DataBinding b = header.getDataBinding();
if (b == null) {
HeaderProcessor hp = bus.getExtension(HeaderManager.class)
.getHeaderProcessor(header.getName().getNamespaceURI());
if (hp != null) {
b = hp.getDataBinding();
}
}
if (b != null) {
MessagePartInfo part = new MessagePartInfo(header.getName(), null);
part.setConcreteName(header.getName());
b.createWriter(XMLStreamWriter.class)
.write(header.getObject(), part, writer);
} else {
Element node = (Element)header.getObject();
StaxUtils.copy(node, writer);
}