Package org.jabsorb.client

Examples of org.jabsorb.client.Client


        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


    }

    @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

    }

    @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

    }

    @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.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

   */
  public static Client create(String jsonUrl, boolean useHttpClient) throws Exception {
    if (useHttpClient) {
      HTTPSession.register(TransportRegistry.i());
    }
    Client client = new Client(TransportRegistry.i().createSession(jsonUrl));
    Field serializerField = client.getClass().getDeclaredField("serializer");
    serializerField.setAccessible(true);
    JSONSerializer serializer = (JSONSerializer) serializerField.get(client);
    serializer.registerSerializer(new JSONEnterpriseObjectSerializer());
    serializer.registerSerializer(new NSArraySerializer());
    serializer.registerSerializer(new NSDictionarySerializer());
View Full Code Here

TOP

Related Classes of org.jabsorb.client.Client

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.