Caucho Forums

Caucho Forums (http://forum.caucho.com//index.php)
-   Hessian (http://forum.caucho.com//forumdisplay.php?f=6)
-   -   Error 500 when calling javaservice from php... (http://forum.caucho.com//showthread.php?t=29152)

DmS 11-08-2012 11:13 AM

PHP -> Java server = Error500...
 
Hi, new here and trying to wrap my head around Hessian.
I'm confident with PHP but noob on Java/JSP, can read it but not much more.

I've setup two local servers on my machine (OSX), one Apache running PHP 5.3 on port 8888 and Tomcat6 running on 8080

I got the examples from here http://hessianphp.sourceforge.net/in...ain.QuickStart running on the PHP server without problem.
So I can call a hessian service on the PHP server from another PHP script on the same server and get the expected results.

Then I deployed the Java WAR file on the tomcat server.
When I access the demo.jsp page with a browser, I get the correct output so it works on the tomcat server.

However, when I call the tomcat service from the PHP scripts, I get an Error 500 back.

I know that POST has to be used, but I was under the impression that this is the default behaviour in the phphessian.

cURL is enabled & working in the php server.

This code works (URL points to my PHP-server)
PHP Code:

include_once 'HessianPHP_v2/src/HessianClient.php'; $testurl = 'http://192.168.137.79:8888/workspace/sandbox/hessian/math_service.php'; $proxy = new HessianClient($testurl); try{     echo "PHP Service response: ".$proxy->div(10,2);  } catch (Exception $ex){    // ...handle error    echo "PHP Server = Boom...".$ex; } 

This code does not work (URL points to my tomcat server with the java example service working:
PHP Code:

$testurl = 'http://localhost:8080/hessian/service/userService';  try { $proxy = new HessianClient($testurl);  $user = $proxy->findUser('mgomez'); print('Java Service response: <pre>'); print_r($user);         print('</pre>'); } catch (Exception $ex) { print('<pre>'); echo '<br><br>'.$ex;         print('</pre>'); } 

This is the exception which is thrown in the calling php-page.
Code:

exception 'Exception' with message 'Server error, returned HTTP code: 500' in /Users/***@***.com/Documents/workspace/sandbox/hessian/HessianPHP_v2/src/HessianTransport.php:91
Stack trace:
#0 /Users/***@***.com/Documents/workspace/sandbox/hessian/HessianPHP_v2/src/HessianClient.php(66): HessianCURLTransport->getStream('http://localhos...', 'H??C?findUser??...', Object(HessianOptions))
#1 /Users/***@***.com/Documents/workspace/sandbox/hessian/HessianPHP_v2/src/HessianClient.php(111): HessianClient->__hessianCall('findUser', Array)
#2 [internal function]: HessianClient->__call('findUser', Array)
#3 /Users/***@***.com/Documents/workspace/sandbox/hessian/index.php(18): HessianClient->findUser('mgomez')
#4 {main}

So, where am I going wrong?
Everything points to me somehow doing a GET towards the tomcat server, but I can't see why that would happen. No code is altered in any way from the PHP & Java examples asides from what you see posted here.

Thankful for any help :)
/Dan

DmS 11-08-2012 11:20 AM

Error 500 when calling javaservice from php...
 
Hi, new here and trying to wrap my head around Hessian.
I'm confident with PHP but noob on Java/JSP, can read it but not much more.

I've setup two local servers on my machine (OSX), one Apache running PHP 5.3 on port 8888 and Tomcat6 running on 8080

I got the examples from here http://hessianphp.sourceforge.net/in...ain.QuickStart running on the PHP server without problem.
So I can call a hessian service on the PHP server from another PHP script on the same server and get the expected results.

Then I deployed the Java WAR file on the tomcat server.
When I access the demo.jsp page with a browser, I get the correct output so it works on the tomcat server.

However, when I call the tomcat service from the PHP scripts, I get an Error 500 back.

I know that POST has to be used, but I was under the impression that this is the default behaviour in the phphessian.

cURL is enabled & working in the php server.

This code works (URL points to my PHP-server)
PHP Code:

include_once 'HessianPHP_v2/src/HessianClient.php'; $testurl = 'http://192.168.137.79:8888/workspace/sandbox/hessian/math_service.php'; $proxy = new HessianClient($testurl); try{     echo "PHP Service response: ".$proxy->div(10,2);  } catch (Exception $ex){    // ...handle error    echo "PHP Server = Boom...".$ex; } 

This code does not work (URL points to my tomcat server with the java example service working:
PHP Code:

$testurl = 'http://localhost:8080/hessian/service/userService';  try { $proxy = new HessianClient($testurl);  $user = $proxy->findUser('mgomez'); print('Java Service response: <pre>'); print_r($user);         print('</pre>'); } catch (Exception $ex) { print('<pre>'); echo '<br><br>'.$ex;         print('</pre>'); } 

This is the exception which is thrown in the calling php-page.
Code:

exception 'Exception' with message 'Server error, returned HTTP code: 500' in /Users/***@***.com/Documents/workspace/sandbox/hessian/HessianPHP_v2/src/HessianTransport.php:91
Stack trace:
#0 /Users/***@***.com/Documents/workspace/sandbox/hessian/HessianPHP_v2/src/HessianClient.php(66): HessianCURLTransport->getStream('http://localhos...', 'H??C?findUser??...', Object(HessianOptions))
#1 /Users/***@***.com/Documents/workspace/sandbox/hessian/HessianPHP_v2/src/HessianClient.php(111): HessianClient->__hessianCall('findUser', Array)
#2 [internal function]: HessianClient->__call('findUser', Array)
#3 /Users/***@***.com/Documents/workspace/sandbox/hessian/index.php(18): HessianClient->findUser('mgomez')
#4 {main}

So, where am I going wrong?
Everything points to me somehow doing a GET towards the tomcat server, but I can't see why that would happen. No code is altered in any way from the PHP & Java examples asides from what you see posted here.

Thankful for any help :)
/Dan

nam 11-16-2012 10:21 PM

Hi Dan,

I'm not sure what the problem may be. I'll try out the example over the weekend and get back to you.


All times are GMT. The time now is 01:27 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.