Package com.caucho.hessian.client

Examples of com.caucho.hessian.client.HessianProxyFactory.create()


  {
    if (_jmxProxy == null) {
      try {
        HessianProxyFactory proxy = new HessianProxyFactory();
        proxy.getSerializerFactory().addFactory(new JMXSerializerFactory());
        _jmxProxy = (RemoteJMX) proxy.create(_url);
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
View Full Code Here


  {
    if (_jmxProxy == null) {
      try {
        HessianProxyFactory proxy = new HessianProxyFactory();
        proxy.getSerializerFactory().addFactory(new JMXSerializerFactory());
        _jmxProxy = (RemoteJMX) proxy.create(_url);
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
View Full Code Here

    throws MalformedURLException
  {
    // XXX Go through com.caucho.soa.transport.TransportFactory?
    HessianProxyFactory proxyFactory = getProxyFactory();

    return proxyFactory.create(serviceInterface, url);
  }

  private HessianProxyFactory getProxyFactory()
  {
    if (_proxyFactory == null)
View Full Code Here

   
    @Test
    public void testServer() throws IOException {
        try {
            HessianProxyFactory proxyFactory = new HessianProxyFactory();
            IFirst service = (IFirst)proxyFactory.create(IFirst.class, "http://localhost:8085/hessian1");
            List<String> datas = service.getData("123", "ABC");
            for (int i = 0; i < datas.size(); i++) {
                System.out.println(datas.get(i));
            }
        } catch (Exception e) {
View Full Code Here

   
    @Test
    public void testServer() throws IOException {
        try {
            HessianProxyFactory proxyFactory = new HessianProxyFactory();
            ISecond service = (ISecond)proxyFactory.create(ISecond.class, "http://localhost:8085/hessian2");
            String str = service.getString("XYZ");
            System.out.println(str);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
View Full Code Here

        try {
            Method method = ((JavaOperation)msg.getOperation()).getJavaMethod();
            Object[] args = msg.getBody();

            HessianProxyFactory proxyFactory = new HessianProxyFactory();
            Object service = proxyFactory.create(loadClass(homeImpl.toString()), serviceURL);
            Object result = null;
            result = method.invoke(service, args);
            msg.setBody(result);
        } catch (Throwable e) {
            e.printStackTrace();
View Full Code Here

            throw new IllegalStateException("Unsupported http protocol client=\"" + client + "\"!");
        }
        int timeout = url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT);
        hessianProxyFactory.setConnectTimeout(timeout);
        hessianProxyFactory.setReadTimeout(timeout);
        invoker = proxyFactory.getInvoker((T)hessianProxyFactory.create(serviceType, url.setProtocol("http").toJavaURL(), Thread.currentThread().getContextClassLoader()), serviceType, url);
    }

    @Override
    protected Result doInvoke(Invocation invocation) throws Throwable {
        try {
View Full Code Here

    }

    @Override
    public void init() throws Exception {
        HessianProxyFactory factory = new HessianProxyFactory();
        filePublishedService = (FilePublishedApi) factory.create(FilePublishedApi.class, remoteUrl);
    }

    @Override
    String getXml(String fileName) throws Exception {
        FilePublished filePublished = filePublishedService.download(appName, fileName);
View Full Code Here

        final ClassLoader loader = Thread.currentThread().getContextClassLoader();
        final HessianProxyFactory clientFactory = new HessianProxyFactory(loader);
        final SerializerFactory factory = new SerializerFactory(loader);
        factory.setAllowNonSerializable(true);
        clientFactory.setSerializerFactory(factory);
        final HessianWebService client = HessianWebService.class.cast(clientFactory.create(HessianWebService.class, "http://127.0.0.1:" + port + "/HessianServiceTest/hessian/" + MyHessianWebService.class.getSimpleName()));

        final Out out = client.call(new In("test"));
        assertThat(out, instanceOf(Out.class));
        assertEquals("test", out.value);
    }
View Full Code Here

        final ClassLoader loader = Thread.currentThread().getContextClassLoader();
        final HessianProxyFactory clientFactory = new HessianProxyFactory(loader);
        final SerializerFactory factory = new SerializerFactory(loader);
        factory.setAllowNonSerializable(true);
        clientFactory.setSerializerFactory(factory);
        final CdiService client = CdiService.class.cast(clientFactory.create(CdiService.class, "http://127.0.0.1:" + port + "/web/hessian/service"));

        final Out out = client.call(new In("test"));
        assertThat(out, instanceOf(Out.class));
        assertEquals("test", out.value);
    }
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.