use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class StaxRoundTripTest method createClientProxy.
private Echo createClientProxy() {
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setServiceClass(Echo.class);
proxyFac.setAddress("local://Echo");
proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID);
return (Echo) proxyFac.create();
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class MultipleServiceShareClassTest method createGetterService.
private <T extends Getter> T createGetterService(final Class<T> serviceClass) {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setAddress("http://localhost:" + PORT + "/" + serviceClass.getSimpleName());
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
return factory.create(serviceClass);
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class SpringBeansTest method testClients.
@Test
public void testClients() throws Exception {
AbstractFactoryBeanDefinitionParser.setFactoriesAreAbstract(false);
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { "/org/apache/cxf/jaxws/spring/clients.xml" });
ClientHolderBean greeters = (ClientHolderBean) ctx.getBean("greeters");
assertEquals(4, greeters.greeterCount());
Object bean = ctx.getBean("client1.proxyFactory");
assertNotNull(bean);
Greeter greeter = (Greeter) ctx.getBean("client1");
Greeter greeter2 = (Greeter) ctx.getBean("client1");
assertNotNull(greeter);
assertNotNull(greeter2);
assertSame(greeter, greeter2);
Client client = ClientProxy.getClient(greeter);
assertNotNull("expected ConduitSelector", client.getConduitSelector());
assertTrue("unexpected ConduitSelector", client.getConduitSelector() instanceof NullConduitSelector);
List<Interceptor<? extends Message>> inInterceptors = client.getInInterceptors();
boolean saaj = false;
boolean logging = false;
for (Interceptor<? extends Message> i : inInterceptors) {
if (i instanceof SAAJInInterceptor) {
saaj = true;
} else if (i instanceof LoggingInInterceptor) {
logging = true;
}
}
assertTrue(saaj);
assertTrue(logging);
saaj = false;
logging = false;
for (Interceptor<?> i : client.getOutInterceptors()) {
if (i instanceof SAAJOutInterceptor) {
saaj = true;
} else if (i instanceof LoggingOutInterceptor) {
logging = true;
}
}
assertTrue(saaj);
assertTrue(logging);
assertTrue(client.getEndpoint().getService().getDataBinding() instanceof SourceDataBinding);
JaxWsProxyFactoryBean factory = (JaxWsProxyFactoryBean) ctx.getBean("wsdlLocation.proxyFactory");
assertNotNull(factory);
String wsdlLocation = factory.getWsdlLocation();
assertEquals("We should get the right wsdl location", wsdlLocation, "wsdl/hello_world.wsdl");
factory = (JaxWsProxyFactoryBean) ctx.getBean("inlineSoapBinding.proxyFactory");
assertNotNull(factory);
BindingConfiguration bc = factory.getBindingConfig();
assertTrue(bc instanceof SoapBindingConfiguration);
SoapBindingConfiguration sbc = (SoapBindingConfiguration) bc;
assertTrue(sbc.getVersion() instanceof Soap12);
assertTrue("the soap configure should set isMtomEnabled to be true", sbc.isMtomEnabled());
Greeter g1 = greeters.getGreet1();
Greeter g2 = greeters.getGreet2();
assertNotSame(g1, g2);
ctx.close();
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class SpringBeansTest method testClientFromFactory.
@Test
public void testClientFromFactory() throws Exception {
AbstractFactoryBeanDefinitionParser.setFactoriesAreAbstract(false);
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { "/org/apache/cxf/jaxws/spring/clients.xml" });
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
Greeter g = factory.create(Greeter.class);
ClientImpl c = (ClientImpl) ClientProxy.getClient(g);
for (Interceptor<? extends Message> i : c.getInInterceptors()) {
if (i instanceof LoggingInInterceptor) {
ctx.close();
return;
}
}
ctx.close();
fail("Did not configure the client");
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class MEXTest method testGet.
@Test
public void testGet() {
// Create the client
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setAddress("local://Echo-mex");
proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID);
MetadataExchange exc = proxyFac.create(MetadataExchange.class);
Metadata metadata = exc.get2004();
assertNotNull(metadata);
proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setAddress("local://Echo");
proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID);
exc = proxyFac.create(MetadataExchange.class);
metadata = exc.get2004();
assertNotNull(metadata);
}
Aggregations