Package org.apache.hello_world_soap_http

Examples of org.apache.hello_world_soap_http.SOAPService


    @Test
    public void testAsyncCallWithHandler() throws Exception {
        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
        assertNotNull(wsdl);
       
        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);
       
        MyHandler h = new MyHandler();
        MyHandler.invocationCount = 0;

        String expectedString = new String("Hello, finally!");
        try {
            Greeter greeter = (Greeter)service.getPort(portName, Greeter.class);
            updateAddressPort(greeter, PORT);
            long before = System.currentTimeMillis();
            long delay = 3000;
            Future<?> f = greeter.greetMeLaterAsync(delay, h);
            long after = System.currentTimeMillis();
View Full Code Here


    @Test
    public void testAsyncCallWithHandlerAndMultipleClients() throws Exception {
        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
        assertNotNull(wsdl);
       
        SOAPService service = new SOAPService(wsdl, serviceName);
       
        assertNotNull(service);
       
        final MyHandler h = new MyHandler();
        MyHandler.invocationCount = 0;

        final String expectedString = new String("Hello, finally!");
       
        class Poller extends Thread {
            Future<?> future;
            int tid;
           
            Poller(Future<?> f, int t) {
                future = f;
                tid = t;
            }
            public void run() {
                if (tid % 2 > 0) {
                    while (!future.isDone()) {
                        try {
                            Thread.sleep(100);
                        } catch (InterruptedException ex) {
                            // ignore
                            ex.printStackTrace();
                        }
                    }
                }
                try {
                    future.get();
                } catch (Exception ex) {
                    fail("Poller " + tid + " failed with " + ex);
                }
                assertEquals("callback was not executed or did not return the expected result",
                             expectedString, h.getReplyBuffer());
            }
        }
       
        Greeter greeter = service.getPort(portName, Greeter.class);
        updateAddressPort(greeter, PORT);

        long before = System.currentTimeMillis();
        long delay = 3000;
        Future<?> f = greeter.greetMeLaterAsync(delay, h);
View Full Code Here

    @Test
    public void testFaults() throws Exception {
        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
        assertNotNull(wsdl);
       
        SOAPService service = new SOAPService(wsdl, serviceName);
        ExecutorService ex = Executors.newFixedThreadPool(1);
        service.setExecutor(ex);
        assertNotNull(service);

        String noSuchCodeFault = "NoSuchCodeLitFault";
        String badRecordFault = "BadRecordLitFault";

        Greeter greeter = service.getPort(portName, Greeter.class);
        updateAddressPort(greeter, PORT);
        for (int idx = 0; idx < 2; idx++) {
            try {
                greeter.testDocLitFault(noSuchCodeFault);
                fail("Should have thrown NoSuchCodeLitFault exception");
View Full Code Here

    public void testFaultStackTrace() throws Exception {
        System.setProperty("cxf.config.file.url",
                getClass().getResource("fault-stack-trace.xml").toString());
        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
        assertNotNull(wsdl);
        SOAPService service = new SOAPService(wsdl, serviceName);
        ExecutorService ex = Executors.newFixedThreadPool(1);
        service.setExecutor(ex);
        assertNotNull(service);       
        Greeter greeter = service.getPort(portName, Greeter.class);
        updateAddressPort(greeter, PORT);
        try {
            // trigger runtime exception throw of implementor method
            greeter.testDocLitFault("");
            fail("Should have thrown Runtime exception");
View Full Code Here

            new QName("http://apache.org/hello_world_soap_http", "SoapProviderPort");

        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
        assertNotNull(wsdl);

        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);

        String response1 = new String("TestSOAPOutputPMessage");
        String response2 = new String("Bonjour");
        try {
            Greeter greeter = service.getPort(portName, Greeter.class);
            setAddress(greeter, ADDRESS);
            try {
                greeter.greetMe("Return sayHi");
                fail("Should have thrown an exception");
            } catch (Exception ex) {
View Full Code Here

        assertEquals(200, responseCode.intValue());
    }
   
    @Test
    public void testNillable() throws Exception {
        SOAPService service = new SOAPService();
        assertNotNull(service);

        Greeter greeter = service.getPort(portName, Greeter.class);

        try {
            String reply = greeter.testNillable("test", 100);
            assertEquals("test", reply);
            reply = greeter.testNillable(null, 100);
View Full Code Here

    @Test
    public void testBasicConnectionAndOneway() throws Exception {
        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
        assertNotNull(wsdl);
       
        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);
       
        Greeter greeter = service.getPort(portName, Greeter.class);
       
        String response1 = new String("Hello Milestone-");
        String response2 = new String("Bonjour");
        try {      
            for (int idx = 0; idx < 1; idx++) {
View Full Code Here

    @Test
    public void testBasicConnection2() throws Exception {
        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
        assertNotNull(wsdl);
       
        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);
       
        //getPort only passing in SEI
        Greeter greeter = service.getPort(Greeter.class);
       
        String response1 = new String("Hello Milestone-");
        String response2 = new String("Bonjour");
        try {      
            for (int idx = 0; idx < 5; idx++) {
View Full Code Here

    @Test
    public void testAsyncPollingCall() throws Exception {
        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
        assertNotNull(wsdl);
       
        SOAPService service = new SOAPService(wsdl, serviceName);
       
        assertNotNull(service);
       
        Greeter greeter = service.getPort(portName, Greeter.class);
       
        assertNotNull(service);
       
        long before = System.currentTimeMillis();
View Full Code Here

    @Test
    public void testAsyncSynchronousPolling() throws Exception {
        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
        assertNotNull(wsdl);
       
        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);
       
        final String expectedString = new String("Hello, finally!");
         
        class Poller extends Thread {
            Response<GreetMeLaterResponse> response;
            int tid;
           
            Poller(Response<GreetMeLaterResponse> r, int t) {
                response = r;
                tid = t;
            }
            public void run() {
                if (tid % 2 > 0) {
                    while (!response.isDone()) {
                        try {
                            Thread.sleep(100);
                        } catch (InterruptedException ex) {
                            // ignore
                        }
                    }
                }
                GreetMeLaterResponse reply = null;
                try {
                    reply = response.get();
                } catch (Exception ex) {
                    fail("Poller " + tid + " failed with " + ex);
                }
                assertNotNull("Poller " + tid + ": no response received from service", reply);
                String s = reply.getResponseType();
                assertEquals(expectedString, s);  
            }
        }
       
        Greeter greeter = (Greeter)service.getPort(portName, Greeter.class);
        long before = System.currentTimeMillis();

       
        long delay = 3000;
       
View Full Code Here

TOP

Related Classes of org.apache.hello_world_soap_http.SOAPService

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.