0
我有一个Zend前端,它们都是通过SOAP进行通信的Zend前端。后端的异常应该在前端上抛出Exception/SoapFault。这适用于错误消息,但错误代码会以某种方式丢失。我需要代码才能够在前端以不同的语言显示错误。我尝试了很多,但无法让它工作。ZendSoapServer抛出异常/ SoapFault时丢失错误代码
这是我SoapController的后端handleSoap功能:
private function handleSOAP($class) {
$options = array('uri' => 'urn:'.$class.'','location' => $this->_WSDL_URI);
$server = new Zend_Soap_Server(null, $options);
$server->setEncoding('ISO-8859-1');
$server->setClass($class);
$server->registerFaultException('Exception');
$server->handle();
}
在前端的SoapCallerClass:
public function __construct() {
$this->client = new Zend_Soap_Client($this->_WSDL_URI);
$this->client->setWsdlCache(WSDL_CACHE_NONE);
$this->client->setEncoding('ISO-8859-1');
}
public function __call($method,$params) {
try {
$this->client->mySoapFunction();
} catch (Exception $e) {
throw $e; // No error code inside !
}
}