private void addWSAToHeader(SOAPHeader sh, String address, Message msg) throws SOAPException {
// Create wsa:To header which is required by ws-addressing spec
// OMElement wsaToOM = sh.getOMFactory().createOMElement(QNAME_WSA_TO);
// wsaToOM.setText( address );
// sh.addChild(wsaToOM);
SOAPHeaderElement toH = sh.addHeaderElement(QNAME_WSA_TO);
toH.setTextContent(address);
// Deal with Reference Parameters, if present - copy to the header
// without the wsa:ReferenceParameters wrapper
// OMElement refParms = (OMElement) msg.getHeaders().get(WS_REF_PARMS);
// Iterator ces = sh.getChildElements(new QName(WSA_FINAL_NAMESPACE,
// WS_REF_PARMS));
Iterator<SOAPElement> ces = sh.getChildElements();
while (ces.hasNext()) {
SOAPElement se = ces.next();
if (WS_REF_PARMS.equals(se.getElementQName().getLocalPart())) {
// if( refParms != null ) {
Iterator<SOAPElement> children = se.getChildElements();
while (children.hasNext()) {
SOAPElement node = (SOAPElement)children.next();
toH.addChildElement(node);
}
// } // end if
}
}