Search code examples
javaphphessian

Hessian: Java Client can't connect to php server


I am using Hessian Binary Protocol. It works fine when

CASE I:

  • Server
  • -- Java
  • Client
  • -- Java
  • -- PHP

CASE II:

  • Server
  • -- PHP
  • Client
  • -- PHP

But it throws exception

java.io.IOException: Server returned HTTP response code: 500 for URL

when

CASE III:

  • Server
  • -- PHP
  • Client
  • -- JAVA

I have googled a lot & found this https://code.google.com/p/hessianphp/issues/detail?id=20

Any help ?


Solution

  • Hessian uses v1 as default. It will give you error in the case you're using. However, HessianProxyFactory can be easily switched to v2 mode, like I demonstrate here in the following sample code:

    HessianProxyFactory factory = new HessianProxyFactory();
    factory.setHessian2Request(true);
    // Do something 
    

    Source: Hessdroid

    Hope that will work for you!