SoapFault::SoapFault

(no version information, might be only in CVS)

SoapFault::SoapFault --  SoapFault コンストラクタ

説明

object SoapFault::SoapFault ( string faultcode, string faultstring [, string faultactor [, mixed detail [, string faultname [, mixed headerfault]]]])

このクラスは、PHPハンドラからSOAPフォールトレスポンスを送信した場合に有用です。 faultcode, faultstring, faultactor および details は、 SOAPフォールトの標準的要素です。 faultname はオプションのパラメータで、WSDLから 適当なフォルトエンコーディングを選択するために使用可能です。 headerfault はオプションのパラメータで、 レスポンスヘッダ内でエラーをレポートするSOAPヘッダ処理を行う際に使用できます。

例 1. いくつかの例

<?php
function test($x)
{
    return new
SoapFault("Server", "Some error message");
}

$server = new SoapServer(null, array('uri' => "http://test-uri/"));
$server->addFunction("test");
$server->handle();
?>

SOAPフォルトを投げるためにPHPの例外機構が使用可能です。

例 2. いくつかの例

<?php
function test($x)
{
    
throw new SoapFault("Server", "Some error message");
}

$server = new SoapServer(null, array('uri' => "http://test-uri/"));
$server->addFunction("test");
$server->handle();
?>

SoapClient::SoapClient(), SoapClient::__call(), SoapParam::SoapParam(), SoapVar::SoapVar(), is_soap_fault()も参照して下さい。