Caucho Forums  

This forum is permanently closed because of spam. For free community support, please visit Google Groups:


Go Back   Caucho Forums > Hessian

Reply
 
Thread Tools Display Modes
  #1  
Old 11-08-2012, 11:13 AM
DmS DmS is offline
Junior Member
 
Join Date: Nov 2012
Posts: 2
Default 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
Reply With Quote
  #2  
Old 11-08-2012, 11:20 AM
DmS DmS is offline
Junior Member
 
Join Date: Nov 2012
Posts: 2
Default 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
Reply With Quote
  #3  
Old 11-16-2012, 10:21 PM
nam nam is offline
Administrator
 
Join Date: Aug 2009
Posts: 337
Default

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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:33 AM.


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