Search in sources :

Example 21 with SAAJInInterceptor

use of org.apache.cxf.binding.soap.saaj.SAAJInInterceptor in project jbossws-cxf by jbossws.

the class JaspiSeverInInterceptor method handleMessage.

@Override
public void handleMessage(SoapMessage message) throws Fault {
    if (message.getContent(SOAPMessage.class) == null) {
        SAAJInInterceptor saajIn = new SAAJInInterceptor();
        saajIn.handleMessage(message);
    }
    SOAPMessage soapMessage = message.getContent(SOAPMessage.class);
    if (soapMessage == null) {
        return;
    }
    SOAPMessage copyMessage = null;
    try {
        MessageFactory messageFactory = SAAJPreInInterceptor.INSTANCE.getFactory(message);
        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        soapMessage.writeTo(bout);
        copyMessage = messageFactory.createMessage(soapMessage.getMimeHeaders(), new ByteArrayInputStream(bout.toByteArray()));
    } catch (SOAPException e) {
        throw new Fault(e);
    } catch (IOException e) {
        throw new Fault(e);
    }
    if (copyMessage != null) {
        message.put(SOAPMessage.class, copyMessage);
    }
    try {
        authManager.validateRequest(message);
    } finally {
        message.put(SOAPMessage.class, soapMessage);
    }
}
Also used : SAAJInInterceptor(org.apache.cxf.binding.soap.saaj.SAAJInInterceptor) MessageFactory(javax.xml.soap.MessageFactory) ByteArrayInputStream(java.io.ByteArrayInputStream) SOAPException(javax.xml.soap.SOAPException) Fault(org.apache.cxf.interceptor.Fault) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) SOAPMessage(javax.xml.soap.SOAPMessage)

Aggregations

SAAJInInterceptor (org.apache.cxf.binding.soap.saaj.SAAJInInterceptor)21 SAAJOutInterceptor (org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor)10 Test (org.junit.Test)8 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)7 XMLStreamReader (javax.xml.stream.XMLStreamReader)5 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)5 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)5 Interceptor (org.apache.cxf.interceptor.Interceptor)5 Message (org.apache.cxf.message.Message)5 Endpoint (org.apache.cxf.endpoint.Endpoint)4 StringReader (java.io.StringReader)3 SOAPException (javax.xml.soap.SOAPException)3 SOAPMessage (javax.xml.soap.SOAPMessage)3 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)3 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)2