Package org.jabsorb.client

Examples of org.jabsorb.client.Session


        this.method = ((JavaOperation)operation).getJavaMethod();
        this.uri = ((JSONRPCBinding)endpointReference.getBinding()).getURI();
    }

    public Message invoke(Message msg) {
        Session session = TransportRegistry.i().createSession(uri);
        Client client = new Client(session);
        Object proxy = client.openProxy("", method.getDeclaringClass());

        try {
            Object result = client.invoke(proxy, method, (Object[])msg.getBody());
            msg.setBody(result);
        } catch (Exception e) {
            msg.setFaultBody(e);
        } finally {
            client.closeProxy(proxy);
            session.close();
        }
        return msg;
    }
View Full Code Here


        node.stop();
    }

    @Test
    public void testService() throws Exception {
        final Session s = TransportRegistry.i().createSession("http://localhost:8080/python");
        final Client c = new Client(s);
        final Object px = c.openProxy("", EchoTest.class);
        final Object r = c.invoke(px, EchoTest.class.getMethod("echo", String.class, String.class), new Object[] {"Hey", "There"});
        c.closeProxy(px);
        s.close();
        assertEquals("Hey There", r);
    }
View Full Code Here

        assertEquals("Hey There", r);
    }

    @Test
    public void testReference() throws Exception {
        final Session s = TransportRegistry.i().createSession("http://localhost:8080/client");
        final Client c = new Client(s);
        final Object px = c.openProxy("", EchoTest.class);
        final Object r = c.invoke(px, EchoTest.class.getMethod("echo", String.class, String.class), new Object[] {"Hey", "There"});
        c.closeProxy(px);
        s.close();
        assertEquals("Hey There", r);
    }
View Full Code Here

        assertEquals("Hey There", r);
    }

    @Test
    public void testLocal() throws Exception {
        final Session s = TransportRegistry.i().createSession("http://localhost:8080/java-client");
        final Client c = new Client(s);
        final Object px = c.openProxy("", EchoTest.class);
        final Object r = c.invoke(px, EchoTest.class.getMethod("echo", String.class, String.class), new Object[] {"Hey", "There"});
        c.closeProxy(px);
        s.close();
        assertEquals("Hey There", r);
    }
View Full Code Here

        this.method = ((JavaOperation)operation).getJavaMethod();
        this.uri = ((JSONRPCBinding)endpointReference.getBinding()).getURI();
    }

    public Message invoke(Message msg) {
        Session session = TransportRegistry.i().createSession(uri);
        Client client = new Client(session);
        Object proxy = client.openProxy("", method.getDeclaringClass());

        try {
            Object result = client.invoke(proxy, method, (Object[])msg.getBody());
            msg.setBody(result);
        } catch (Exception e) {
            msg.setFaultBody(e);
        } finally {
            client.closeProxy(proxy);
            session.close();
        }
        return msg;
    }
View Full Code Here

TOP

Related Classes of org.jabsorb.client.Session

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.