List of usage examples for javax.xml.ws.handler.soap SOAPMessageContext get
V get(Object key);
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 {/*from www . ja va 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:be.fedict.eid.dss.ws.LoggingSoapHandler.java
public boolean handleMessage(SOAPMessageContext context) { 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 {/*w ww . ja v a2s . 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:be.fedict.hsm.ws.impl.JAASSOAPHandler.java
@Override public boolean handleFault(SOAPMessageContext context) { Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (outboundProperty) { try {/* w w w. ja v a 2s . c om*/ logout(context); } catch (LoginException e) { this.securityAuditGeneratorBean.webServiceAuthenticationError(); throw new ProtocolException("JAAS logout error: " + e.getMessage(), e); } } return true; }
From source file:be.fedict.hsm.ws.impl.JAASSOAPHandler.java
@Override public boolean handleMessage(SOAPMessageContext context) { Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (false == outboundProperty) { try {/*from w w w. java2 s. c o m*/ login(context); } catch (Exception e) { this.securityAuditGeneratorBean.webServiceAuthenticationError(); throw new ProtocolException("JAAS login error: " + e.getMessage(), e); } } else { try { logout(context); } catch (LoginException e) { this.securityAuditGeneratorBean.webServiceAuthenticationError(); throw new ProtocolException("JAAS logout error: " + e.getMessage(), e); } } return true; }
From source file:cn.com.ttblog.ssmbootstrap_table.webservice.LicenseHandler.java
@SuppressWarnings("unchecked") @Override//from w w w .j a v a2 s. c om public boolean handleMessage(SOAPMessageContext context) { try { Boolean out = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); logger.debug("LicenseHandler:{}", out); if (!out) { SOAPMessage message = context.getMessage(); logger.debug("SOAPMessage:{}", ToStringBuilder.reflectionToString(message)); SOAPEnvelope enve = message.getSOAPPart().getEnvelope(); SOAPHeader header = enve.getHeader(); SOAPBody body = enve.getBody(); Node bn = body.getChildNodes().item(0); String partname = bn.getLocalName(); if ("getUser".equals(partname)) { if (header == null) { // ? SOAPFault fault = body.addFault(); fault.setFaultString("??!"); throw new SOAPFaultException(fault); } Iterator<SOAPHeaderElement> iterator = header.extractAllHeaderElements(); if (!iterator.hasNext()) { // ? SOAPFault fault = body.addFault(); fault.setFaultString("??!"); throw new SOAPFaultException(fault); } while (iterator.hasNext()) { SOAPHeaderElement ele = iterator.next(); System.out.println(ele.getTextContent()); } } } } catch (SOAPException e) { e.printStackTrace(); } return true; }
From source file:be.agiv.security.handler.SecureConversationHandler.java
private void handleOutboundMessage(SOAPMessageContext context) { String location = (String) context.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY); LOG.debug("location: " + location); String serviceRealm;//w w w. j a v a 2 s.co m if (null != this.serviceRealm) { serviceRealm = this.serviceRealm; } else { serviceRealm = location; } LOG.debug("service realm: " + serviceRealm); SecurityToken secureConversationToken = this.securityTokenProvider.getSecureConversationToken(location, serviceRealm); this.wsSecurityHandler.setKey(secureConversationToken.getKey(), secureConversationToken.getAttachedReference(), secureConversationToken.getToken(), false); }
From source file:be.agiv.security.handler.AuthenticationHandler.java
public boolean handleMessage(SOAPMessageContext context) { Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (true == outboundProperty.booleanValue()) { try {//from w w w . j a v a 2s .co m handleOutboundMessage(context); } catch (Exception e) { throw new ProtocolException(e); } } return true; }
From source file:be.fedict.hsm.client.WSSecuritySOAPHandler.java
@Override public boolean handleMessage(SOAPMessageContext context) { Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (true == outboundProperty.booleanValue()) { try {//from ww w. j av a 2 s . co m handleOutboundMessage(context); } catch (Exception e) { throw new ProtocolException(e); } } return true; }
From source file:be.fedict.eid.dss.client.LoggingSoapHandler.java
public boolean handleMessage(SOAPMessageContext context) { 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 {/*from w w w . ja v a 2 s.c o m*/ if (this.logToFile) { File tmpFile = File.createTempFile( "eid-dss-soap-" + (outboundProperty ? "outbound" : "inbound") + "-", ".xml"); FileOutputStream fileOutputStream = new FileOutputStream(tmpFile); soapMessage.writeTo(fileOutputStream); fileOutputStream.close(); LOG.debug("tmp file: " + tmpFile.getAbsolutePath()); } 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.mycarenet.async.SecuritySOAPHandler.java
@Override public boolean handleMessage(SOAPMessageContext context) { Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (false == outboundProperty) { return true; }//from w ww . ja v a2s . co m try { handleOutboundMessage(context); } catch (Exception e) { LOG.error("outbound exception: " + e.getMessage(), e); throw new ProtocolException(e); } return true; }