List of usage examples for javax.xml.soap SOAPMessage writeTo
public abstract void writeTo(OutputStream out) throws SOAPException, IOException;
From source file:be.fedict.trust.xkms2.LoggingSoapHandler.java
public boolean handleFault(SOAPMessageContext context) { Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); LOG.debug("outbound message: " + outboundProperty); SOAPMessage soapMessage = context.getMessage(); ByteArrayOutputStream output = new ByteArrayOutputStream(); try {//from ww w. ja va 2 s .com soapMessage.writeTo(output); } catch (Exception e) { LOG.error("SOAP error: " + e.getMessage()); } LOG.debug("SOAP message: " + output.toString()); return true; }
From source file:com.wavemaker.runtime.ws.jaxws.SOAPLoggingHandler.java
private void log(SOAPMessageContext context) { Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); String messageText;//from w w w . jav a2 s. c om if (outboundProperty.booleanValue()) { messageText = "Outbound SOAP message:\n"; } else { messageText = "Inbound SOAP message:\n"; } SOAPMessage message = context.getMessage(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); message.writeTo(baos); log.debug(messageText + baos.toString()); baos.close(); } catch (Exception e) { log.error(e); } }
From source file:be.agiv.security.handler.LoggingHandler.java
public boolean handleFault(SOAPMessageContext context) { if (false == LOG.isDebugEnabled()) { return true; }// ww w. j a v a 2 s .co m SOAPMessage soapMessage = context.getMessage(); ByteArrayOutputStream output = new ByteArrayOutputStream(); try { soapMessage.writeTo(output); } catch (Exception e) { LOG.error("SOAP error: " + e.getMessage()); } String outputStr = output.toString(); LOG.debug("SOAP fault: " + outputStr); return true; }
From source file:be.fedict.eid.idp.sp.protocol.ws_federation.sts.LoggingSoapHandler.java
public boolean handleFault(SOAPMessageContext context) { if (false == LOG.isDebugEnabled()) { return true; }/* www . j ava2s. c o m*/ Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); LOG.debug("outbound message: " + outboundProperty); SOAPMessage soapMessage = context.getMessage(); ByteArrayOutputStream output = new ByteArrayOutputStream(); try { soapMessage.writeTo(output); } catch (Exception e) { LOG.error("SOAP error: " + e.getMessage()); } LOG.debug("SOAP fault: " + output.toString()); return true; }
From source file:be.agiv.security.handler.LoggingHandler.java
public boolean handleMessage(SOAPMessageContext context) { if (false == LOG.isDebugEnabled()) { return true; }/*from ww w . j a va 2s .c o m*/ Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); LOG.debug("outbound message: " + outboundProperty); SOAPMessage soapMessage = context.getMessage(); ByteArrayOutputStream output = new ByteArrayOutputStream(); try { soapMessage.writeTo(output); } catch (Exception e) { LOG.error("SOAP error: " + e.getMessage()); } String outputStr = output.toString(); LOG.debug("SOAP message: " + outputStr); return true; }
From source file:be.fedict.eid.idp.sp.protocol.ws_federation.sts.LoggingSoapHandler.java
public boolean handleMessage(SOAPMessageContext context) { if (false == LOG.isDebugEnabled()) { return true; }/*from w w w . j a v a 2s . co m*/ LOG.debug("handle message"); Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); LOG.debug("outbound message: " + outboundProperty); SOAPMessage soapMessage = context.getMessage(); ByteArrayOutputStream output = new ByteArrayOutputStream(); try { soapMessage.writeTo(output); } catch (Exception e) { LOG.error("SOAP error: " + e.getMessage()); } LOG.debug("SOAP message: " + output.toString()); return true; }
From source file:be.e_contract.dssp.client.LoggingSOAPHandler.java
private void logMessage(SOAPMessageContext context) { Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); LOG.debug("outbound message: " + outboundProperty); SOAPMessage soapMessage = context.getMessage(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try {/*from www . ja va 2 s . co m*/ soapMessage.writeTo(outputStream); } catch (Exception e) { LOG.error("SOAP error: " + e.getMessage()); } String message = outputStream.toString(); LOG.debug("SOAP message: " + message); if (false == outboundProperty) { Map<String, DataHandler> inboundMessageAttachments = (Map<String, DataHandler>) context .get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS); Set<String> attachmentContentIds = inboundMessageAttachments.keySet(); LOG.debug("attachment content ids: " + attachmentContentIds); } }
From source file:be.e_contract.mycarenet.common.LoggingHandler.java
private void logMessage(SOAPMessageContext context) { Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); LOG.debug("outbound message: " + outboundProperty); SOAPMessage soapMessage = context.getMessage(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try {// w w w. j a v a 2 s. c o m soapMessage.writeTo(outputStream); } catch (Exception e) { LOG.error("SOAP error: " + e.getMessage()); } String message = outputStream.toString(); LOG.debug("SOAP message: " + message); if (false == outboundProperty) { @SuppressWarnings("unchecked") Map<String, DataHandler> inboundMessageAttachments = (Map<String, DataHandler>) context .get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS); Set<String> attachmentContentIds = inboundMessageAttachments.keySet(); LOG.debug("attachment content ids: " + attachmentContentIds); } }
From source file:com.github.thesmartenergy.cnr.SmartChargingProvider.java
@Override public void create(ProcessExecution processExecution) throws PEPException { super.create(processExecution); String id = processExecution.getId(); Model input = processExecution.getInput(); try {// ww w . j a va 2s . c om // get XML document ByteArrayOutputStream out = new ByteArrayOutputStream(); try { ResourceDescription presentation = new ResourceDescription(DEV_BASE + "inputGraph"); PresentationUtils presentationUtils = new PresentationUtils(); STTLHandler lowerer = new STTLHandler(BASE, presentationUtils); lowerer.lower(input, out, MediaType.APPLICATION_XML_TYPE, presentation); } catch (RDFPException ex) { throw new PEPException("Error while lowering input", ex); } String xml = new String(out.toByteArray(), "UTF-8"); GetChargingPlans getChargingPlans = JAXB.unmarshal(xml, GetChargingPlans.class); LOG.info("sending message: " + xml); // embed value in a SOAP envelope SOAPMessage soapMessage = createSoapMessage(getChargingPlans); out = new ByteArrayOutputStream(); soapMessage.writeTo(out); InputStream in = new ByteArrayInputStream(out.toByteArray()); String string = IOUtils.toString(in, Charset.forName("UTF-8")); LOG.info("sending message: " + string); BrokeredMessage message = new BrokeredMessage(string); message.setMessageId(id); service.sendQueueMessage(queue, message); } catch (ServiceException | SOAPException | IOException ex) { throw new PEPException(ex); } }
From source file:net.bpelunit.test.unit.TestSOAPEncoder.java
private String toString(SOAPMessage message) throws SOAPException, IOException { StringOutputStream sos = new StringOutputStream(); message.writeTo(sos); return sos.getString(); }