Package org.apache.cxf.frontend

Examples of org.apache.cxf.frontend.ClientProxyFactoryBean


        l.add(WS1ExtendedException.class.getName());
        globalContext.setRootClassNames(l);
        AegisDatabinding binding = new AegisDatabinding();
        binding.setAegisContext(globalContext);

        ClientProxyFactoryBean pf = new ClientProxyFactoryBean();
        setupAegis(pf.getClientFactoryBean(), binding);
        pf.getServiceFactory().setProperties(props);
        pf.setAddress("local://WS1");
        pf.setProperties(props);

        client = pf.create(WS1.class);

        Server server = createService(WS1.class, new WS1Impl(), "WS1", binding);
        new LoggingFeature().initialize(server, null);
        server.getEndpoint().getService().setInvoker(new BeanInvoker(new WS1Impl()));
    }
View Full Code Here


        service.setInvoker(new BeanInvoker(new InterfaceService()));
    }

    @Test
    public void testClient() throws Exception {
        ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
        proxyFac.setAddress("local://IInterfaceService");
        proxyFac.setBus(getBus());
        setupAegis(proxyFac.getClientFactoryBean());

        IInterfaceService client = proxyFac.create(IInterfaceService.class);

        IChild child = client.getChild();
        assertNotNull(child);
        assertEquals("child", child.getChildName());
        assertEquals("parent", child.getParentName());
View Full Code Here

        svrBean.setServiceClass(HelloService.class);       
        svrBean.setBus(getBus());
       
        svrBean.create();
       
        ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
        ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
        clientBean.setAddress("http://localhost/Hello");
        clientBean.setTransportId("http://schemas.xmlsoap.org/soap/http");
        clientBean.setServiceClass(HelloService.class);
        clientBean.setBus(getBus());
        clientBean.getInInterceptors().add(new LoggingInInterceptor());
       
        HelloService client = (HelloService) proxyFactory.create();
       
        ClientImpl c = (ClientImpl)ClientProxy.getClient(client);
        c.getOutInterceptors().add(new LoggingOutInterceptor());
        c.getInInterceptors().add(new LoggingInInterceptor());
       
View Full Code Here

    @Test
    public void testMissingTransliteration() throws Exception {
        Server server = createService(MissingType.class, new MissingTypeImpl(), null);
        Service service = server.getEndpoint().getService();
        service.setInvoker(new BeanInvoker(new MissingTypeImpl()));
        ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
        proxyFac.setAddress("local://MissingType");
        proxyFac.setBus(getBus());
        setupAegis(proxyFac.getClientFactoryBean());

        Document wsdl = getWSDLDocument("MissingType");
        assertValid("/wsdl:definitions/wsdl:types"
                    + "/xsd:schema[@targetNamespace='urn:org:apache:cxf:aegis:type:missing']"
                    + "/xsd:complexType[@name=\"Inner\"]", wsdl);
View Full Code Here

        assertValidBoolean("@type='xsd:int'", typeElement);
    }

    @Test
    public void testDataMovementPart() throws Exception {
        ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
        proxyFac.setDataBinding(new AegisDatabinding());
        proxyFac.setAddress("local://FlatArray");
        proxyFac.setBus(getBus());

        FlatArrayServiceInterface client = proxyFac.create(FlatArrayServiceInterface.class);
        client.submitStringArray(STRING_ARRAY);
        assertArrayEquals(STRING_ARRAY, service.stringArrayValue);
    }
View Full Code Here

        assertArrayEquals(STRING_ARRAY, service.stringArrayValue);
    }

    @Test
    public void testDataMovementBean() throws Exception {
        ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
        proxyFac.setDataBinding(new AegisDatabinding());
        proxyFac.setAddress("local://FlatArray");
        proxyFac.setBus(getBus());

        FlatArrayServiceInterface client = proxyFac.create(FlatArrayServiceInterface.class);
        BeanWithFlatArray bwfa = new BeanWithFlatArray();
        bwfa.setValues(INT_ARRAY);
        client.takeBeanWithFlatArray(bwfa);
        assertArrayEquals(INT_ARRAY, service.beanWithFlatArrayValue.getValues());
    }
View Full Code Here

        client.takeBeanWithFlatArray(bwfa);
        assertArrayEquals(INT_ARRAY, service.beanWithFlatArrayValue.getValues());
    }
    @Test
    public void testFlatCollection() throws Exception {
        ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
        proxyFac.setDataBinding(new AegisDatabinding());
        proxyFac.setAddress("local://FlatArray");
        proxyFac.setBus(getBus());

        FlatArrayServiceInterface client = proxyFac.create(FlatArrayServiceInterface.class);
        BeanWithFlatCollection bwfc = new BeanWithFlatCollection();
        bwfc.getValues().add(1);
        bwfc.getValues().add(2);
        bwfc.getValues().add(3);
        bwfc = client.echoBeanWithFlatCollection(bwfc);
View Full Code Here

        s.getEndpoint().getService().setInvoker(new BeanInvoker(new ExceptionServiceImpl()));
    }

    @Test
    public void testHeaders() throws Exception {
        ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
        proxyFac.setAddress("local://ExceptionService");
        proxyFac.setBus(getBus());
        setupAegis(proxyFac.getClientFactoryBean());

        ExceptionService client = proxyFac.create(ExceptionService.class);

        try {
            client.sayHiWithException();
            fail("Must throw exception!");
        } catch (HelloException e) {
View Full Code Here

        sfbean.setAddress("local://ExceptionServiceJaxWs1");
        Server server = sfbean.create();
        Service service = server.getEndpoint().getService();
        service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));

        ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
        proxyFac.setAddress("local://ExceptionServiceJaxWs1");
        proxyFac.setBus(getBus());
        setupAegis(proxyFac.getClientFactoryBean());

        ExceptionService clientInterface = proxyFac.create(ExceptionService.class);

        clientInterface.sayHiWithException();
    }
View Full Code Here

            new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/frontend/spring/clients.xml"});

        Object bean = ctx.getBean("client1.proxyFactory");
        assertNotNull(bean);

        ClientProxyFactoryBean cpfbean = (ClientProxyFactoryBean)bean;
        BindingConfiguration bc = cpfbean.getBindingConfig();
        assertTrue(bc instanceof SoapBindingConfiguration);
        SoapBindingConfiguration sbc = (SoapBindingConfiguration) bc;
        assertTrue(sbc.getVersion() instanceof Soap12);

        HelloService greeter = (HelloService) ctx.getBean("client1");
        assertNotNull(greeter);

        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);

        ClientProxyFactoryBean clientProxyFactoryBean =
            (ClientProxyFactoryBean) ctx.getBean("client2.proxyFactory");
        assertNotNull(clientProxyFactoryBean);
        assertEquals("get the wrong transportId",
                     clientProxyFactoryBean.getTransportId(),
                     "http://cxf.apache.org/transports/local");

        assertEquals("get the wrong bindingId",
                     clientProxyFactoryBean.getBindingId(),
                     "http://cxf.apache.org/bindings/xformat");

        greeter = (HelloService) ctx.getBean("client2");       
        assertNotNull(greeter);
    
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.