Search in sources :

Example 6 with ReadHeadersInterceptor

use of org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor in project cxf by apache.

the class RMSoapInInterceptorTest method setUpInboundMessage.

private SoapMessage setUpInboundMessage(String resource) throws XMLStreamException {
    Message message = new MessageImpl();
    SoapMessage soapMessage = new SoapMessage(message);
    RMProperties rmps = new RMProperties();
    rmps.exposeAs(RM10Constants.NAMESPACE_URI);
    RMContextUtils.storeRMProperties(soapMessage, rmps, false);
    AddressingProperties maps = new AddressingProperties();
    RMContextUtils.storeMAPs(maps, soapMessage, false, false);
    message.put(Message.SCHEMA_VALIDATION_ENABLED, false);
    InputStream is = RMSoapInInterceptorTest.class.getResourceAsStream(resource);
    assertNotNull(is);
    XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(is);
    soapMessage.setContent(XMLStreamReader.class, reader);
    ReadHeadersInterceptor rji = new ReadHeadersInterceptor(BusFactory.getDefaultBus());
    rji.handleMessage(soapMessage);
    StartBodyInterceptor sbi = new StartBodyInterceptor();
    sbi.handleMessage(soapMessage);
    return soapMessage;
}
Also used : ReadHeadersInterceptor(org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor) XMLStreamReader(javax.xml.stream.XMLStreamReader) Message(org.apache.cxf.message.Message) SoapMessage(org.apache.cxf.binding.soap.SoapMessage) InputStream(java.io.InputStream) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) StartBodyInterceptor(org.apache.cxf.binding.soap.interceptor.StartBodyInterceptor) MessageImpl(org.apache.cxf.message.MessageImpl) RMProperties(org.apache.cxf.ws.rm.RMProperties) SoapMessage(org.apache.cxf.binding.soap.SoapMessage)

Example 7 with ReadHeadersInterceptor

use of org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor in project cxf by apache.

the class ReadHeaderInterceptorTest method testBadHttpVerb.

@Test
public void testBadHttpVerb() throws Exception {
    prepareSoapMessage("test-soap-header.xml");
    soapMessage.put(Message.HTTP_REQUEST_METHOD, "OPTIONS");
    ReadHeadersInterceptor r = new ReadHeadersInterceptor(BusFactory.getDefaultBus());
    try {
        r.handleMessage(soapMessage);
        fail("Did not throw exception");
    } catch (Fault f) {
        assertEquals(405, f.getStatusCode());
    }
}
Also used : ReadHeadersInterceptor(org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor) Fault(org.apache.cxf.interceptor.Fault) Test(org.junit.Test)

Example 8 with ReadHeadersInterceptor

use of org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor in project cxf by apache.

the class ReadHeaderInterceptorTest method testBadSOAPEnvelopeNamespace.

@Test
public void testBadSOAPEnvelopeNamespace() throws Exception {
    soapMessage = TestUtil.createEmptySoapMessage(Soap12.getInstance(), chain);
    InputStream in = getClass().getResourceAsStream("test-bad-env.xml");
    assertNotNull(in);
    ByteArrayDataSource bads = new ByteArrayDataSource(in, "test/xml");
    soapMessage.setContent(InputStream.class, bads.getInputStream());
    ReadHeadersInterceptor r = new ReadHeadersInterceptor(BusFactory.getDefaultBus());
    try {
        r.handleMessage(soapMessage);
        fail("Did not throw exception");
    } catch (SoapFault f) {
        assertEquals(Soap11.getInstance().getVersionMismatch(), f.getFaultCode());
    }
}
Also used : ReadHeadersInterceptor(org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor) InputStream(java.io.InputStream) ByteArrayDataSource(javax.mail.util.ByteArrayDataSource) Test(org.junit.Test)

Example 9 with ReadHeadersInterceptor

use of org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor in project cxf by apache.

the class SoapOutInterceptorTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    StaxInInterceptor sii = new StaxInInterceptor("phase1");
    chain.add(sii);
    rhi = new ReadHeadersInterceptor(BusFactory.getDefaultBus(), "phase2");
    chain.add(rhi);
    sbi = new StartBodyInterceptor("phase1.5");
    chain.add(sbi);
    soi = new SoapOutInterceptor(BusFactory.getDefaultBus(), "phase3");
    chain.add(soi);
}
Also used : ReadHeadersInterceptor(org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor) SoapOutInterceptor(org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor) StaxInInterceptor(org.apache.cxf.interceptor.StaxInInterceptor) StartBodyInterceptor(org.apache.cxf.binding.soap.interceptor.StartBodyInterceptor) Before(org.junit.Before)

Example 10 with ReadHeadersInterceptor

use of org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor in project cxf by apache.

the class SAAJInInterceptorTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    rhi = new ReadHeadersInterceptor(BusFactory.getDefaultBus(), "phase1");
    chain.add(rhi);
    sbi = new StartBodyInterceptor("phase1.5");
    chain.add(sbi);
    saajIntc = new SAAJInInterceptor("phase2");
    chain.add(saajIntc);
    chain.add(new CheckFaultInterceptor("phase3"));
}
Also used : ReadHeadersInterceptor(org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor) CheckFaultInterceptor(org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor) StartBodyInterceptor(org.apache.cxf.binding.soap.interceptor.StartBodyInterceptor) Before(org.junit.Before)

Aggregations

ReadHeadersInterceptor (org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor)10 StartBodyInterceptor (org.apache.cxf.binding.soap.interceptor.StartBodyInterceptor)7 CheckFaultInterceptor (org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor)4 Before (org.junit.Before)4 InputStream (java.io.InputStream)3 StaxInInterceptor (org.apache.cxf.interceptor.StaxInInterceptor)3 Test (org.junit.Test)3 ByteArrayDataSource (javax.mail.util.ByteArrayDataSource)2 MustUnderstandInterceptor (org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor)2 SoapOutInterceptor (org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor)2 AttachmentInInterceptor (org.apache.cxf.interceptor.AttachmentInInterceptor)2 Message (org.apache.cxf.message.Message)2 XMLStreamReader (javax.xml.stream.XMLStreamReader)1 Bus (org.apache.cxf.Bus)1 Binding (org.apache.cxf.binding.Binding)1 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)1 EndpointSelectionInterceptor (org.apache.cxf.binding.soap.interceptor.EndpointSelectionInterceptor)1 RPCInInterceptor (org.apache.cxf.binding.soap.interceptor.RPCInInterceptor)1 RPCOutInterceptor (org.apache.cxf.binding.soap.interceptor.RPCOutInterceptor)1 Soap11FaultInInterceptor (org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor)1