Package org.apache.cxf.jaxws

Examples of org.apache.cxf.jaxws.JaxWsProxyFactoryBean


      LoggingOutInterceptor loggingOut = new LoggingOutInterceptor();
      if (loggingInterceptorLevel!=null)
        loggingOut.setLimit(Integer.parseInt(loggingInterceptorLevel));
      //loggingIn.setPrintWriter(null);
     
      JaxWsProxyFactoryBean pf = new JaxWsProxyFactoryBean();
      pf.getInInterceptors().add(loggingIn);
      pf.getOutInterceptors().add(loggingOut);
          pf.setServiceClass(clazz);
          String serviceName = clazz.getName();
          if (serviceName.indexOf(".")!=-1)
            serviceName = serviceName.substring(serviceName.lastIndexOf(".")+1);
           pf.setAddress(muleURL+serviceName);
          Object bean = pf.create();
          return bean;
    }
    catch (Throwable t) {
      Logger.error("", this.getClass().getName(), "getBean", t.getMessage(), t);
      throw t;
View Full Code Here


        server.stop();
    }

    @Test
    public void testSimpleUDP() throws Exception {
        JaxWsProxyFactoryBean fact = new JaxWsProxyFactoryBean();
        fact.setAddress("udp://localhost:" + PORT);
        Greeter g = fact.create(Greeter.class);
        for (int x = 0; x < 5; x++) {
            assertEquals("Hello World", g.greetMe("World"));
        }
              
        ((java.io.Closeable)g).close();
View Full Code Here

            //no non-loopbacks, cannot do broadcasts
            System.out.println("Skipping broadcast test");
            return;
        }
           
        JaxWsProxyFactoryBean fact = new JaxWsProxyFactoryBean();
        fact.setAddress("udp://:" + PORT + "/foo");
        Greeter g = fact.create(Greeter.class);
        assertEquals("Hello World", g.greetMe("World"));
        ((java.io.Closeable)g).close();
    }
View Full Code Here

        ((java.io.Closeable)g).close();
    }
   
    @Test
    public void testLargeRequest() throws Exception {
        JaxWsProxyFactoryBean fact = new JaxWsProxyFactoryBean();
        fact.setAddress("udp://localhost:" + PORT);
        Greeter g = fact.create(Greeter.class);
        StringBuilder b = new StringBuilder(100000);
        for (int x = 0; x < 10000; x++) {
            b.append("Hello ");
        }
        assertEquals("Hello " + b.toString(), g.greetMe(b.toString()));
View Full Code Here

        Greeter greeter = service.getPort(portName, Greeter.class);
        doService(greeter, true);
    }
    @Test
    public void testNonAopTransaction() throws Exception {
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setServiceClass(Greeter.class);
        factory.setAddress("jms://");

        JMSConfiguration jmsConfig = new JMSConfiguration();
        ConnectionFactory connectionFactory
            = new PooledConnectionFactory(broker.getBrokerURL());
        jmsConfig.setConnectionFactory(connectionFactory);
        jmsConfig.setTargetDestination("greeter.queue.noaop");
        jmsConfig.setPubSubDomain(false);
        jmsConfig.setUseJms11(true);

        JMSConfigFeature jmsConfigFeature = new JMSConfigFeature();
        jmsConfigFeature.setJmsConfig(jmsConfig);
        factory.getFeatures().add(jmsConfigFeature);

        Greeter greeter = (Greeter)factory.create();
        doService(greeter, false);
    }   
View Full Code Here

            + broker.getEncodedBrokerURL();
        if (messageType != null) {
            address = address + "&messageType=" + messageType;
        }

        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICATION_TRANSPORTID);
        factory.setServiceClass(Hello.class);
        factory.setAddress(address);
        Hello client = (Hello)factory.create();
        String reply = client.sayHi(" HI");
        assertEquals(reply, "get HI");
    }
View Full Code Here

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

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

        assertEquals(3, port.addNumbers(1, 2));
       
        assertLogNotContains(output.toString(), "//wsa:Address");
        assertLogNotContains(input.toString(), "//wsa:RelatesTo");
View Full Code Here

    @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();
        ((BindingProvider)port).getRequestContext().put("ws-addressing.write.optional.replyto", Boolean.TRUE);
        assertEquals(3, port.addNumbers(1, 2));
       
        assertLogContains(output.toString(), "//wsa:Address", "http://www.w3.org/2005/08/addressing/anonymous");
        assertLogContains(input.toString(), "//wsa:RelatesTo",
View Full Code Here

            + broker.getBrokerURL();
        if (messageType != null) {
            address = address + "&messageType=" + messageType;
        }

        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICATION_TRANSPORTID);
        factory.setServiceClass(Hello.class);
        factory.setAddress(address);
        Hello client = (Hello)factory.create();
        String reply = client.sayHi(" HI");
        assertEquals(reply, "get HI");
    }
View Full Code Here

    public static void stopServer() {
        server.stop();
    }

    private PersonService getService() {
        JaxWsProxyFactoryBean proxy = new JaxWsProxyFactoryBean();
        proxy.setServiceClass(PersonService.class);
        proxy.setAddress(PERSONSERVICE_TESTURL);
        PersonService personService = (PersonService)proxy.create();
        return personService;
    }
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.