header = factory.createSOAPHeader(envelope);
}
OMElement element = xmlHelper.toOMElement(content);
// We can't add the element directly to the SOAPHeader. Instead, we need to copy the
// information over to a SOAPHeaderBlock.
SOAPHeaderBlock headerBlock = header.addHeaderBlock(element.getLocalName(),
element.getNamespace());
for (Iterator it = element.getAllAttributes(); it.hasNext(); ) {
headerBlock.addAttribute((OMAttribute)it.next());
}
headerBlock.setMustUnderstand(mustUnderstand);
OMNode child = element.getFirstOMChild();
while (child != null) {
// Get the next child before addChild will detach the node from its original place.
OMNode next = child.getNextOMSibling();
headerBlock.addChild(child);
child = next;
}
}