Search in sources :

Example 6 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project camel by apache.

the class ReportIncidentRoutesTest method createCXFClient.

protected static ReportIncidentEndpoint createCXFClient() {
    // we use CXF to create a client for us as its easier than JAXWS and works
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setServiceClass(ReportIncidentEndpoint.class);
    factory.setAddress(url);
    return (ReportIncidentEndpoint) factory.create();
}
Also used : JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean)

Example 7 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project camel by apache.

the class CreditScoreProcessor method getProxy.

private CreditAgencyWS getProxy() {
    // Here we use JaxWs front end to create the proxy
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
    clientBean.setAddress(creditAgencyAddress);
    clientBean.setServiceClass(CreditAgencyWS.class);
    clientBean.setBus(BusFactory.getDefaultBus());
    return (CreditAgencyWS) proxyFactory.create();
}
Also used : ClientFactoryBean(org.apache.cxf.frontend.ClientFactoryBean) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) CreditAgencyWS(org.apache.camel.loanbroker.credit.CreditAgencyWS)

Example 8 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project camel by apache.

the class PayLoadConvertToPOJOTest method testClient.

@Test
public void testClient() throws Exception {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setAddress("http://localhost:" + getPort1() + "/" + getClass().getSimpleName() + "/CamelContext/RouterPort");
    factory.setServiceClass(Person.class);
    Person person = factory.create(Person.class);
    GetPerson payload = new GetPerson();
    payload.setPersonId("1234");
    GetPersonResponse reply = person.getPerson(payload);
    assertEquals("Get the wrong person id.", "1234", reply.getPersonId());
}
Also used : GetPersonResponse(org.apache.camel.non_wrapper.types.GetPersonResponse) GetPerson(org.apache.camel.non_wrapper.types.GetPerson) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) GetPerson(org.apache.camel.non_wrapper.types.GetPerson) Person(org.apache.camel.non_wrapper.Person) Test(org.junit.Test)

Example 9 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean 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)

Example 10 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project camel by apache.

the class JaxWSCamelTestSupport method getSampleWSWithCXFAPI.

public SampleWS getSampleWSWithCXFAPI(String camelEndpoint) {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setAddress("camel://" + camelEndpoint);
    factory.setServiceClass(SampleWS.class);
    factory.setBus(bus);
    return factory.create(SampleWS.class);
}
Also used : JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean)

Aggregations

JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)15 Test (org.junit.Test)7 ClientFactoryBean (org.apache.cxf.frontend.ClientFactoryBean)6 URL (java.net.URL)2 Holder (javax.xml.ws.Holder)2 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)2 Greeter (org.apache.hello_world_soap_http.Greeter)2 CreditAgencyWS (org.apache.camel.loanbroker.credit.CreditAgencyWS)1 Person (org.apache.camel.non_wrapper.Person)1 GetPerson (org.apache.camel.non_wrapper.types.GetPerson)1 GetPersonResponse (org.apache.camel.non_wrapper.types.GetPersonResponse)1 Greeter (org.apache.cxf.greeter_control.Greeter)1 PingMeFault (org.apache.cxf.greeter_control.PingMeFault)1 LoggingInInterceptor (org.apache.cxf.interceptor.LoggingInInterceptor)1 LoggingOutInterceptor (org.apache.cxf.interceptor.LoggingOutInterceptor)1 ServiceConstructionException (org.apache.cxf.service.factory.ServiceConstructionException)1