Refine search
MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.addNamespaceDeclaration("example", serverURI); SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyElem = soapBody.addChildElement("VerifyEmail", "example"); SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("email", "example"); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); Source sourceContent = soapResponse.getSOAPPart().getContent(); System.out.print("\nResponse SOAP Message = "); StreamResult result = new StreamResult(System.out);
SOAPEnvelope envelope = smc.getMessage().getSOAPPart().getEnvelope(); SOAPHeader header = envelope.addHeader();
/** * Gets the SOAP Body contained in this <code>SOAPMessage</code> object. * * @return the <code>SOAPBody</code> object contained by this <code>SOAPMessage</code> object * @throws javax.xml.soap.SOAPException if the SOAP Body does not exist or cannot be retrieved */ public SOAPBody getSOAPBody() throws SOAPException { return this.soapPart.getEnvelope().getBody(); }
MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.addNamespaceDeclaration("example", serverURI); SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyElem = soapBody.addChildElement("VerifyEmail", "example"); SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("email", "example"); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); Source sourceContent = soapResponse.getSOAPPart().getContent(); System.out.print("\nResponse SOAP Message = "); StreamResult result = new StreamResult(System.out);
private SOAPMessage initSOAPMessage(InputStream is) throws SOAPException, IOException { SOAPMessage msg = null; if (is != null) { msg = SAAJFactoryResolver.createMessageFactory(null).createMessage(null, is); } else { msg = SAAJFactoryResolver.createMessageFactory(null).createMessage(); } msg.setProperty(SOAPMessage.WRITE_XML_DECLARATION, "true"); msg.getSOAPPart().getEnvelope().addNamespaceDeclaration(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NS_SCHEMA_XSD); msg.getSOAPPart().getEnvelope().addNamespaceDeclaration(WSDLConstants.NP_SCHEMA_XSI, WSDLConstants.NS_SCHEMA_XSI); return msg; } }
/** * Gets the SOAP Body contained in this <code>SOAPMessage</code> object. * * @return the <code>SOAPBody</code> object contained by this <code>SOAPMessage</code> object * @throws javax.xml.soap.SOAPException if the SOAP Body does not exist or cannot be retrieved */ public SOAPBody getSOAPBody() throws SOAPException { return this.soapPart.getEnvelope().getBody(); }
MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.addNamespaceDeclaration("example", serverURI); SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyElem = soapBody.addChildElement("VerifyEmail", "example"); SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("email", "example");
public Object[] getHeaders(QName name, JAXBContext context, boolean allRoles) { SOAPMessage msg = getMessage(); SOAPHeader header; try { header = msg.getSOAPPart().getEnvelope().getHeader(); if (header == null || !header.hasChildNodes()) { return new Object[0]; } List<Object> ret = new ArrayList<>(); Iterator<SOAPHeaderElement> it = CastUtils.cast(header.examineAllHeaderElements()); while (it.hasNext()) { SOAPHeaderElement she = it.next(); if ((allRoles || roles.contains(she.getActor())) && name.equals(she.getElementQName())) { ret.add(JAXBUtils.unmarshall(context, she)); } } return ret.toArray(new Object[0]); } catch (SOAPException | JAXBException e) { throw new WebServiceException(e); } }
public SOAPBody getSOAPBody() throws SOAPException { SOAPPart soapPart = getSOAPPart(); if (soapPart != null) { SOAPEnvelope soapEnvelope = soapPart.getEnvelope(); if (soapEnvelope != null) { SOAPBody soapBody = soapEnvelope.getBody(); return soapBody; } } throw new SOAPException(BundleUtils.getMessage(bundle, "CANNOT_OBTAIN_SOAPBODY")); }
private XMLStreamReader createXMLStreamReaderFromSOAPMessage(SOAPMessage soapMessage) { // responseMsg.setContent(SOAPMessage.class, soapMessage); XMLStreamReader xmlReader = null; try { DOMSource bodySource = new DOMSource(soapMessage.getSOAPPart().getEnvelope().getBody()); xmlReader = StaxUtils.createXMLStreamReader(bodySource); xmlReader.nextTag(); xmlReader.nextTag(); // move past body tag } catch (SOAPException | XMLStreamException e) { e.printStackTrace(); } return xmlReader; }
/** Returns the envelope of the given message. */ @Override public SOAPEnvelope getEnvelope(SOAPMessage message) throws SOAPException { return message.getSOAPPart().getEnvelope(); }
private XMLStreamReader createXMLStreamReaderFromSOAPMessage(SOAPMessage soapMessage) { // responseMsg.setContent(SOAPMessage.class, soapMessage); XMLStreamReader xmlReader = null; try { DOMSource bodySource = new DOMSource(soapMessage.getSOAPPart().getEnvelope().getBody()); xmlReader = StaxUtils.createXMLStreamReader(bodySource); xmlReader.nextTag(); xmlReader.nextTag(); // move past body tag } catch (SOAPException | XMLStreamException e) { e.printStackTrace(); } return xmlReader; }
@Override public SOAPEnvelope getEnvelope(SOAPMessage message) throws SOAPException { return message.getSOAPPart().getEnvelope(); }
if (isRequestor(message) && msg.getSOAPPart().getEnvelope().getBody() != null && msg.getSOAPPart().getEnvelope().getBody().hasFault()) { return null;
@Override public SOAPEnvelope getEnvelope(SOAPMessage message) throws SOAPException { return message.getSOAPPart().getEnvelope(); }
.getSOAPPart().getEnvelope().getBody().addFault(); } catch (Throwable t2) {
/** * Determines if the envelope is SOAP 1.1 or 1.2. * * @param soapMessage The SOAPMessage * @return The true if envelope is SOAP 1.2 * @throws SOAPException If the envelope could not be read */ public static Boolean isSOAP12(SOAPMessage soapMessage) throws SOAPException { return soapMessage.getSOAPPart().getEnvelope().getNamespaceURI().equals(SOAP12_URI); }
SOAPBody body = originalMsg.getSOAPPart().getEnvelope().getBody(); body.removeContents(); soapFault.setFaultActor(sf.getFault().getFaultActor()); if (sf.getFault().hasDetail()) { Node nd = originalMsg.getSOAPPart().importNode( sf.getFault().getDetail() .getFirstChild(), true); if (sf.hasDetails()) { soapFault.addDetail(); Node nd = originalMsg.getSOAPPart().importNode(sf.getDetail(), true); nd = nd.getFirstChild(); while (nd != null) {
public SOAPParser(SOAPMessage message) { try { soapMessage = message; soapHeader = message.getSOAPPart().getEnvelope().getHeader(); } catch (SOAPException e) { logger.error("SOAPParser() failed", e); } }
public static SOAPBody getBody(SOAPMessage m) throws SOAPException { try { return m.getSOAPBody(); } catch (UnsupportedOperationException ex) { return m.getSOAPPart().getEnvelope().getBody(); } catch (IllegalArgumentException ex) { //java9 return null; } } public static void setFaultCode(SOAPFault f, QName code) throws SOAPException {