SOAP is_soap_fault
(PHP 5, PHP 7, PHP 8)
is_soap_fault — SOAP 호출이 실패했는지 확인
설명
is_soap_fault(mixed $object
): bool
이 함수는 SOAP 호출이 실패했는지 확인하는 데 유용하지만 예외는 사용하지 않습니다. 이를 사용하려면 예외 옵션이 0 또는 false
로 설정된 SoapClient 객체를 생성하십시오. 이 경우 SOAP 메서드는 오류 세부 정보(faultcode, faultstring, faultactor 및 faultdetails)를 캡슐화하는 특수 SoapFault 개체를 반환합니다.
exceptions
가 설정되지 않은 경우 SOAP 호출은 오류 시 예외를 발생시킵니다. is_soap_fault()는 주어진 매개변수가 SoapFault 객체인지 확인합니다.
매개변수
object
- 테스트할 개체입니다.
반환 값
이것은 오류가 발생하면 true
를 반환하고 그렇지 않으면 false
를 반환합니다.
Examples
예제 #1 is_soap_fault() 예제
<?php
$client = new SoapClient("some.wsdl", array('exceptions' => 0));
$result = $client->SomeFunction();
if (is_soap_fault($result)) {
trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})", E_USER_ERROR);
}
?>
예제 #1 오류 보고를 위한 SOAP의 표준 메서드는 예외입니다.
<?php
try {
$client = new SoapClient("some.wsdl");
$result = $client->SomeFunction(/* ... */);
} catch (SoapFault $fault) {
trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}
?>
기타
- SoapClient::__construct() - SoapClient constructor
- SoapFault::__construct() - SoapFault constructor