Package org.apache.cxf.frontend

Examples of org.apache.cxf.frontend.ClientProxyFactoryBean


        svrFactory.setAddress("local://dlbTest");
        svrFactory.setServiceBean(new UniversityImpl());
        svrFactory.getServiceFactory().setDataBinding(new AegisDatabinding());
        svrFactory.create();

        ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
        factory.getServiceFactory().setDataBinding(new AegisDatabinding());
      
        factory.setServiceClass(University.class);
        factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
        factory.setAddress("local://dlbTest");
        University client = (University) factory.create();
      
        Teacher tr = client.getTeacher(new Course(40, "Intro to CS", "Introductory Comp Sci"));
        assertNotNull(tr);
        assertEquals(52, tr.getAge());
        assertEquals("Mr. Tom", tr.getName());
View Full Code Here


    }

    private void setupForTest(boolean enableClientMTOM) throws Exception {
        AegisDatabinding aegisBinding = new AegisDatabinding();
        aegisBinding.setMtomEnabled(enableClientMTOM);
        ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
        proxyFac.setDataBinding(aegisBinding);
        proxyFac.setAddress("http://localhost:" + PORT + "/mtom");

        JaxWsProxyFactoryBean jaxwsFac = new JaxWsProxyFactoryBean();
        jaxwsFac.setDataBinding(new AegisDatabinding());
        jaxwsFac.setAddress("http://localhost:" + PORT + "/jaxWsMtom");

        Map<String, Object> props = new HashMap<String, Object>();
        if (enableClientMTOM) {
            props.put("mtom-enabled", Boolean.TRUE);
        }
        proxyFac.setProperties(props);

        client = (org.apache.cxf.systest.aegis.mtom.fortest.MtomTestService)
            proxyFac.create(MtomTestService.class);
        jaxwsClient = jaxwsFac.create(MtomTestService.class);
        impl = (MtomTestImpl)applicationContext.getBean("mtomImpl");
    }
View Full Code Here

        sf.setAddress("local://StudentServiceDocLiteral");
        setupAegis(sf);
        Server server = sf.create();
        server.start();

        ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
        proxyFac.setAddress("local://StudentServiceDocLiteral");
        proxyFac.setBus(getBus());
        setupAegis(proxyFac.getClientFactoryBean());
        //CHECKSTYLE:OFF
        HashMap<String, Student> mss = new HashMap<String, Student>();
        mss.put("Alice", new Student());
        HashMap<String, HashMap<String, Student>> mmss = new HashMap<String, HashMap<String, Student>>();
        mmss.put("Bob", mss);

        StudentServiceDocLiteral clientInterface = proxyFac.create(StudentServiceDocLiteral.class);
        clientInterface.takeMapMap(mmss);
        //CHECKSTYLE:ON
    }
View Full Code Here

    }
   
    @Test
    public void testAegisClient() throws Exception {
        AegisDatabinding aegisBinding = new AegisDatabinding();
        ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
        proxyFactory.setDataBinding(aegisBinding);
        proxyFactory.setServiceClass(AuthService.class);
        proxyFactory.setAddress("http://localhost:" + PORT + "/service");
        AuthService service = (AuthService) proxyFactory.create();
        assertTrue(service.authenticate("Joe", "Joe", "123"));
        assertFalse(service.authenticate("Joe1", "Joe", "fang"));     
        assertTrue(service.authenticate("Joe", null, "123"));
        List<String> list = service.getRoles("Joe");
        assertEquals(3, list.size());
View Full Code Here

       
        boolean jsr181Enabled = CxfEndpointUtils.hasWebServiceAnnotation(serviceClass);
        cfb.setJSR181Enabled(jsr181Enabled);
      
        return createClientFromClientFactoryBean(jsr181Enabled ? new JaxWsProxyFactoryBean(cfb)
            : new ClientProxyFactoryBean(cfb));
    }
View Full Code Here

        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);
    }
View Full Code Here

    }

    @Override
    protected Client createClient() throws CreateException, Exception
    {
        ClientProxyFactoryBean cpf = new ClientProxyFactoryBean();
        cpf.setServiceClass(ProxyService.class);
        cpf.setDataBinding(new StaxDataBinding());
        cpf.getFeatures().add(new StaxDataBindingFeature());
        cpf.setAddress(getAddress());
        cpf.setBus(getBus());
        cpf.setProperties(properties);
       
        if (wsdlLocation != null)
        {
            cpf.setWsdlLocation(wsdlLocation);
        }
       
        Client client = ClientProxy.getClient(cpf.create());

        Binding binding = client.getEndpoint().getBinding();
        CxfUtils.removeInterceptor(binding.getOutInterceptors(), WrappedOutInterceptor.class.getName());
        CxfUtils.removeInterceptor(binding.getInInterceptors(), Soap11FaultInInterceptor.class.getName());
        CxfUtils.removeInterceptor(binding.getInInterceptors(), Soap12FaultInInterceptor.class.getName());
View Full Code Here

public class SimpleClientMessageProcessorBuilder extends AbstractClientMessageProcessorBuilder
{
    @Override
    protected Client createClient() throws CreateException, Exception
    {
        ClientProxyFactoryBean cpf = new ClientProxyFactoryBean();
        cpf.setServiceClass(serviceClass);
        if (databinding == null)
        {
            cpf.setDataBinding(new AegisDatabinding());
        }
        else
        {
            cpf.setDataBinding(databinding);
        }
        cpf.setAddress(getAddress());
        cpf.setBus(getBus());
        cpf.setProperties(properties);
       
        if (wsdlLocation != null)
        {
            cpf.setWsdlLocation(wsdlLocation);
        }

        return ClientProxy.getClient(cpf.create());
    }
View Full Code Here

        };
    }
   
    @Test
    public void testInvokeProxyService() {
        ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
        factory.setServiceClass(BareSoapService.class);
        factory.setAddress(PROXY_URL);
        BareSoapService client = (BareSoapService) factory.create();

        client.doSomething();

        assertEquals("Proxied service should have been invoked once", 1, IMPLEMENTATION.invocations.get());
    }
View Full Code Here

                    return new CamelCxfClientImpl(getBus(), ep);
                }
            });
           
        } else {
            return new ClientProxyFactoryBean(new ClientFactoryBean() {
                @Override
                protected Client createClient(Endpoint ep) {
                    return new CamelCxfClientImpl(getBus(), ep);
                }
            });
View Full Code Here

TOP

Related Classes of org.apache.cxf.frontend.ClientProxyFactoryBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.