Package org.apache.cxf.jaxws

Examples of org.apache.cxf.jaxws.JaxWsProxyFactoryBean


    @Test
    public void testCxfWsaFeature() throws Exception {
        ByteArrayOutputStream input = setupInLogging();
        ByteArrayOutputStream output = setupOutLogging();

        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setServiceClass(AddNumbersPortType.class);
        factory.setAddress("http://localhost:" + PORT + "/jaxws/add");
        factory.getFeatures().add(new WSAddressingFeature());
        AddNumbersPortType port = (AddNumbersPortType) factory.create();

        assertEquals(3, port.addNumbers(1, 2));

        String expectedOut = "<Address>http://www.w3.org/2005/08/addressing/anonymous</Address>";
        String expectedIn = "<RelatesTo xmlns=\"http://www.w3.org/2005/08/addressing\">";
View Full Code Here


    }
   
    @Test
    public void testClientProxyFactory() {
     
        JaxWsProxyFactoryBean cf = new JaxWsProxyFactoryBean();
        cf.setAddress("http://localhost:" + PORT + "/test");       
        cf.setServiceClass(Greeter.class);
        cf.setBus(getBus());
        Configurer c = getBus().getExtension(Configurer.class);
        c.configureBean("client.proxyFactory", cf);
        Greeter greeter = (Greeter) cf.create();
        Client client = ClientProxy.getClient(greeter);       
        checkAddressInterceptors(client.getInInterceptors());
    }
View Full Code Here

       
    }
   
    @Test
    public void testClientProxyFactory() {
        JaxWsProxyFactoryBean cf = new JaxWsProxyFactoryBean();
        cf.setAddress("http://localhost:" + PORT + "/test");
        cf.getFeatures().add(new WSAddressingFeature());
        cf.setServiceClass(Greeter.class);
        Greeter greeter = (Greeter) cf.create();
        Client client = ClientProxy.getClient(greeter);
        checkAddressInterceptors(client.getInInterceptors());
    }
View Full Code Here

    public AegisJaxWsTest() {
    }
   
    private void setupForTest(boolean sec) throws Exception {
       
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setServiceClass(AegisJaxWs.class);
        if (sec) {
            factory.setAddress("http://localhost:9167/aegisJaxWsUN");
            WSS4JOutInterceptor wss4jOut = new WSS4JOutInterceptor();
            wss4jOut.setProperty("action", "UsernameToken");
            wss4jOut.setProperty("user", "alice");
            wss4jOut.setProperty("password", "pass");
           
            factory.setProperties(new HashMap<String, Object>());
            factory.getProperties().put("password", "pass");
            factory.getOutInterceptors().add(wss4jOut);
        } else {
            factory.setAddress("http://localhost:9167/aegisJaxWs");           
        }
        factory.getServiceFactory().setDataBinding(new AegisDatabinding());

        client = (AegisJaxWs)factory.create();
    }
View Full Code Here

            wsdlLocation = wsdlLoc;
        }
        String mexLoc = findMEXLocation(ref, useEPRWSAAddrAsMEXLocation);
        if (mexLoc != null) {
            try {
                JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
                proxyFac.setBindingId(soapVersion);
                proxyFac.setAddress(mexLoc);
                MetadataExchange exc = proxyFac.create(MetadataExchange.class);
                Metadata metadata = exc.get2004();
                for (MetadataSection s : metadata.getMetadataSection()) {
                    if ("http://schemas.xmlsoap.org/wsdl/".equals(s.getDialect())) {
                        //got the wsdl...
                        Definition definition = bus.getExtension(WSDLManager.class)
View Full Code Here

        fos.close();
    }

    protected static ReportIncidentEndpoint createCXFClient(String url) {
        // we use CXF to create a client for us as its easier than JAXWS and works
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setServiceClass(ReportIncidentEndpoint.class);
        factory.setAddress(url);
        return (ReportIncidentEndpoint) factory.create();
    }
View Full Code Here

        outInterceptors.add(wss4j);
        outInterceptors.add(loggingOutInterceptor);

        // we use CXF to create a client for us as its easier than JAXWS and works
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setOutInterceptors(outInterceptors);
        factory.setServiceClass(ReportIncidentEndpoint.class);
        factory.setAddress(url);
        return (ReportIncidentEndpoint) factory.create();
    }
View Full Code Here

        assertTrue(saaj);
        assertTrue(logging);

        assertTrue(client.getEndpoint().getService().getDataBinding() instanceof SourceDataBinding);

        JaxWsProxyFactoryBean factory = (JaxWsProxyFactoryBean)ctx.getBean("wsdlLocation.proxyFactory");
        assertNotNull(factory);
        String wsdlLocation = factory.getWsdlLocation();
        assertEquals("We should get the right wsdl location" , wsdlLocation, "wsdl/hello_world.wsdl");

        factory = (JaxWsProxyFactoryBean)ctx.getBean("inlineSoapBinding.proxyFactory");
        assertNotNull(factory);

        BindingConfiguration bc = factory.getBindingConfig();
        assertTrue(bc instanceof SoapBindingConfiguration);
        SoapBindingConfiguration sbc = (SoapBindingConfiguration) bc;
        assertTrue(sbc.getVersion() instanceof Soap12);
        assertTrue("the soap configure should set isMtomEnabled to be true",
                   sbc.isMtomEnabled());
View Full Code Here

        AbstractFactoryBeanDefinitionParser.setFactoriesAreAbstract(false);
        ClassPathXmlApplicationContext ctx =
            new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/jaxws/spring/clients.xml"});

       
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
       
        Greeter g = factory.create(Greeter.class);
        ClientImpl c = (ClientImpl)ClientProxy.getClient(g);
        for (Interceptor<? extends Message> i : c.getInInterceptors()) {
            if (i instanceof LoggingInInterceptor) {
                ctx.close();
                return;
View Full Code Here

        ei.setAddress(address);

        Destination d = localTransport.getDestination(ei);
        d.setMessageObserver(new MessageReplayObserver("/org/apache/cxf/jaxws/holder/echoResponse.xml"));

        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.getClientFactoryBean().setServiceClass(HolderService.class);
        factory.getClientFactoryBean().setBus(getBus());
        factory.getClientFactoryBean().setAddress(address);

        HolderService h = (HolderService)factory.create();
        Holder<String> holder = new Holder<String>();
        assertEquals("one", h.echo("one", "two", holder));
        assertEquals("two", holder.value);
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.jaxws.JaxWsProxyFactoryBean

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.