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