Zend バックエンドと Zend フロントエンドがあり、どちらも SOAP 経由で通信しています。バックエンドでの例外は、フロントエンドで Exception / SoapFault をスローする必要があります。これは Error-Message で機能しますが、Error-Code はなぜか失われます。フロントエンドでさまざまな言語でエラーを表示できるコードが必要です。いろいろ試しましたが、うまくいきませんでした。
これは、私の 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 !
}
}