I'm trying to establish basic hessian communication between two android devices.

Client AsyncTask that sends the message

public class AsyncHessian extends AsyncTask<String,String,String> {

@Override
protected String doInBackground(String... params) {

    String url = "http://192.168.1.37:8080/test/test";
    try{
        HessianProxyFactory factory = new HessianProxyFactory();
        TService basic = (TService) factory.create(TService.class, url);
        basic.hello();
        Log.i("Hello", "Hessian!");
    }
    catch(Exception e){e.printStackTrace();}
    return "";
}

}

Server side implementation of interface

public class TServiceImpl extends HessianServlet implements TService{

public static void main(String[] args) throws Exception {
    Server server = new Server(8080);
    Context context = new Context(server, "/", Context.SESSIONS);
    context.addServlet(TServiceImpl.class, "/test");
    server.start();
}

public void hello() {
    System.out.println("Hello Hessian!");
}

}

Interface

public interface TService {
public void hello();

}

Server is running on jetty on Android device. Message is being sent from application to server.

I'm positive that the message gets to the destination, because when jetty was stopped I got an ECONNREFUSED error. Now when it's on, I get the one it the title.

2

There are 2 best solutions below

0
On

config your servlet in your web.xml

<servlet>
    <servlet-name>testService</servlet-name>
    <servlet-class>com.caucho.hessian.server.HessianServlet</servlet-class>
    <init-param>
        <param-name>home-class</param-name>
        <param-value>TServiceImpl's full name</param-value>
    </init-param>
    <init-param>
        <param-name>home-api</param-name>
        <param-value>TService's full name</param-value>
    </init-param>
</servlet>
<servlet-mapping>
    <servlet-name>testService</servlet-name>
    <url-pattern>/test</url-pattern>
</servlet-mapping>

see:http://hessian.caucho.com/doc/hessian-overview.xtp#Configurationforstandardweb.xml

0
On

I had the same problem. That can be many things, but the '<' is the beginning mark from an HTML or XML message.

The possible reasons:

  • No access
  • Incorrect page
  • The service is not correctly mapped to the path.
  • Etc.

We need more details about the program configuration.