use of org.apache.cxf.frontend.ClientProxyFactoryBean in project cxf by apache.
the class ClientServerMiscTest method testSimpleClientWithWsdlAndBindingId.
@Test
public void testSimpleClientWithWsdlAndBindingId() throws Exception {
QName portName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService", "DocLitWrappedCodeFirstServicePort");
QName servName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService", "DocLitWrappedCodeFirstService");
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.setBindingId("http://cxf.apache.org/bindings/xformat");
factory.setWsdlURL(ServerMisc.DOCLIT_CODEFIRST_URL_XMLBINDING + "?wsdl");
factory.setServiceName(servName);
factory.setServiceClass(DocLitWrappedCodeFirstService.class);
factory.setEndpointName(portName);
factory.setAddress(ServerMisc.DOCLIT_CODEFIRST_URL_XMLBINDING);
DocLitWrappedCodeFirstService port = (DocLitWrappedCodeFirstService) factory.create();
assertNotNull(port);
assertEquals(factory.getBindingId(), "http://cxf.apache.org/bindings/xformat");
assertTrue(ClientProxy.getClient(port).getEndpoint().getBinding() instanceof XMLBinding);
String echoMsg = port.echo("Hello");
assertEquals("Hello", echoMsg);
}
use of org.apache.cxf.frontend.ClientProxyFactoryBean in project cxf by apache.
the class ClientServerMiscTest method testSimpleClientWithWsdl.
@Test
public void testSimpleClientWithWsdl() throws Exception {
QName portName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService", "DocLitWrappedCodeFirstServicePort");
QName servName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService", "DocLitWrappedCodeFirstService");
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.setWsdlURL(ServerMisc.DOCLIT_CODEFIRST_URL + "?wsdl");
factory.setServiceName(servName);
factory.setServiceClass(DocLitWrappedCodeFirstService.class);
factory.setEndpointName(portName);
DocLitWrappedCodeFirstService port = (DocLitWrappedCodeFirstService) factory.create();
assertNotNull(port);
String echoMsg = port.echo("Hello");
assertEquals("Hello", echoMsg);
}
use of org.apache.cxf.frontend.ClientProxyFactoryBean in project tesb-rt-se by Talend.
the class AbstractFeatureTest method customFeatureTest.
public void customFeatureTest(SchemaValidationFeature feature, String customerName) throws Exception {
clientCtxt = new ClassPathXmlApplicationContext("classpath:spring/client/feature/client-defaultApplicationContext.xml");
ClientProxyFactoryBean clientFactory = (ClientProxyFactoryBean) clientCtxt.getBean(ClientProxyFactoryBean.class);
List<SchemaValidationFeature> features = new ArrayList<SchemaValidationFeature>();
features.add(feature);
clientFactory.setFeatures(features);
CustomerServiceTester tester = new CustomerServiceTester();
tester.setCustomerService(clientFactory.create(CustomerService.class));
tester.testCustomerService(customerName);
clientCtxt.close();
}
Aggregations