Search in sources :

Example 6 with BareInInterceptor

use of org.apache.cxf.wsdl.interceptors.BareInInterceptor in project cxf by apache.

the class BareInInterceptorTest method testInterceptorInbound.

@Test
public void testInterceptorInbound() throws Exception {
    setUpUsingHelloWorld();
    BareInInterceptor interceptor = new BareInInterceptor();
    message.setContent(XMLStreamReader.class, XMLInputFactory.newInstance().createXMLStreamReader(getTestStream(getClass(), "resources/GreetMeDocLiteralReq.xml")));
    message.put(Message.INBOUND_MESSAGE, Message.INBOUND_MESSAGE);
    interceptor.handleMessage(message);
    assertNull(message.getContent(Exception.class));
    List<?> parameters = message.getContent(List.class);
    assertEquals(1, parameters.size());
    Object obj = parameters.get(0);
    assertTrue(obj instanceof GreetMe);
    GreetMe greet = (GreetMe) obj;
    assertEquals("TestSOAPInputPMessage", greet.getRequestType());
}
Also used : GreetMe(org.apache.hello_world_soap_http.types.GreetMe) BareInInterceptor(org.apache.cxf.wsdl.interceptors.BareInInterceptor) Test(org.junit.Test)

Example 7 with BareInInterceptor

use of org.apache.cxf.wsdl.interceptors.BareInInterceptor in project cxf by apache.

the class BareInInterceptorTest method testInterceptorInboundBareNoParameter.

@Test
public void testInterceptorInboundBareNoParameter() throws Exception {
    setUpUsingDocLit();
    BareInInterceptor interceptor = new BareInInterceptor();
    message.setContent(XMLStreamReader.class, XMLInputFactory.newInstance().createXMLStreamReader(getTestStream(getClass(), "resources/bareNoParamDocLitBareReq.xml")));
    XMLStreamReader reader = message.getContent(XMLStreamReader.class);
    // skip to the end element of soap body, so that we can serve an empty request to
    // interceptor
    StaxUtils.skipToStartOfElement(reader);
    StaxUtils.nextEvent(reader);
    message.put(Message.INBOUND_MESSAGE, Message.INBOUND_MESSAGE);
    interceptor.handleMessage(message);
    assertNull(message.getContent(Exception.class));
    List<?> parameters = message.getContent(List.class);
    assertNull(parameters);
}
Also used : XMLStreamReader(javax.xml.stream.XMLStreamReader) BareInInterceptor(org.apache.cxf.wsdl.interceptors.BareInInterceptor) Test(org.junit.Test)

Aggregations

BareInInterceptor (org.apache.cxf.wsdl.interceptors.BareInInterceptor)7 Test (org.junit.Test)4 XMLStreamReader (javax.xml.stream.XMLStreamReader)2 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)2 QName (javax.xml.namespace.QName)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 CorbaStreamFaultInInterceptor (org.apache.cxf.binding.corba.interceptors.CorbaStreamFaultInInterceptor)1 CorbaStreamFaultOutInterceptor (org.apache.cxf.binding.corba.interceptors.CorbaStreamFaultOutInterceptor)1 CorbaStreamInInterceptor (org.apache.cxf.binding.corba.interceptors.CorbaStreamInInterceptor)1 CorbaStreamOutInterceptor (org.apache.cxf.binding.corba.interceptors.CorbaStreamOutInterceptor)1 SoapFault (org.apache.cxf.binding.soap.SoapFault)1 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)1 AbstractSoapInterceptor (org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor)1 Endpoint (org.apache.cxf.endpoint.Endpoint)1 Fault (org.apache.cxf.interceptor.Fault)1 Interceptor (org.apache.cxf.interceptor.Interceptor)1 InterceptorChain (org.apache.cxf.interceptor.InterceptorChain)1 Exchange (org.apache.cxf.message.Exchange)1 Message (org.apache.cxf.message.Message)1 MessageContentsList (org.apache.cxf.message.MessageContentsList)1