use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project camel by apache.
the class JaxWSCamelTestSupport method getSampleWSAsyncWithCXFAPI.
public SampleWSAsync getSampleWSAsyncWithCXFAPI(String camelEndpoint) {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setAddress("camel://" + camelEndpoint);
factory.setServiceClass(SampleWSAsync.class);
factory.setBus(bus);
return factory.create(SampleWSAsync.class);
}
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 ddf by codice.
the class SecureProxyServiceFactoryImpl method createSecureClientFactory.
private <ProxyServiceType> ProxyServiceType createSecureClientFactory(WebServiceProperties<ProxyServiceType> wsp, SecurityToken token) throws UnsupportedOperationException {
JaxWsProxyFactoryBean clientFactory = new JaxWsProxyFactoryBean();
boolean populateFromClass = unavailableWsdls.contains(wsp.endpointWsdlURL);
if (populateFromClass) {
LOGGER.debug("Using service class to create client rather than WSDL.");
}
clientFactory.getClientFactoryBean().getServiceFactory().setPopulateFromClass(populateFromClass);
LOGGER.debug("Configuring client proxy properties");
configureProxyFactoryProperties(clientFactory, token, wsp);
clientFactory.getOutInterceptors().add(new TokenPassThroughInterceptor());
ProxyServiceType proxyServiceType;
try {
proxyServiceType = clientFactory.create(wsp.serviceClass);
} catch (ServiceConstructionException e) {
LOGGER.debug("Unable to use WSDL to build client. Attempting to use service class.", e);
unavailableWsdls.add(wsp.endpointWsdlURL);
clientFactory.getClientFactoryBean().getServiceFactory().setPopulateFromClass(true);
proxyServiceType = clientFactory.create(wsp.serviceClass);
}
return proxyServiceType;
}
Aggregations