@Override public Document getDocument() { Assert.state(messageFactory != null, "Could find message factory to use"); // return saajSoapMessage.getSaajMessage().getSOAPPart(); // does not work, see SWS-345 try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); getSaajMessage().writeTo(bos); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); SOAPMessage saajMessage = messageFactory.createMessage(getSaajMessage().getMimeHeaders(), bis); setSaajMessage(saajMessage); return saajMessage.getSOAPPart(); } catch (SOAPException ex) { throw new SaajSoapMessageException("Could not save changes", ex); } catch (IOException ex) { throw new SaajSoapMessageException("Could not save changes", ex); } }
public Document getDocument() { Assert.state(messageFactory != null, "Could find message factory to use"); // return saajSoapMessage.getSaajMessage().getSOAPPart(); // does not work, see SWS-345 try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); getSaajMessage().writeTo(bos); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); SOAPMessage saajMessage = messageFactory.createMessage(getSaajMessage().getMimeHeaders(), bis); setSaajMessage(saajMessage); return saajMessage.getSOAPPart(); } catch (SOAPException ex) { throw new SaajSoapMessageException("Could not save changes", ex); } catch (IOException ex) { throw new SaajSoapMessageException("Could not save changes", ex); } }
@Override public Document getDocument() { Assert.state(messageFactory != null, "Could find message factory to use"); // return saajSoapMessage.getSaajMessage().getSOAPPart(); // does not work, see SWS-345 try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); getSaajMessage().writeTo(bos); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); SOAPMessage saajMessage = messageFactory.createMessage(getSaajMessage().getMimeHeaders(), bis); setSaajMessage(saajMessage); return saajMessage.getSOAPPart(); } catch (SOAPException ex) { throw new SaajSoapMessageException("Could not save changes", ex); } catch (IOException ex) { throw new SaajSoapMessageException("Could not save changes", ex); } }
@Override public Document getDocument() { Assert.state(messageFactory != null, "Could find message factory to use"); // return saajSoapMessage.getSaajMessage().getSOAPPart(); // does not work, see SWS-345 try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); getSaajMessage().writeTo(bos); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); SOAPMessage saajMessage = messageFactory.createMessage(getSaajMessage().getMimeHeaders(), bis); setSaajMessage(saajMessage); return saajMessage.getSOAPPart(); } catch (SOAPException ex) { throw new SaajSoapMessageException("Could not save changes", ex); } catch (IOException ex) { throw new SaajSoapMessageException("Could not save changes", ex); } }
/** * Secures the given SoapMessage message in accordance with the defined security policy. * * @param soapMessage the message to be secured * @throws XwsSecuritySecurementException in case of errors * @throws IllegalArgumentException when soapMessage is not a {@code SaajSoapMessage} */ @Override protected void secureMessage(SoapMessage soapMessage, MessageContext messageContext) throws XwsSecuritySecurementException { Assert.isTrue(soapMessage instanceof SaajSoapMessage, "XwsSecurityInterceptor requires a SaajSoapMessage. " + "Use a SaajSoapMessageFactory to create the SOAP messages."); SaajSoapMessage saajSoapMessage = (SaajSoapMessage) soapMessage; try { ProcessingContext context = processor.createProcessingContext(saajSoapMessage.getSaajMessage()); SOAPMessage result = processor.secureOutboundMessage(context); saajSoapMessage.setSaajMessage(result); } catch (XWSSecurityException ex) { throw new XwsSecuritySecurementException(ex.getMessage(), ex); } catch (WssSoapFaultException ex) { throw new XwsSecurityFaultException(ex.getFaultCode(), ex.getFaultString(), ex.getFaultActor()); } }
/** * Secures the given SoapMessage message in accordance with the defined security policy. * * @param soapMessage the message to be secured * @throws XwsSecuritySecurementException in case of errors * @throws IllegalArgumentException when soapMessage is not a {@code SaajSoapMessage} */ @Override protected void secureMessage(SoapMessage soapMessage, MessageContext messageContext) throws XwsSecuritySecurementException { Assert.isTrue(soapMessage instanceof SaajSoapMessage, "XwsSecurityInterceptor requires a SaajSoapMessage. " + "Use a SaajSoapMessageFactory to create the SOAP messages."); SaajSoapMessage saajSoapMessage = (SaajSoapMessage) soapMessage; try { ProcessingContext context = processor.createProcessingContext(saajSoapMessage.getSaajMessage()); SOAPMessage result = processor.secureOutboundMessage(context); saajSoapMessage.setSaajMessage(result); } catch (XWSSecurityException ex) { throw new XwsSecuritySecurementException(ex.getMessage(), ex); } catch (WssSoapFaultException ex) { throw new XwsSecurityFaultException(ex.getFaultCode(), ex.getFaultString(), ex.getFaultActor()); } }
/** * Validates the given SoapMessage message in accordance with the defined security policy. * * @param soapMessage the message to be validated * @throws XwsSecurityValidationException in case of errors * @throws IllegalArgumentException when soapMessage is not a {@code SaajSoapMessage} */ @Override protected void validateMessage(SoapMessage soapMessage, MessageContext messageContext) throws WsSecurityValidationException { Assert.isTrue(soapMessage instanceof SaajSoapMessage, "XwsSecurityInterceptor requires a SaajSoapMessage. " + "Use a SaajSoapMessageFactory to create the SOAP messages."); SaajSoapMessage saajSoapMessage = (SaajSoapMessage) soapMessage; try { ProcessingContext context = processor.createProcessingContext(saajSoapMessage.getSaajMessage()); SOAPMessage result = processor.verifyInboundMessage(context); saajSoapMessage.setSaajMessage(result); } catch (XWSSecurityException ex) { throw new XwsSecurityValidationException(ex.getMessage(), ex); } catch (WssSoapFaultException ex) { throw new XwsSecurityFaultException(ex.getFaultCode(), ex.getFaultString(), ex.getFaultActor()); } }
/** * Validates the given SoapMessage message in accordance with the defined security policy. * * @param soapMessage the message to be validated * @throws XwsSecurityValidationException in case of errors * @throws IllegalArgumentException when soapMessage is not a {@code SaajSoapMessage} */ @Override protected void validateMessage(SoapMessage soapMessage, MessageContext messageContext) throws WsSecurityValidationException { Assert.isTrue(soapMessage instanceof SaajSoapMessage, "XwsSecurityInterceptor requires a SaajSoapMessage. " + "Use a SaajSoapMessageFactory to create the SOAP messages."); SaajSoapMessage saajSoapMessage = (SaajSoapMessage) soapMessage; try { ProcessingContext context = processor.createProcessingContext(saajSoapMessage.getSaajMessage()); SOAPMessage result = processor.verifyInboundMessage(context); saajSoapMessage.setSaajMessage(result); } catch (XWSSecurityException ex) { throw new XwsSecurityValidationException(ex.getMessage(), ex); } catch (WssSoapFaultException ex) { throw new XwsSecurityFaultException(ex.getFaultCode(), ex.getFaultString(), ex.getFaultActor()); } }
/** * Validates the given SoapMessage message in accordance with the defined security policy. * * @param soapMessage the message to be validated * @throws XwsSecurityValidationException in case of errors * @throws IllegalArgumentException when soapMessage is not a {@code SaajSoapMessage} */ @Override protected void validateMessage(SoapMessage soapMessage, MessageContext messageContext) throws WsSecurityValidationException { Assert.isTrue(soapMessage instanceof SaajSoapMessage, "XwsSecurityInterceptor requires a SaajSoapMessage. " + "Use a SaajSoapMessageFactory to create the SOAP messages."); SaajSoapMessage saajSoapMessage = (SaajSoapMessage) soapMessage; try { ProcessingContext context = processor.createProcessingContext(saajSoapMessage.getSaajMessage()); SOAPMessage result = processor.verifyInboundMessage(context); saajSoapMessage.setSaajMessage(result); } catch (XWSSecurityException ex) { throw new XwsSecurityValidationException(ex.getMessage(), ex); } catch (WssSoapFaultException ex) { throw new XwsSecurityFaultException(ex.getFaultCode(), ex.getFaultString(), ex.getFaultActor()); } }
/** * Secures the given SoapMessage message in accordance with the defined security policy. * * @param soapMessage the message to be secured * @throws XwsSecuritySecurementException in case of errors * @throws IllegalArgumentException when soapMessage is not a {@code SaajSoapMessage} */ @Override protected void secureMessage(SoapMessage soapMessage, MessageContext messageContext) throws XwsSecuritySecurementException { Assert.isTrue(soapMessage instanceof SaajSoapMessage, "XwsSecurityInterceptor requires a SaajSoapMessage. " + "Use a SaajSoapMessageFactory to create the SOAP messages."); SaajSoapMessage saajSoapMessage = (SaajSoapMessage) soapMessage; try { ProcessingContext context = processor.createProcessingContext(saajSoapMessage.getSaajMessage()); SOAPMessage result = processor.secureOutboundMessage(context); saajSoapMessage.setSaajMessage(result); } catch (XWSSecurityException ex) { throw new XwsSecuritySecurementException(ex.getMessage(), ex); } catch (WssSoapFaultException ex) { throw new XwsSecurityFaultException(ex.getFaultCode(), ex.getFaultString(), ex.getFaultActor()); } }