Search in sources :

Example 41 with ClientProxyFactoryBean

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);
}
Also used : QName(javax.xml.namespace.QName) ClientProxyFactoryBean(org.apache.cxf.frontend.ClientProxyFactoryBean) XMLBinding(org.apache.cxf.binding.xml.XMLBinding) JaxbElementTest(org.apache.cxf.jaxb_element_test.JaxbElementTest) Test(org.junit.Test)

Example 42 with ClientProxyFactoryBean

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);
}
Also used : QName(javax.xml.namespace.QName) ClientProxyFactoryBean(org.apache.cxf.frontend.ClientProxyFactoryBean) JaxbElementTest(org.apache.cxf.jaxb_element_test.JaxbElementTest) Test(org.junit.Test)

Example 43 with ClientProxyFactoryBean

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();
}
Also used : CustomerService(com.example.customerservice.CustomerService) CustomerServiceTester(org.talend.esb.policy.schemavalidate.testservice.client.CustomerServiceTester) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ClientProxyFactoryBean(org.apache.cxf.frontend.ClientProxyFactoryBean) ArrayList(java.util.ArrayList) SchemaValidationFeature(org.talend.esb.policy.schemavalidate.feature.SchemaValidationFeature)

Aggregations

ClientProxyFactoryBean (org.apache.cxf.frontend.ClientProxyFactoryBean)43 Test (org.junit.Test)23 AegisDatabinding (org.apache.cxf.aegis.databinding.AegisDatabinding)12 ClientFactoryBean (org.apache.cxf.frontend.ClientFactoryBean)12 AbstractAegisTest (org.apache.cxf.aegis.AbstractAegisTest)10 Client (org.apache.cxf.endpoint.Client)4 Server (org.apache.cxf.endpoint.Server)4 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)4 ServerFactoryBean (org.apache.cxf.frontend.ServerFactoryBean)3 BeanInvoker (org.apache.cxf.service.invoker.BeanInvoker)3 Before (org.junit.Before)3 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)3 Document (org.w3c.dom.Document)3 CustomerService (com.example.customerservice.CustomerService)2 HashMap (java.util.HashMap)2 QName (javax.xml.namespace.QName)2 AegisContext (org.apache.cxf.aegis.AegisContext)2 JaxbElementTest (org.apache.cxf.jaxb_element_test.JaxbElementTest)2 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)2 Service (org.apache.cxf.service.Service)2