Search in sources :

Example 81 with JaxWsProxyFactoryBean

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

the class CxfEndpointJMSConsumerTest method testInvocation.

@Test
public void testInvocation() {
    // Here we just the address with JMS URI
    String address = "jms:jndi:dynamicQueues/test.cxf.jmstransport.queue" + "?jndiInitialContextFactory" + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory" + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL=" + "vm://localhost";
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setServiceClass(Greeter.class);
    factory.setAddress(address);
    Greeter greeter = factory.create(Greeter.class);
    String response = greeter.greetMe("Willem");
    assertEquals("Get a wrong response", "Hello Willem", response);
}
Also used : Greeter(org.apache.hello_world_soap_http.Greeter) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) Test(org.junit.Test)

Example 82 with JaxWsProxyFactoryBean

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

the class CxfHolderConsumerTest method testInvokingServiceWithSoapHeaderFromCXFClient.

@Test
public void testInvokingServiceWithSoapHeaderFromCXFClient() throws Exception {
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
    clientBean.setAddress(ADDRESS);
    clientBean.setServiceClass(MyOrderEndpoint.class);
    MyOrderEndpoint client = (MyOrderEndpoint) proxyFactory.create();
    Holder<String> header = new Holder<String>();
    header.value = "parts";
    String result = client.mySecureOrder(1, header);
    assertEquals("Get a wrong order result", "Ordered ammount 1", result);
    assertEquals("Get a wrong parts", "secureParts", header.value);
}
Also used : ClientFactoryBean(org.apache.cxf.frontend.ClientFactoryBean) Holder(javax.xml.ws.Holder) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) Test(org.junit.Test)

Example 83 with JaxWsProxyFactoryBean

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

the class CxfHolderConsumerTest method testInvokingServiceFromCXFClient.

@Test
public void testInvokingServiceFromCXFClient() throws Exception {
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
    clientBean.setAddress(ADDRESS);
    clientBean.setServiceClass(MyOrderEndpoint.class);
    MyOrderEndpoint client = (MyOrderEndpoint) proxyFactory.create();
    Holder<String> strPart = new Holder<String>();
    strPart.value = "parts";
    Holder<String> strCustomer = new Holder<String>();
    strCustomer.value = "";
    String result = client.myOrder(strPart, 2, strCustomer);
    assertEquals("Get a wrong order result", "Ordered ammount 2", result);
    assertEquals("Get a wrong parts", "parts", strPart.value);
    assertEquals("Get a wrong customer", "newCustomer", strCustomer.value);
}
Also used : ClientFactoryBean(org.apache.cxf.frontend.ClientFactoryBean) Holder(javax.xml.ws.Holder) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) Test(org.junit.Test)

Example 84 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 85 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)152 Test (org.junit.Test)71 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)21 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)19 AegisDatabinding (org.apache.cxf.aegis.databinding.AegisDatabinding)14 Greeter (org.apache.hello_world_soap_http.Greeter)14 Client (org.apache.cxf.endpoint.Client)13 HashMap (java.util.HashMap)10 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)9 QName (javax.xml.namespace.QName)8 WrappedGreeter (org.apache.hello_world_soap_action.WrappedGreeter)8 BookStoreService (org.apache.cxf.systest.jaxws.tracing.BookStoreService)7 ArrayList (java.util.ArrayList)6 ClientFactoryBean (org.apache.cxf.frontend.ClientFactoryBean)6 Holder (javax.xml.ws.Holder)5 Server (org.apache.cxf.endpoint.Server)5 Greeter (org.apache.cxf.greeter_control.Greeter)5 Service (org.apache.cxf.service.Service)5 HTTPConduit (org.apache.cxf.transport.http.HTTPConduit)5 Metadata (org.apache.cxf.ws.mex.model._2004_09.Metadata)5