Package org.objectweb.hello_world_soap_http

Examples of org.objectweb.hello_world_soap_http.SOAPService


        QName portName = new QName(NS, "SoapPort");

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

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

        String response1 = new String("TestGreetMeResponse");
        String response2 = new String("TestSayHiResponse");
        try {
            Greeter greeter = service.getPort(portName, Greeter.class);
            String greeting = greeter.greetMe("TestGreetMeRequest");
            assertNotNull("no response received from service", greeting);
            assertEquals(response1, greeting);

            String reply = greeter.sayHi();
View Full Code Here


    }
    public void testBasicConnection() 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 < 5; idx++) {
View Full Code Here

    public void testAsyncPollingCall() throws Exception {
        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
        assertNotNull(wsdl);
       
        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);
        ExecutorService executor = Executors.newFixedThreadPool(5);
        service.setExecutor(executor);
        assertNotNull(service);

        String expectedString = new String("How are you Joe");
        try {
            Greeter greeter = (Greeter)service.getPort(portName, Greeter.class);
           
            Response<GreetMeSometimeResponse> response = greeter.greetMeSometimeAsync("Joe");
            while (!response.isDone()) {
                Thread.sleep(100);
            }
View Full Code Here

   
    public void testAsyncSynchronousPolling() throws Exception {
        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
        assertNotNull(wsdl);
       
        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);
        ExecutorService executor = Executors.newFixedThreadPool(5);
        service.setExecutor(executor);
        assertNotNull(service);

        final String expectedString = new String("How are you Joe");
         
        class Poller extends Thread {
            Response<GreetMeSometimeResponse> response;
            int tid;
           
            Poller(Response<GreetMeSometimeResponse> 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
                        }
                    }
                }
                GreetMeSometimeResponse 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);
        Response<GreetMeSometimeResponse> response = greeter.greetMeSometimeAsync("Joe");
       
        Poller[] pollers = new Poller[4];
        for (int i = 0; i < pollers.length; i++) {
            pollers[i] = new Poller(response, i);
View Full Code Here

   
    public void testAsyncCallWithHandler() throws Exception {
        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
        assertNotNull(wsdl);
       
        SOAPService service = new SOAPService(wsdl, serviceName);
        ExecutorService executor = Executors.newFixedThreadPool(5);
        service.setExecutor(executor);
        assertNotNull(service);
       
        MyHandler h = new MyHandler();
        MyHandler.invocationCount = 0;

        String expectedString = new String("How are you Joe");
        try {
            Greeter greeter = (Greeter)service.getPort(portName, Greeter.class);
            Future<?> f = greeter.greetMeSometimeAsync("Joe", h);
            int i = 0;
            while (!f.isDone() && i < 20) {
                Thread.sleep(100);
                i++;
View Full Code Here

    }
    public void testAsyncCallWithHandlerAndMultipleClients() throws Exception {
        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
        assertNotNull(wsdl);
       
        SOAPService service = new SOAPService(wsdl, serviceName);
        ExecutorService executor = Executors.newFixedThreadPool(5);
        service.setExecutor(executor);
        assertNotNull(service);
       
        final MyHandler h = new MyHandler();
        MyHandler.invocationCount = 0;

        final String expectedString = new String("How are you Joe");
       
        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
                        }
                    }
                }
                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 = (Greeter)service.getPort(portName, Greeter.class);
        Future<?> f = greeter.greetMeSometimeAsync("Joe", h);
       
        Poller[] pollers = new Poller[4];
        for (int i = 0; i < pollers.length; i++) {
            pollers[i] = new Poller(f, i);
View Full Code Here

    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);
        for (int idx = 0; idx < 2; idx++) {
            try {
                greeter.testDocLitFault(noSuchCodeFault);
                fail("Should have thrown NoSuchCodeLitFault exception");
            } catch (NoSuchCodeLitFault nslf) {
View Full Code Here

TOP

Related Classes of org.objectweb.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.