Hello,
 
I have an extended HessianServlet which exposes a method
 
Public String hello()
 
 
 
The following client works fine. (HessianProxyFactory J2SE)
 
public class HessianClient {
 
  public static void main(String[] args) throws Exception {
 
    String url = "http://localhost:8988/HessianServer1/remoteservice";;
    
    HessianProxyFactory factory = new HessianProxyFactory();
    
    HelloInterface helloInterface = 
          (HelloInterface)(factory.create(HelloInterface.class, url));
 
    System.out.println(helloInterface.hello());
  }
 
 
This client refuses to work. (Hessian micro edition classes J2ME or
(J2SE+JSR 197) )
 
public class TestClass
{
  private static String url =
"http://localhost:8988/HessianServer1/remoteservice";;
 
  public static void main(String[] args) throws Exception
  {
    HttpConnection conn;
    OutputStream os = null;
    InputStream is = null;
    try
    {
      try
      {
        conn = (HttpConnection)Connector.open(url);
        conn.setRequestMethod(HttpConnection.POST);
        os = conn.openOutputStream();
        MicroHessianOutput out = new MicroHessianOutput(os);
        out.startCall("hello");
        out.completeCall();
        os.flush();
      
        is = conn.openInputStream(); // FAILS HERE
        MicroHessianInput in = new MicroHessianInput(is);
        in.startReply();
        String hello = in.readString();
        in.completeReply();
        System.out.println(hello);
      }
      finally
      {
        if (os != null)
        {
          os.close();
        }
        if (is != null)
        {
          is.close();
        }
      }
    }
    catch (IOException e)
    {
      throw(e);
    }
  }
}
 
In this test class it falls over when it tries to open the input stream
as indicated by // FAILS HERE
 
The complete error message I get for J2SE+JSR197 (Hessian 3.1.3)
 
Exception in thread "main" java.io.IOException: Server returned HTTP
response code: 500 for URL:
http://localhost:8988/HessianServer1/remoteservice
                at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
tion.java:1152)
                at
numfum.j2me.io.http.HttpConnectionImpl.openInputStream(Unknown Source)
                at TestClass.main(TestClass.java:35)
The complete error message I get for J2ME (Hessian 2.1.2)
 
Exception in thread "main" java.net.SocketException: The connection was
reset
        at java.net.SocketImpl.receiveStreamImpl(Native Method)
        at java.net.SocketImpl.read(SocketImpl.java:397)
        at java.net.SocketInputStream.read(SocketInputStream.java:137)
        at
com.ibm.oti.connection.socket.Connection$1.read(Connection.java:268)
        at java.io.InputStream.read(InputStream.java:93)
        at
java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:113)
        at
java.io.BufferedInputStream.read(BufferedInputStream.java:185)
        at
com.ibm.oti.connection.http.Connection.readln(Connection.java:1114)
        at
com.ibm.oti.connection.http.Connection.readServerResponse(Connection.
java:1096)
        at
com.ibm.oti.connection.http.Connection.doRequest(Connection.java:920)
 
        at
com.ibm.oti.connection.http.Connection.openInputStream(Connection.jav
a:1202)
        at TestClass.main(TestClass.java:35)
 
 
 
Any ideas how I can solve this? My remote methods were far more
complicated but because I was having problems I have gone back to the
basics and I am virtually copying a tutorial given on the Caucho web
site. I've seen posts where this all works so I don't understand why it
will not work for me!! I am obviously missing something??
 
Best Regards
Paul
 
_______________________________________________
hessian-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/hessian-interest

Reply via email to