Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.14.0

Bug #14306 SOAP_Server_TCP not generate response for SOAP_Fault
Submitted: 2008-07-07 23:11 UTC
From: tomaszrup Assigned:
Status: Verified Package: SOAP (version 0.11.0)
PHP Version: 5.2.6 OS: Mandriva Linux
Roadmaps: (Not assigned)    
Subscription  


 [2008-07-07 23:11 UTC] tomaszrup (Tomasz Rup)
Description: ------------ TCP SOAP server crash when soap method return SOAP_Fault object. Test script: --------------- server: <?php require_once 'SOAP/Server/TCP.php'; $skiptrace =& PEAR::getStaticProperty('PEAR_Error', 'skiptrace'); $skiptrace = true; class SOAP_Example_Server { public $__dispatch_map = array(); public function __construct() { $this->__dispatch_map['test'] = array( 'in' => array('inputString' => 'string'), 'out' => array('outputString' => 'string'), ); } public function __dispatch($methodname) { if (isset($this->__dispatch_map[$methodname])) return $this->__dispatch_map[$methodname]; return NULL; } public function test($inputString) { return new SOAP_Fault('Fault!', 'Server'); } } $server = new SOAP_Server_TCP('127.0.0.1', 10102); $server->_auto_translation = true; $soapclass = new SOAP_Example_Server; $server->addObjectMap($soapclass,'urn:SOAP_Example_Server'); $server->run(); ?> client: <?php require_once('SOAP/Client.php'); $soapclient = new SOAP_Client("tcp://127.0.0.1:10102"); $options = array('namespace' => 'urn:SOAP_Example_Server', 'trace' => true); $params = array("inputString" => "this is string 1"); $ret = $soapclient->call("test", $params, $options); echo PEAR::isError($ret) ? $ret->getMessage() : $ret; ?> Expected result: ---------------- Fault! Actual result: -------------- Error reveiving data from tcp://127.0.0.1:10102

Comments

 [2008-07-07 23:26 UTC] tomaszrup (Tomasz Rup)
I try to add this patch, but i can't. --- SOAP/Server/TCP.php 2008-07-08 01:04:36.000000000 +0200 +++ SOAP/Server/TCP.php.new 2008-07-08 01:04:00.000000000 +0200 @@ -86,6 +86,9 @@ if ($data) { $response = $this->service($data); + if($this->fault) { + $response = $this->fault->message($this->response_encoding); + } /* Write to the socket. */ if (!socket_write($msgsock, $response, strlen($response))) { return $this->_raiseSoapFault('Error sending response data reason ' . socket_strerror());
 [2008-07-15 00:49 UTC] yunosh (Jan Schneider)
Can you please try the latest code from CVS? I doubt this has anything to do with using the TCP server.
 [2008-07-16 07:49 UTC] tomaszrup (Tomasz Rup)
in a file server.php in function "service" we have the following code: ... $soap_msg = $this->parseRequest($data, $attachments); ... if ($this->fault) { $response = $this->fault->message(); } return $response; ... in a file TCP.php we have only: return $this->parseRequest($data, $attachments); In case of error function parseRequest sets $this->fault and return null value.
 [2008-07-19 07:45 UTC] doconnor (Daniel O'Connor)
Ah hah! Good catch Tomasz.