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;
}
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());
}
}
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());
}
}
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);
}
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"));
}
Aggregations