SoapFault::SoapFault

(no version information, might be only in CVS)

SoapFault::SoapFault --  SoapFault constructor

Description

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

This class is useful when you would like to send SOAP fault responses from the PHP handler. faultcode, faultstring, faultactor and details are standard elements of SOAP Fault; faultname is an optional parameter that can be used to select proper fault encoding from WSDL; headerfault is an optional parameter that can be used during SOAP header handling to report an error in the response header.

例子 1. Some examples

<?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();
?>

It is possible to use PHP exception mechanism to throw SOAP Fault.

例子 2. Some examples

<?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();
?>

See also SoapClient::SoapClient(), SoapClient::__call(), SoapParam::SoapParam(), SoapVar::SoapVar(), and is_soap_fault().


虎的笑话 虎的成语 虎的歇后语