This function currently terminates execution as well, which may be undesirable. See: http://bugs.php.net/bug.php?id=49513(PHP 5, PHP 7, PHP 8)
SoapServer::fault β Π‘ΠΎΠΎΠ±ΡΠ°Π΅Ρ ΠΎ ΡΠ±ΠΎΠ΅ SOAP-ΡΠ΅ΡΠ²Π΅ΡΠ° ΠΈΠ·-Π·Π° ΠΎΡΠΈΠ±ΠΊΠΈ
$code,$string,$actor = "",$details = null,$name = "",$lang = ""ΠΠ΅ΡΠΎΠ΄ ΡΠΎΠΎΠ±ΡΠ°Π΅Ρ ΠΎ ΡΠ±ΠΎΠ΅ Π² ΠΎΡΠ²Π΅ΡΠ΅ Π½Π° ΡΠ΅ΠΊΡΡΠΈΠΉ Π·Π°ΠΏΡΠΎΡ ΠΊΠ»ΠΈΠ΅Π½ΡΠ° ΠΈ ΡΠΊΠ°Π·ΡΠ²Π°Π΅Ρ ΠΏΡΠΈΡΠΈΠ½Ρ ΠΎΡΠΈΠ±ΠΊΠΈ.
ΠΠ°ΠΌΠ΅ΡΠ°Π½ΠΈΠ΅:
ΠΠ΅ΡΠΎΠ΄ Π²ΡΠ·ΡΠ²Π°ΡΡ ΡΠΎΠ»ΡΠΊΠΎ ΠΏΡΠΈ ΠΎΠ±ΡΠ°Π±ΠΎΡΠΊΠ΅ Π·Π°ΠΏΡΠΎΡΠ°.
codeΠΠΎΠ΄ ΠΎΡΠΈΠ±ΠΊΠΈ Π΄Π»Ρ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°.
stringΠΡΠ°ΡΠΊΠΎΠ΅ ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ ΠΎΡΠΈΠ±ΠΊΠΈ.
actorΠ‘ΡΡΠΎΠΊΠ° ΠΈΠ΄Π΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΈΠΈ ΡΡΠ°ΡΡΠ½ΠΈΠΊΠ°, ΠΊΠΎΡΠΎΡΡΠΉ ΡΠ³Π΅Π½Π΅ΡΠΈΡΠΎΠ²Π°Π» ΠΎΡΠΈΠ±ΠΊΡ.
detailsΠΠΎΠ΄ΡΠΎΠ±Π½ΠΎΡΡΠΈ ΠΎ ΠΏΡΠΈΡΠΈΠ½Π°Ρ ΠΎΡΠΈΠ±ΠΊΠΈ.
nameΠΠ°Π·Π²Π°Π½ΠΈΠ΅, ΠΊΠΎΡΠΎΡΠΎΠ΅ ΡΠΊΠ°Π·ΡΠ²Π°Π΅Ρ ΠΊΠ»ΠΈΠ΅Π½ΡΡ ΡΠΈΠΏ ΠΈ ΡΡΡΡΠΊΡΡΡΡ ΠΎΡΠΈΠ±ΠΊΠΈ Π² WSDL-ΠΎΠΏΠΈΡΠ°Π½ΠΈΠΈ.
langΠ€ΡΠ½ΠΊΡΠΈΡ Π½Π΅ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π·Π½Π°ΡΠ΅Π½ΠΈΡ ΠΏΠΎΡΠ»Π΅ Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΡ.
| ΠΠ΅ΡΡΠΈΡ | ΠΠΏΠΈΡΠ°Π½ΠΈΠ΅ |
|---|---|
| 8.5.0 |
Π ΠΌΠ΅ΡΠΎΠ΄ Π΄ΠΎΠ±Π°Π²ΠΈΠ»ΠΈ Π½Π΅ΠΎΠ±ΡΠ·Π°ΡΠ΅Π»ΡΠ½ΡΠΉ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡ lang,
ΡΡΠΎΠ±Ρ ΠΎΠ±ΡΠ΅ΠΊΡ ΠΎΡΠΈΠ±ΠΊΠΈ ΡΠΎΠΎΡΠ²Π΅ΡΡΡΠ²ΠΎΠ²Π°Π» ΡΠΏΠ΅ΡΠΈΡΠΈΠΊΠ°ΡΠΈΠΈ ΠΏΡΠΎΡΠΎΠΊΠΎΠ»Π° SOAP 1.2.
|
This function currently terminates execution as well, which may be undesirable. See: http://bugs.php.net/bug.php?id=49513If you use Adobe Flex, Flash or AIR as SOAP client and are unable to get the error message in case of a soap fault, upgrade to PHP 5.2.6.
Details in:
http://bugs.php.net/bug.php?id=43507hi,
to control the fault output one may do the following
/**
* mySoapServer class
*/
class mySoapServer extends SoapServer {
public function __construct($wsdl, array $options = null) {
parent::SoapServer($wsdl, $options);
}
public function fault ($code, $string, $actor = null, $details = null, $name = null) {
throw new SoapFault($code, $string, $actor, $details, $name);
}
}
Use:
try {
$server = new mySoapServer(null, array('uri' => $_SERVER['REQUEST_URI']));
$server->setClass('mySoapAPI');
$server->handle();
} catch (SoapFault $exc) {
echo $exc->getTraceAsString();
}
that how i did this,
hope iot can help some one.This function also sends a 500 response code back to the client with the request.
This was causing issues with an Apache Axis 1.2 client I had so I instead implemented by own fault handling:
<?php
header("Content-Type: text/xml");
header("Status: 200");
die("<SOAP-ENV:Envelope xmlns:SOAP-ENV=\\"http://schemas.xmlsoap.org/soap/envelope/\\">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>500</faultcode>
<faultstring>".$ex->getMessage())."</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>");
?>