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);
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 void logMessage(SOAPMessageContext ctx) { String action = getWsaHeader(ctx, "Action", "noAction"); FileOutputStream out = null; try { String msgID = ((Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)) ? getWsaHeader(ctx, "MessageID", null) : getWsaHeader(ctx, "RelatesTo", null); File f = getLogFile(action, msgID); if (f != null) { f.getParentFile().mkdirs(); log.info("sent SOAP message saved to file "+f); out = new FileOutputStream(f); Source s = ctx.getMessage().getSOAPPart().getContent(); Transformer t = TransformerFactory.newInstance().newTransformer(); t.setOutputProperty("indent", "yes"); t.transform(s, new StreamResult(out)); } } catch (Exception x) { log.error("Error logging sent SOAP message to file!", x); } finally { if (out != null) try { out.close(); } catch (IOException ignore) {} } }
public RequestInfo.Builder parseMessage(RequestInfo.Builder builder, SOAPMessage soapMessage) { Preconditions.checkNotNull(builder, "Null builder"); Transformer transformer = transformerSupplier.get(); if (soapMessage == null || soapMessage.getSOAPPart() == null || transformer == null) { return builder; } try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { // Some SOAP frameworks don't include SOAP headers when calling SOAPMessage.writeTo. // Use an XML transformer to write the XML content instead. transformer.transform(soapMessage.getSOAPPart().getContent(), new StreamResult(outputStream)); builder.withPayload(outputStream.toString(StandardCharsets.UTF_8.name())); } catch (TransformerException | SOAPException | IOException e) { builder.withPayload("Unable to read request content due to exception: " + e); libLogger.warn("Unable to read request content due to exception.", e); } try { SOAPHeader soapHeader = soapMessage.getSOAPHeader(); builder.withContext(contextName, nodeExtractor.extractNodeValue(soapHeader, contextXPath)); } catch (SOAPException e) { builder.withContext( contextName, "Unable to extract " + contextName + " from request due to exception: " + e); } return builder; } }
public RequestInfo.Builder parseMessage(RequestInfo.Builder builder, SOAPMessage soapMessage) { Preconditions.checkNotNull(builder, "Null builder"); Transformer transformer = transformerSupplier.get(); if (soapMessage == null || soapMessage.getSOAPPart() == null || transformer == null) { return builder; } try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { // Some SOAP frameworks don't include SOAP headers when calling SOAPMessage.writeTo. // Use an XML transformer to write the XML content instead. transformer.transform(soapMessage.getSOAPPart().getContent(), new StreamResult(outputStream)); builder.withPayload(outputStream.toString(StandardCharsets.UTF_8.name())); } catch (TransformerException | SOAPException | IOException e) { builder.withPayload("Unable to read request content due to exception: " + e); libLogger.warn("Unable to read request content due to exception.", e); } try { SOAPHeader soapHeader = soapMessage.getSOAPHeader(); builder.withContext(contextName, nodeExtractor.extractNodeValue(soapHeader, contextXPath)); } catch (SOAPException e) { builder.withContext( contextName, "Unable to extract " + contextName + " from request due to exception: " + e); } return builder; } }
Source src = sp.getContent();
Source msgSource = secureMessage.getSOAPPart().getContent(); transformer.transform(msgSource, new StreamResult(out));
Source sc = rp.getSOAPPart().getContent();
Source s = ctx.getMessage().getSOAPPart().getContent(); Transformer t = TransformerFactory.newInstance().newTransformer(); t.setOutputProperty("indent", "yes");
ctx.getMessage().writeTo(out); } else { Source s = ctx.getMessage().getSOAPPart().getContent(); Transformer t = TransformerFactory.newInstance().newTransformer(); t.setOutputProperty("indent", "yes");
private Path writeToFile(Path parent) { Path path = parent.resolve(input.file); try { Source sc; if (xsdDefinition.isWsdl()) { SOAPMessage soapMessage = MessageFactory.newInstance().createMessage(); soapMessage.getSOAPBody().addDocument(document); soapMessage.getSOAPPart().getEnvelope().removeNamespaceDeclaration("SOAP-ENV"); soapMessage.getSOAPPart().getEnvelope().addNamespaceDeclaration("soap", "http://schemas.xmlsoap.org/soap/envelope/"); soapMessage.getSOAPPart().getEnvelope().setPrefix("soap"); soapMessage.getSOAPHeader().setPrefix("soap"); soapMessage.getSOAPBody().setPrefix("soap"); sc = soapMessage.getSOAPPart().getContent(); } else { sc = new DOMSource(document); } try (BufferedWriter writer = Files.newBufferedWriter(path)) { TransformerFactory tf = TransformerFactory.newInstance(); Transformer t = tf.newTransformer(); t.setOutputProperty(OutputKeys.INDENT, "yes"); t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); t.transform(sc, new StreamResult(writer)); } catch (Exception ex) { throw new RuntimeException("Error write XML ", ex); } } catch (Exception exx) { throw new RuntimeException(exx); } return path; }
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);
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);
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);
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);
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);
public void handleMessage(Message message) { LOG.entering(getClass().getName(), "handleMessage"); // Capturing the soap envelope. In case of WSS was activated, decrypted envelope is captured. if (!MessageUtils.getContextualBoolean(message, Message.ROBUST_ONEWAY, false) && isApplicationMessage(message) && (getManager().getStore() != null || (getManager().getDestinationPolicy() != null && getManager() .getDestinationPolicy().getRetryPolicy() != null))) { CachedOutputStream saved = new CachedOutputStream(); SOAPMessage soapMessage = message.getContent(SOAPMessage.class); if (soapMessage != null) { try { javax.xml.transform.Source envelope = soapMessage.getSOAPPart().getContent(); StaxUtils.copy(envelope, saved); saved.flush(); // create a new source part from cos InputStream is = saved.getInputStream(); // close old saved content closeOldSavedContent(message); // keep References to clean-up tmp files in RMDeliveryInterceptor setCloseable(message, saved, is); StreamSource source = new StreamSource(is); soapMessage.getSOAPPart().setContent(source); // when WSS was activated, saved content still contains soap headers to be removed message.put(RMMessageConstants.SAVED_CONTENT, removeUnnecessarySoapHeaders(saved)); } catch (SOAPException | IOException | XMLStreamException e) { throw new Fault(e); } } } }