Package org.apache.cxf.frontend

Examples of org.apache.cxf.frontend.ClientProxyFactoryBean


   
    @Test
    public void testSortedSet() throws Exception {
        createService(CollectionService.class, new CollectionService(), null);
       
        ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
        proxyFac.getServiceFactory().getServiceConfigurations().add(0,
                                                              new XFireCompatibilityServiceConfiguration());
        proxyFac.setServiceClass(CollectionServiceInterface.class);
        proxyFac.setDataBinding(new AegisDatabinding());
        proxyFac.setAddress("local://CollectionService");
        proxyFac.setBus(getBus());

        CollectionServiceInterface csi = (CollectionServiceInterface)proxyFac.create();
        SortedSet<String> strings = new TreeSet<String>();
        strings.add("Able");
        strings.add("Baker");
        String first = csi.takeSortedStrings(strings);
        assertEquals("Able", first);
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

 
        logger.info(
          "connecting the interface {} to the endpoint {}",
          interfacename, endpointUrl);
 
        ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
        factory.setServiceClass(ifaceClazz);
        factory.setAddress(endpointUrl);
        proxyRaw = factory.create();
 
          } else {
        logger.info("{} and {} are not equal", interfacename,
          ir.getJavaType());
          }
View Full Code Here

        waitForEndpoint(address);
       
        //do the invocation using a CXF api
        GreeterService greeter1 = null;
        try {
            ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
            factory.setServiceClass(GreeterService.class);
            factory.setAddress(address);
            factory.getServiceFactory().setDataBinding(new AegisDatabinding());
            greeter1 = (GreeterService)factory.create();
            useService(greeter1);
        } finally {
            Thread.currentThread().setContextClassLoader(contextLoader);
        }
           
View Full Code Here

        LOG.info("Creating a " + sd.getProvidedInterfaces().toArray()[0]
                + " client, endpoint address is " + address);

        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
        try {
            ClientProxyFactoryBean factory = createClientProxyFactoryBean();
            factory.setServiceClass(iClass);
            factory.setAddress(address);
            factory.getServiceFactory().setDataBinding(new AegisDatabinding());

            applyIntents(dswContext,
                         callingContext,
                         factory.getFeatures(),
                         factory.getClientFactoryBean(),
                         sd);

            Thread.currentThread().setContextClassLoader(ClientProxyFactoryBean.class.getClassLoader());
            Object proxy = getProxy(factory.create(), iClass);
            getDistributionProvider().addRemoteService(serviceReference);
            return proxy;
        } catch (Exception e) {
            LOG.log(Level.WARNING, "proxy creation failed", e);
        } finally {
View Full Code Here

        super(dswBC, dp, handlerProps);
    }

    // Isolated so that it can be substituted for testing
    ClientProxyFactoryBean createClientProxyFactoryBean() {
        return new ClientProxyFactoryBean();
    }
View Full Code Here

        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
        EasyMock.replay(bc);
        ReflectionServiceFactoryBean sf = EasyMock.createNiceMock(ReflectionServiceFactoryBean.class);
        EasyMock.replay(sf);
       
        final ClientProxyFactoryBean cpfb = EasyMock.createNiceMock(ClientProxyFactoryBean.class);
        EasyMock.expect(cpfb.getServiceFactory()).andReturn(sf).anyTimes();
        EasyMock.replay(cpfb);
       
        DistributionProviderImpl dp = new DistributionProviderImpl(bc);
        PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(bc, dp, handlerProps) {
            @Override
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

       
        // Make an actual invocation on the remote service.
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(ClientProxyFactoryBean.class.getClassLoader());       
        try {
            ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
            factory.setServiceClass(GreeterService.class);
            factory.setAddress("http://localhost:9090/greeter");
            factory.getServiceFactory().setDataBinding(new AegisDatabinding());
            GreeterService client = (GreeterService)factory.create();
            Map<GreetingPhrase, String> greetings = client.greetMe("Fred");
            Assert.assertEquals("Fred", greetings.get(new GreetingPhrase("Hello")));
            System.out.println("Invocation result: " + greetings);
           
            try {
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:9002/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

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.