eagle0445 / hessdroid

Automatically exported from code.google.com/p/hessdroid
0 stars 0 forks source link

[com.caucho.hessian.io.HessianProtocolException: expected hessian reply at 0x48 (H)] #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Server site
1.1 Create TestAPI.java interface
[Source code]
---------------
public interface TestAPI {
    public String getMessage(String name);
}
---------------

1.2. Create TestAPIImpl.java implement TestAPI interface
[Source code]
---------------
public class TestAPIImpl extends HessianServlet implements TestAPI {
    public String getMessage(String name) {
        return "Hello, " + name;
    }
}
---------------

2. Android Client site
[Source code]
---------------
    String webServiceUrl = "http://10.0.2.2:8080/Sample/servlet/TestAPI";
    HessianProxyFactory proxyFactory = new HessianProxyFactory();
    TestAPI api = (TestAPI) proxyFactory.create(TestAPI.class,
    webServiceUrl, getClassLoader());
    Log.d("AAAAAA", api.getMessage("DungNT3"));

---------------
3. Start Android application normal with Galaxy Tab virtual device

What is the expected output? What do you see instead?
==>
Run and finish normal. But it throw below exception
---------------
03-23 22:14:14.236: ERROR/AndroidRuntime(400): H��RHello, DungNT3
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
android.os.Looper.loop(Looper.java:123)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
android.app.ActivityThread.main(ActivityThread.java:4627)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
java.lang.reflect.Method.invokeNative(Native Method)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
java.lang.reflect.Method.invoke(Method.java:521)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
dalvik.system.NativeStart.main(Native Method)
03-23 22:14:14.236: ERROR/AndroidRuntime(400): Caused by: 
com.caucho.hessian.client.HessianRuntimeException: 
com.caucho.hessian.io.HessianProtocolException: expected hessian reply at 0x48 
(H)
03-23 22:14:14.236: ERROR/AndroidRuntime(400): H��RHello, DungNT3
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:235)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at $Proxy0.getMessage(Native 
Method)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
vn.co.sample.HelloActivity.initData(HelloActivity.java:43)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
vn.co.sample.HelloActivity.onCreate(HelloActivity.java:25)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     ... 11 more
03-23 22:14:14.236: ERROR/AndroidRuntime(400): Caused by: 
com.caucho.hessian.io.HessianProtocolException: expected hessian reply at 0x48 
(H)
03-23 22:14:14.236: ERROR/AndroidRuntime(400): H��RHello, DungNT3
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
com.caucho.hessian.io.Hessian2Input.error(Hessian2Input.java:2705)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
com.caucho.hessian.io.Hessian2Input.startReply(Hessian2Input.java:402)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     at 
com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:221)
03-23 22:14:14.236: ERROR/AndroidRuntime(400):     ... 16 more
---------------

What version of the product are you using? On what operating system?
==> Server: Hessian 4.0.7
    Client: Lastest version from server (2011/03/23)
    Android 2.2 (API 8)
    Target platform: Galaxy Tab

Please provide any additional information below.
==>
I created java application to test this server code and it run well.

Original issue reported on code.google.com by nguyen.trong.dung830323 on 24 Mar 2011 at 12:38

GoogleCodeExporter commented 9 years ago
This issues solved.
Add this code to client site
--------
proxyFactory.setHessian2Reply(false);
--------

Original comment by nguyen.trong.dung830323 on 24 Mar 2011 at 12:51