SoapFault->__construct()
(No version information available, might be only in CVS)
SoapFault->__construct() — SoapFault コンストラクタ
説明
SoapFault
__construct
( string $faultcode
, string $faultstring
[, string $faultactor
[, mixed $detail
[, string $faultname
[, SoapHeader $headerfault
]]]] )
このクラスは、PHP ハンドラから SOAP フォールトレスポンスを送信した場合に有用です。 faultcode , faultstring , faultactor および details は SOAP フォールトの標準的な要素です。
パラメータ
- faultcode
-
SoapFault のエラーコード
- faultstring
-
SoapFault のエラーメッセージ
- faultactor
-
エラーの原因となったアクターを識別する文字列
- detail
-
- faultname
-
WSDL からの厳密なフォールトエンコーディングを取得するために利用可能
- headerfault
-
レスポンスヘッダにおいて SOAP ハンドラがエラーの報告処理を行っている間に利用可能 Can be used during SOAP header handling to report an error in the response header.
例
Example#1 いくつかの例
<?php
function test($x)
{
return new SoapFault("Server", "Some error message");
}
$server = new SoapServer(null, array('uri' => "https://test-uri/"));
$server->addFunction("test");
$server->handle();
?>
SOAP フォールトを投げるために PHP の例外機構を使用することができます。
Example#2 いくつかの例
<?php
function test($x)
{
throw new SoapFault("Server", "Some error message");
}
$server = new SoapServer(null, array('uri' => "https://test-uri/"));
$server->addFunction("test");
$server->handle();
?>