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.
config your servlet in your web.xml
see:http://hessian.caucho.com/doc/hessian-overview.xtp#Configurationforstandardweb.xml