[Hessian-interest] problem connecting php hessian client to java hessian service

Stevenson Cunanan stevenson.cunanan at gmail.com
Sat Apr 16 07:55:36 CDT 2011


Hi Mattias,

I found my problem. My pom had a version 3 hessian artifact while i should
have been 4.0.7. that is why it didn't work across language. took be a while
to find that hehehe. Thanks for the help.

Best regards,
Stevenson Lee

On Wed, Apr 13, 2011 at 3:21 PM, Mattias Jiderhamn <
mj-lists at expertsystems.se> wrote:

>  I have limited experience with Hessian on PHP but I have used it for a
> cross-language demo when giving a talk on Hessian.
>
> I had problems getting HessianPHP to work with Curl (under Windows), which
> is default, so I reconfigured it not to use Curl like this:
>
>     <?php
>       include_once('hessian/HessianClient.php');
>
>       $options = new HessianOptions();
>       $options->transport = 'http';
>
>       $url = 'http://localhost:8080/calc';
>       $proxy = &new HessianClient($url, $options);
>
>       echo $proxy->add(62, 19);
>     ?>
>
> Worked for me. You might want to givet it a try!
>
>  </Mattias>
>
>
> Stevenson Cunanan wrote (2011-04-13 03:28):
>
> Hi,
>
>
>  (I created the same email before that had my codes attached but it seems
> to require approval to be sent. So here's my message again)
>
>  I tried the hessian examples. I followed the guide on
> http://www.caucho.com/resin-3.0/protocols/hessian.xtp . I'm using eclipse
> and maven. I created a webapp and added the necessary folders. I deployed
> the war on tomcat and also tried it with mvn jetty:run.
>
>  I ran the BasicClient as a java application using eclipse just to see if
> the service is running. Since killing the webserver cause exceptions, I
> assume that the client is actually getting the data from the service on
> jetty/tomcat. So I'd assume that my hessian service is good. (please correct
> me if I am wrong.)
>
>  But now, I am trying to connect using a php client. I used the client
> from http://sourceforge.net/projects/hessianphp/files/ (I've also attached
> the zip file in an earlier message). However when I try it, I get a http
> response 500 error on the HessianTransport.php. I have no idea what I did
> wrong.
>
>  Here's my code in php:
>  <html>
> <head></head>
> <body>
> This is a test
> <?php
>         require_once('./HessianPHP_v2.0.3/src/HessianClient.php');
> //require the librar
>         $testUrl = 'http://localhost:8080/hessianexample/math'; // this is
> deployed in tomcat
>         $hessianClient = new HessianClient($testUrl);
>         try{
>                 echo("<br/> do add: ".$hessianClient->add(1,2));
>         }catch(Exception $exception){
>                 echo('OMG there is an exception: ');var_dump($exception);
>         }
>
>  ?>
>
>  </body>
> </html>
>
>
>  When the php script runs, I get this error:
>
>   object(Exception)#12 (7) {
>   ["message":protected]=>
>   string(37) "Server error, returned HTTP code: 500"
>   ["string":"Exception":private]=>
>   string(0) ""
>   ["code":protected]=>
>   int(0)
>   ["file":protected]=>
>   string(91) "/home/slee/PROJECT/globe-mds/lib/gs-info/hessian/HessianPHP_v2.0.3/src/HessianTransport.php"
>   ["line":protected]=>
>   int(91)
>   ["trace":"Exception":private]=>
>   array(4) {
>     [0]=>
>     array(6) {
>       ["file"]=>
>       string(88) "/home/slee/PROJECT/globe-mds/lib/gs-info/hessian/HessianPHP_v2.0.3/src/HessianClient.php"
>       ["line"]=>
>       int(66)
>       ["function"]=>
>       string(9) "getStream"
>       ["class"]=>
>       string(20) "HessianCURLTransport"
>       ["type"]=>
>       string(2) "->"
>       ["args"]=>
>       array(3) {
>         [0]=>
>         string(41) "http://localhost:8080/hessianexample/math"
>         [1]=>
>         string(11) "H C add’‘’"
>         [2]=>
>         object(HessianOptions)#2 (18) {
>           ["version"]=>
>           int(2)
>           ["transport"]=>
>           string(4) "CURL"
>           ["transportOptions"]=>
>           NULL
>           ["detectVersion"]=>
>           bool(false)
>           ["objectFactory"]=>
>           NULL
>           ["typeMap"]=>
>           array(0) {
>           }
>           ["strictTypes"]=>
>           bool(false)
>           ["headers"]=>
>           array(0) {
>           }
>           ["interceptors"]=>
>           array(0) {
>           }
>           ["timeZone"]=>
>           NULL
>           ["saveRaw"]=>
>           bool(false)
>           ["serviceName"]=>
>           string(0) ""
>           ["displayInfo"]=>
>           bool(false)
>           ["ignoreOutput"]=>
>           bool(false)
>           ["parseFilters"]=>
>           array(0) {
>           }
>           ["writeFilters"]=>
>           array(0) {
>           }
>           ["before"]=>
>           array(0) {
>           }
>           ["after"]=>
>           array(0) {
>           }
>         }
>       }
>     }
>     [1]=>
>     array(6) {
>       ["file"]=>
>       string(88) "/home/slee/PROJECT/globe-mds/lib/gs-info/hessian/HessianPHP_v2.0.3/src/HessianClient.php"
>       ["line"]=>
>       int(111)
>       ["function"]=>
>       string(13) "__hessianCall"
>       ["class"]=>
>       string(13) "HessianClient"
>       ["type"]=>
>       string(2) "->"
>       ["args"]=>
>       array(2) {
>         [0]=>
>         string(3) "add"
>         [1]=>
>         array(2) {
>           [0]=>
>           int(1)
>           [1]=>
>           int(2)
>         }
>       }
>     }
>     [2]=>
>     array(4) {
>       ["function"]=>
>       string(6) "__call"
>       ["class"]=>
>       string(13) "HessianClient"
>       ["type"]=>
>       string(2) "->"
>       ["args"]=>
>       array(2) {
>         [0]=>
>         string(3) "add"
>         [1]=>
>         array(2) {
>           [0]=>
>           int(1)
>           [1]=>
>           int(2)
>         }
>       }
>     }
>     [3]=>
>     array(6) {
>       ["file"]=>
>       string(58) "/home/slee/PROJECT/globe-mds/lib/gs-info/hessian/test2.php"
>       ["line"]=>
>       int(10)
>       ["function"]=>
>       string(3) "add"
>       ["class"]=>
>       string(13) "HessianClient"
>       ["type"]=>
>       string(2) "->"
>       ["args"]=>
>       array(2) {
>         [0]=>
>         int(1)
>         [1]=>
>         int(2)
>       }
>     }
>   }
>   ["previous":"Exception":private]=>
>   NULL
> }
>
>
>
>  Please advice.
>
>  Thanks,
>
>  Best regards,
> Stevenson Lee
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://maillist.caucho.com/pipermail/hessian-interest/attachments/20110416/91ebccb4/attachment.html 


More information about the hessian-interest mailing list