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); } // end method addWSAToHeader
getWebServiceTemplate() .marshalSendAndReceive( new JAXBElement<>(new QName(Constants.BROKER_CONNECTION_SERVICE_NAMESPACE_URI, Constants.BROKER_CONNECTION_SERVICE_LOCAL_PART), ConnectionRequestType.class, connectionRequestType), new WebServiceMessageCallback() { @Override public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException { SOAPMessage soapMessage = ((SaajSoapMessage) message).getSaajMessage(); SOAPHeader soapHeader = soapMessage.getSOAPHeader(); SOAPHeaderElement actionElement = soapHeader.addHeaderElement(new QName("http://schemas.xmlsoap.org/ws/2004/08/addressing", "Action", "wsa")); actionElement.setMustUnderstand(false); actionElement.setTextContent("ConnectionService"); } });
/** * Adds a wsa:RelatesTo SOAP header if the incoming invocation had a * wsa:MessageID SOAP header present - note that OASIS SCA requires that the * RelationshipType attribute is set to a particular SCA value * * @param sh - the SOAP headers * @param msg - the message * @throws SOAPException */ private void addWSARelatesTo(SOAPHeader sh, Message msg) throws SOAPException { // // Note that the 'core' (loosely speaking) part of the invocation chain // will have already copied the forward message msgId to the RELATES_TO header. // String idValue = (String)msg.getHeaders().get(Constants.RELATES_TO); if (idValue != null) { SOAPHeaderElement relatesToH = sh.addHeaderElement(QNAME_WSA_RELATESTO); relatesToH.addAttribute(new QName(null, "RelationshipType"), SCA_CALLBACK_REL); relatesToH.setTextContent(idValue); // OMElement relatesToOM = sh.getOMFactory().createOMElement( // QNAME_WSA_RELATESTO ); // OMAttribute relType = // sh.getOMFactory().createOMAttribute("RelationshipType", null, // SCA_CALLBACK_REL); // relatesToOM.addAttribute( relType ); // relatesToOM.setText( idValue ); // sh.addChild( relatesToOM ); } } // end method addWSARelatesTo
private void addWSAActionHeader(SOAPHeader sh, String action) throws SOAPException { // Create wsa:Action header which is required by ws-addressing spec if (action == null) { PortType portType = ((WSDLInterface)wsBinding.getBindingInterfaceContract().getInterface()).getPortType(); javax.wsdl.Operation op = portType.getOperation(operation.getName(), null, null); action = getActionFromInputElement(wsBinding.getGeneratedWSDLDocument(), portType, op, op.getInput()); } // OMElement actionOM = // sh.getOMFactory().createOMElement(QNAME_WSA_ACTION); // actionOM.setText(action == null ? "" : action); // sh.addChild(actionOM); SOAPHeaderElement actionH = sh.addHeaderElement(QNAME_WSA_ACTION); actionH.setTextContent(action == null ? "" : action); } // end method addWSAActionHeader
SOAPHeader header = soapMessage.getSOAPHeader(); for (Name name : soapReqHeaders.keySet()) { header.addHeaderElement(name).setTextContent(soapReqHeaders.get(name));
String messageId = UUID.randomUUID().toString(); SOAPHeaderElement msgIdHeader = sh.addHeaderElement(QNAME_WSA_MESSAGEID); msgIdHeader.setTextContent(messageId);
SOAPHeader header = soapMessage.getSOAPHeader(); for (Name name : soapReqHeaders.keySet()) { header.addHeaderElement(name).setTextContent(soapReqHeaders.get(name));