Search in sources :

Example 1 with Greeter

use of org.apache.cxf.greeter_control.Greeter in project camel by apache.

the class JaxWsWebFaultAnnotationToFaultTest method testInvokingServiceFromCXFClient.

@Test
public void testInvokingServiceFromCXFClient() throws Exception {
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
    clientBean.setAddress(ROUTER_ADDRESS);
    clientBean.setServiceClass(Greeter.class);
    Greeter client = (Greeter) proxyFactory.create();
    try {
        client.pingMe();
        fail("Expect to get an exception here");
    } catch (PingMeFault expected) {
        assertEquals(MESSAGE, expected.getMessage());
    } catch (Throwable t) {
        t.printStackTrace();
        fail("The CXF client did not manage to map the client exception " + t.getClass().getName() + " to a " + PingMeFault.class.getName() + ": " + t.getMessage());
    }
}
Also used : PingMeFault(org.apache.cxf.greeter_control.PingMeFault) ClientFactoryBean(org.apache.cxf.frontend.ClientFactoryBean) Greeter(org.apache.cxf.greeter_control.Greeter) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) Test(org.junit.Test)

Aggregations

ClientFactoryBean (org.apache.cxf.frontend.ClientFactoryBean)1 Greeter (org.apache.cxf.greeter_control.Greeter)1 PingMeFault (org.apache.cxf.greeter_control.PingMeFault)1 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)1 Test (org.junit.Test)1