Zend Framework

Local client never throws SoapFault(s)

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Zend_Soap_Client
  • Labels:
    None

Description

Zend_Soap_Client_Local doesn't correctly handle Soap Faults. Take the following code:

function throwException() {
    throw new Exception('Exception message goes here');
}

$server = new Zend_Soap_Server(NULL, array('location' => 'http://example.com', 'uri' => 'http://example.com'));
$server->addFunction('throwException');
$server->registerFaultException('Exception');

$client = new Zend_Soap_Client_Local($server, NULL, array('location' => 'http://example.com', 'uri' => 'http://example.com'));

try {
    $client->throwException();
    echo ' We got past $client->throwException()';
}
catch (SoapFault $f) {
    echo 'We caught a SoapFault!';
}

Expected result

"We caught a SoapFault!'

Actual result

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body>
  <env:Fault>
    <env:Code><env:Value>Receiver</env:Value></env:Code>
    <env:Reason><env:Text>Exception message goes here</env:Text></env:Reason>
  </env:Fault>
</env:Body></env:Envelope>

Activity

Hide
Amr Mostafa added a comment -

I've traced this down to the following lines in Zend_Soap_Server::handle():

try {
    $soap->handle($request);
} catch (Exception $e) {
    $fault = $this->fault($e);
    $soap->fault($fault->faultcode, $fault->faultstring);
}

The problem is that $soap->fault() (i.e. PHP's SoapServer::fault()) terminates execution. I've submitted a PHP bug report: http://bugs.php.net/bug.php?id=49513

Show
Amr Mostafa added a comment - I've traced this down to the following lines in Zend_Soap_Server::handle():
try {
    $soap->handle($request);
} catch (Exception $e) {
    $fault = $this->fault($e);
    $soap->fault($fault->faultcode, $fault->faultstring);
}
The problem is that $soap->fault() (i.e. PHP's SoapServer::fault()) terminates execution. I've submitted a PHP bug report: http://bugs.php.net/bug.php?id=49513

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: