protected QName getOpQName(Exchange ex, Object data) { SOAPMessageContextImpl sm = (SOAPMessageContextImpl)data; try { SOAPMessage msg = sm.getMessage(); if (msg == null) { return null; } SOAPBody body = SAAJUtils.getBody(msg); if (body == null) { return null; } org.w3c.dom.Node nd = body.getFirstChild(); while (nd != null && !(nd instanceof org.w3c.dom.Element)) { nd = nd.getNextSibling(); } if (nd != null) { return new QName(nd.getNamespaceURI(), nd.getLocalName()); } } catch (SOAPException e) { //ignore, nothing we can do } return null; }
InputStream in = cos.getInputStream(); SOAPMessage msg = initSOAPMessage(in); source = new DOMSource(SAAJUtils.getBody(msg).getFirstChild()); in.close(); } catch (Exception e) {
SOAPMessage sm = response; SOAPBody sb = response.getSOAPBody(); DOMSource source = new DOMSource(sb.getFirstChild()); results = (FindEventsResponse) JAXB.unmarshal(source, FindEventsResponse.class);
public String getMessage(SOAPMessageContext smc) { SOAPMessage message = smc.getMessage(); ByteArrayOutputStream soapEnvelope = new ByteArrayOutputStream(); message.writeTo(soapEnvelope); soapEnvelope.close(); return new String(soapEnvelope.toByteArray()); } public String getMethod(SOAPMessageContext smc) { SOAPMessage message = smc.getMessage(); SOAPBody body = message.getSOAPBody(); return body.getFirstChild().getLocalName(); }
private byte[] getValidationReportContent(SOAPBody soapBody) throws IOException, SOAPException, TransformerException { Node validationReportNode = soapBody.getFirstChild().getFirstChild(); DOMSource source = new DOMSource(validationReportNode); StringWriter stringWriter = new StringWriter(); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.transform(source, new StreamResult(stringWriter)); String soapBodyString = stringWriter.toString(); return soapBodyString.getBytes(); }
if (msg != null) { try { Node node = SAAJUtils.getBody(msg).getFirstChild(); while (node != null && !(node instanceof Element)) { node = node.getNextSibling();
s = new DOMSource(m.getSOAPPart()); } else { s = new DOMSource(SAAJUtils.getBody(m).getFirstChild());
private void addValidationReportSignature(SOAPBody soapBody, byte[] validationReportSignature) throws SOAPException { SOAPElement validationResponseElement = (SOAPElement) soapBody.getFirstChild(); validationResponseElement.addChildElement("ValidationReportSignature").setTextContent(Base64.encodeBase64String(validationReportSignature)); }
protected QName getOpQName(Exchange ex, Object data) { SOAPMessageContextImpl sm = (SOAPMessageContextImpl)data; try { SOAPMessage msg = sm.getMessage(); if (msg == null) { return null; } SOAPBody body = SAAJUtils.getBody(msg); if (body == null) { return null; } org.w3c.dom.Node nd = body.getFirstChild(); while (nd != null && !(nd instanceof org.w3c.dom.Element)) { nd = nd.getNextSibling(); } if (nd != null) { return new QName(nd.getNamespaceURI(), nd.getLocalName()); } } catch (SOAPException e) { //ignore, nothing we can do } return null; }
private QName getOperationName(MessageContext msgContext) { SOAPMessageContext soapMessageContext = (SOAPMessageContext) msgContext; SOAPMessage soapMessage = soapMessageContext.getMessage(); SOAPBody soapBody; try { soapBody = soapMessage.getSOAPBody(); Node child = soapBody.getFirstChild(); String childNamespace = child.getNamespaceURI(); String childName = child.getLocalName(); return new QName(childNamespace, childName); } catch (SOAPException e) { if(trace) log.trace("Exception using backup method to get op name=",e); } return null; } }
nd = DOMUtils.getDomElement(nd); frag.appendChild(nd); nd = SAAJUtils.getBody(soapMessage).getFirstChild();
private QName getOperationName(MessageContext msgContext) { SOAPMessageContext soapMessageContext = (SOAPMessageContext) msgContext; SOAPMessage soapMessage = soapMessageContext.getMessage(); SOAPBody soapBody; try { soapBody = soapMessage.getSOAPBody(); Node child = soapBody.getFirstChild(); String childNamespace = child.getNamespaceURI(); String childName = child.getLocalName(); return new QName(childNamespace, childName); } catch (SOAPException e) { logger.jbossWSErrorGettingOperationName(e); } return null; }
private QName getOperationName(MessageContext msgContext) { SOAPMessageContext soapMessageContext = (SOAPMessageContext) msgContext; SOAPMessage soapMessage = soapMessageContext.getMessage(); SOAPBody soapBody; try { soapBody = soapMessage.getSOAPBody(); Node child = soapBody.getFirstChild(); String childNamespace = child.getNamespaceURI(); String childName = child.getLocalName(); return new QName(childNamespace, childName); } catch (SOAPException e) { logger.jbossWSErrorGettingOperationName(e); } return null; }
public SOAPMessage invoke(SOAPMessage request) { SOAPBody body = null; try { body = SAAJUtils.getBody(request); } catch (SOAPException e) { throw new RuntimeException("soap body expected"); } if (body.getFirstChild() != null) { throw new RuntimeException("no body expected"); } return sayHiResponse; } }
/** * Extracts the name of the web service and SOAP operation from a message. * * @param context the context of the SOAP message passing through this handler */ @VisibleForTesting void captureServiceAndOperationNames(SOAPMessageContext context) { lastRequestInfo.withServiceName( ((QName) context.get(MessageContext.WSDL_SERVICE)).getLocalPart()); String lastOperationCalled; try { lastOperationCalled = context.getMessage().getSOAPBody().getFirstChild().getLocalName(); } catch (SOAPException e) { lastOperationCalled = ""; // Fail silently. The logs will be missing the operation name for this interaction. } lastRequestInfo.withMethodName(lastOperationCalled); }
/** * Extracts the name of the web service and SOAP operation from a message. * * @param context the context of the SOAP message passing through this handler */ @VisibleForTesting void captureServiceAndOperationNames(SOAPMessageContext context) { lastRequestInfo.withServiceName( ((QName) context.get(MessageContext.WSDL_SERVICE)).getLocalPart()); String lastOperationCalled; try { lastOperationCalled = context.getMessage().getSOAPBody().getFirstChild().getLocalName(); } catch (SOAPException e) { lastOperationCalled = ""; // Fail silently. The logs will be missing the operation name for this interaction. } lastRequestInfo.withMethodName(lastOperationCalled); }
responseNode = response.getSOAPBody().getFault(); else if(response.getSOAPBody().getFirstChild() == null){ // Response type is void responseNode = response.getSOAPBody(); Node serviceResponseNode = respBody.getFirstChild();
public void handleResponse(Response<SOAPMessage> response) { try { SOAPMessage reply = response.get(); replyBuffer = DOMUtils.getContent(SAAJUtils.getBody(reply).getFirstChild().getFirstChild()); } catch (Exception e) { //e.printStackTrace(); } }
public SAXSource invoke(SAXSource request) { QName qn = (QName)ctx.getMessageContext().get(MessageContext.WSDL_OPERATION); if (qn == null) { throw new RuntimeException("No Operation Name"); } SAXSource response = new SAXSource(); try { SOAPMessage msg = factory.createMessage(); msg.getSOAPPart().setContent(request); SOAPBody body = msg.getSOAPBody(); Node n = body.getFirstChild(); while (n.getNodeType() != Node.ELEMENT_NODE) { n = n.getNextSibling(); } if (n.getLocalName().equals(sayHi.getLocalPart())) { response.setInputSource(sayHiInputSource); } else if (n.getLocalName().equals(greetMe.getLocalPart())) { response.setInputSource(greetMeInputSource); } } catch (Exception ex) { ex.printStackTrace(); } return response; }
@Override public AuthOutcome handle(OnSessionCreated onCreateSession) { String header = facade.getRequest().getHeader(PAOS_HEADER); if (header != null) { return doHandle(new SamlInvocationContext(), onCreateSession); } else { try { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(null, facade.getRequest().getInputStream()); SOAPBody soapBody = soapMessage.getSOAPBody(); Node authnRequestNode = soapBody.getFirstChild(); Document document = DocumentUtil.createDocument(); document.appendChild(document.importNode(authnRequestNode, true)); String samlResponse = PostBindingUtil.base64Encode(DocumentUtil.asString(document)); return doHandle(new SamlInvocationContext(null, samlResponse, null), onCreateSession); } catch (Exception e) { throw new RuntimeException("Error creating fault message.", e); } } }