/** * Pretty print a SOAP message. * @param msg SOAPMessage to print * @param out PrintStream to print to. */ public static void prettyPrint(SOAPMessage msg, PrintStream out) { prettyPrint(msg.getSOAPPart().getDocumentElement(), out); }
/** * Pretty print a SOAP message. * @param msg SOAPMessage to print * @param out PrintStream to print to. */ public static void prettyPrint(SOAPMessage msg, PrintStream out) { prettyPrint(msg.getSOAPPart().getDocumentElement(), out); }
/** * Generate String representation of SOAP message from javax.xml.soap.SOAPMessage. * @param msg SOAPMessage to parse * @return String representation of SOAP message */ public static String soapMessageToString(SOAPMessage msg) { String str = null; if (msg != null) { try { str = XMLHelper.toPretty(msg.getSOAPPart().getDocumentElement()); } catch (Exception e) { SOAPLogger.ROOT_LOGGER.couldNotParseSOAPMessage(e); } } return str; }
/** * Generate String representation of SOAP message from javax.xml.soap.SOAPMessage. * @param msg SOAPMessage to parse * @return String representation of SOAP message */ public static String soapMessageToString(SOAPMessage msg) { String str = null; if (msg != null) { try { str = XMLHelper.toPretty(msg.getSOAPPart().getDocumentElement()); } catch (Exception e) { SOAPLogger.ROOT_LOGGER.couldNotParseSOAPMessage(e); } } return str; }
OMElement docElem = (OMElement)message.getSOAPPart().getDocumentElement(); OMAttachmentAccessor attachmentAccessor = new OMAttachmentAccessor() { @Override
/** * Convert a SAAJ message to an Axiom SOAP envelope object and process xop:Include * elements. * * @param message the SAAJ message * @return the OM SOAP envelope * @throws SOAPException */ public static org.apache.axiom.soap.SOAPEnvelope toOMSOAPEnvelope( javax.xml.soap.SOAPMessage message) throws SOAPException { Attachments attachments = new Attachments(); for (Iterator it = message.getAttachments(); it.hasNext(); ) { AttachmentPart attachment = (AttachmentPart)it.next(); String contentId = attachment.getContentId(); if (contentId != null) { DataHandler dh = attachment.getDataHandler(); if (dh == null) { throw new SOAPException("Attachment with NULL DataHandler"); } if (contentId.startsWith("<") && contentId.endsWith(">")) { contentId = contentId.substring(1, contentId.length()-1); } attachments.addDataHandler(contentId, dh); } } OMElement docElem = (OMElement)message.getSOAPPart().getDocumentElement(); MTOMStAXSOAPModelBuilder builder = new MTOMStAXSOAPModelBuilder(docElem.getXMLStreamReader(), attachments); return builder.getSOAPEnvelope(); }
Element soapEnvelope = soapMessage.getSOAPPart().getDocumentElement();
Element soapEnvelope = soapMessage.getSOAPPart().getDocumentElement();
Vector<WSEncryptionPart> signParts = new Vector<>(); SOAPConstants soapConstants = WSSecurityUtil.getSOAPConstants(soapPart .getDocumentElement()); signParts.add(new WSEncryptionPart(soapConstants.getBodyQName() .getLocalPart(), soapConstants.getEnvelopeURI(), "Content"));
Vector<WSEncryptionPart> signParts = new Vector<>(); SOAPConstants soapConstants = WSSecurityUtil.getSOAPConstants(soapPart .getDocumentElement()); signParts.add(new WSEncryptionPart(soapConstants.getBodyQName() .getLocalPart(), soapConstants.getEnvelopeURI(), "Content"));
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE); } else { envelope = SAAJUtil.toOMSOAPEnvelope(request.getSOAPPart().getDocumentElement()); if (request.countAttachments() != 0) { // SOAPMessage with attachments Attachments attachments = requestMsgCtx.getAttachmentMap();
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE); } else { envelope = SAAJUtil.toOMSOAPEnvelope(request.getSOAPPart().getDocumentElement()); if (request.countAttachments() != 0) { // SOAPMessage with attachments Attachments attachments = requestMsgCtx.getAttachmentMap();
@Test public void imageService() throws Exception { SOAPMessage response = sendMessage(); XMLAssert.assertXMLEqual(RESPONSE, XMLHelper.toString(response.getSOAPPart().getDocumentElement())); Assert.assertTrue(response.getAttachments().hasNext()); AttachmentPart attachment = (AttachmentPart)response.getAttachments().next(); Assert.assertNotNull(attachment); Assert.assertEquals("image/jpeg", attachment.getContentType()); /* this assertion appears to be platform-dependent Assert.assertEquals(16384, attachment.getSize()); */ }
signParts.add(new WSEncryptionPart(wsSecTimeStamp.getId())); SOAPConstants soapConstants = WSSecurityUtil .getSOAPConstants(soapPart.getDocumentElement()); signParts.add(new WSEncryptionPart(soapConstants.getBodyQName() .getLocalPart(), soapConstants.getEnvelopeURI(),
return DomHelper.toXml(soapRequest.getSOAPPart().getDocumentElement());