List of usage examples for javax.xml.ws.handler.soap SOAPMessageContext get
V get(Object key);
From source file:be.fedict.hsm.ws.impl.WSSecuritySOAPHandler.java
public static X509Certificate getAuthenticatedCertificate(SOAPMessageContext context) { return (X509Certificate) context.get(X509_ATTRIBUTE); }
From source file:be.agiv.security.handler.WSAddressingHandler.java
/** * Gives back the u:Id attribute value of the WS-Addressing To element. * /* w w w . java 2 s .c o m*/ * @param context * the JAX-WS SOAP message context. * @return the Id attribute value of the To element. */ public static String getToIdentifier(SOAPMessageContext context) { return (String) context.get(TO_ID_CONTEXT_ATTRIBUTE); }
From source file:it.govpay.web.handler.MessageLoggingHandlerUtils.java
@SuppressWarnings("unchecked") public static boolean logToSystemOut(SOAPMessageContext smc, String tipoServizio, int versioneServizio, Logger log) {// w w w.j a va 2 s . c o m Boolean outboundProperty = (Boolean) smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); GpContext ctx = null; Message msg = new Message(); SOAPMessage message = smc.getMessage(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { message.writeTo(baos); msg.setContent(baos.toByteArray()); } catch (Exception e) { log.error("Exception in handler: " + e); } Map<String, List<String>> httpHeaders = null; if (outboundProperty.booleanValue()) { ctx = GpThreadLocal.get(); httpHeaders = (Map<String, List<String>>) smc.get(MessageContext.HTTP_RESPONSE_HEADERS); msg.setType(MessageType.RESPONSE_OUT); ctx.getContext().getResponse().setOutDate(new Date()); ctx.getContext().getResponse().setOutSize(Long.valueOf(baos.size())); } else { try { ctx = new GpContext(smc, tipoServizio, versioneServizio); ThreadContext.put("op", ctx.getTransactionId()); GpThreadLocal.set(ctx); } catch (Exception e) { log.error(e.getMessage(), e); return false; } httpHeaders = (Map<String, List<String>>) smc.get(MessageContext.HTTP_REQUEST_HEADERS); msg.setType(MessageType.REQUEST_IN); msg.setContentType(((HttpServletRequest) smc.get(MessageContext.SERVLET_REQUEST)).getContentType()); ctx.getContext().getRequest().setInDate(new Date()); ctx.getContext().getRequest().setInSize(Long.valueOf(baos.size())); } if (httpHeaders != null) { for (String key : httpHeaders.keySet()) { if (httpHeaders.get(key) != null) { if (key == null) msg.addHeader(new Property("Status-line", httpHeaders.get(key).get(0))); else if (httpHeaders.get(key).size() == 1) msg.addHeader(new Property(key, httpHeaders.get(key).get(0))); else msg.addHeader(new Property(key, ArrayUtils.toString(httpHeaders.get(key)))); } } } ctx.log(msg); return true; }
From source file:ebay.dts.client.LoggingHandler.java
private void log(SOAPMessageContext messageContext) { boolean request = ((Boolean) messageContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)).booleanValue(); SOAPMessage meg = messageContext.getMessage(); ByteArrayOutputStream out = new ByteArrayOutputStream(); try {/*from w w w . j a v a 2 s . c o m*/ meg.writeTo(out); } catch (Exception e) { } if (request) { logger.trace("SOAP Request message: " + new String(out.toByteArray())); } else { logger.trace("SOAP Response message: " + new String(out.toByteArray())); } }
From source file:be.fedict.hsm.ws.impl.LoggingSOAPHandler.java
@Override public boolean handleMessage(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 {/*w w w . ja va2 s . c om*/ soapMessage.writeTo(output); } catch (Exception e) { LOG.error("SOAP error: " + e.getMessage()); } LOG.debug("SOAP message: " + output.toString()); return true; }
From source file:be.fedict.hsm.ws.impl.LoggingSOAPHandler.java
@Override 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 {/*w w w. j av a2 s . c om*/ soapMessage.writeTo(output); } catch (Exception e) { LOG.error("SOAP error: " + e.getMessage()); } LOG.debug("SOAP fault: " + output.toString()); return true; }
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 {/* w w w. j a va2 s.c o m*/ 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 www.j a va 2 s .c o m*/ 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:com.konakart.bl.modules.ordertotal.thomson.HeaderLoggingHandler.java
public boolean handleMessage(SOAPMessageContext smc) { Boolean outboundProperty = (Boolean) smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); logSoapMsg(smc);//from w w w. j a v a 2 s . co m return outboundProperty; }
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 ww w. j av a2 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); } }