Examples of SOAPService


Examples of org.objectweb.hello_world_soap_http.SOAPService

            System.exit(1);
        }

        File wsdl = new File(args[0]);
       
        SOAPService ss = new SOAPService(wsdl.toURL(), SERVICE_NAME);
        Greeter port = ss.getSoapPort();
        String resp;

        System.out.println("Invoking sayHi...");
        resp = port.sayHi();
        System.out.println("Server responded with: " + resp);
View Full Code Here

Examples of org.objectweb.hello_world_soap_http.SOAPService

        Bus bus = Bus.init();
        QName endpoint = new QName("http://objectweb.org/hello_world_soap_http",
                                   "SoapPort");
       
        try {
            SOAPService hwService = new SOAPService();
            assertNotNull(hwService);
            Iterator iter = hwService.getPorts();
            assertFalse("Should have no element", iter.hasNext());

            Greeter port = hwService.getSoapPort();
            assertNotNull(port);
            assertTrue("Should be a proxy class. "
                        + port.getClass().getName(),
                        Proxy.isProxyClass(port.getClass()));
           
            iter = hwService.getPorts();
            assertTrue("Should have one element", iter.hasNext());           
            assertEquals("Activated EndPoints are not the same", endpoint, iter.next());           
        } finally {
            bus.shutdown(true);
        }
View Full Code Here

Examples of org.objectweb.hello_world_soap_http.SOAPService

   
    public void testCreateDispatch() throws Exception {
        QName endpoint = new QName("http://objectweb.org/hello_world_soap_http",
                                   "SoapPort");
       
        SOAPService service = new SOAPService();
        assertNotNull(service);
        Dispatch<SOAPMessage> disp = service.createDispatch(endpoint,
                                                                SOAPMessage.class, Service.Mode.MESSAGE);
        assertNotNull(disp);
        assertTrue("Should be DispatchImpl class", disp.getClass().isAssignableFrom(DispatchImpl.class));
       
        Dispatch<DOMSource> disp2 = service.createDispatch(endpoint,
                                                           DOMSource.class, Service.Mode.PAYLOAD);
        assertNotNull(disp2);
        assertTrue("Should be DispatchImpl class", disp2.getClass().isAssignableFrom(DispatchImpl.class));
    }
View Full Code Here

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

Examples of org.objectweb.hello_world_soap_http.SOAPService

    }
    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

Examples of org.objectweb.hello_world_soap_http.SOAPService

    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

Examples of org.objectweb.hello_world_soap_http.SOAPService

   
    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

Examples of org.objectweb.hello_world_soap_http.SOAPService

   
    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

Examples of org.objectweb.hello_world_soap_http.SOAPService

    }
    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

Examples of org.objectweb.hello_world_soap_http.SOAPService

    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
Copyright © 2018 www.massapi.com. 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.