From 71380e7d7fbed263e865a33489b02c707447af6e Mon Sep 17 00:00:00 2001
From: Dmitry Stogov
+SOAP extension can be used to write SOAP Servers and Clients. It supports
+subsets of SOAP 1.1,
+SOAP 1.2 and
+WSDL 1.1 specifications.
+ The behaviour of these functions is affected by settings in php.ini.
-FIXME
+This extension is EXPERIMENTAL. The behaviour of this extension -- including the names of its functions and anything else documented about this extension -- may change without notice in a future release of PHP. Use this extension at your own risk.
Requirements
This extension makes use of the GNOME XML library. Download and install this library. You will need at least libxml-2.5.4.
Installation
This extension is only available if PHP was configured with --enable-soap.
+
+Runtime Configuration
+
+
+
+Name Default Changeable
+soap.wsdl_cache_enabled "1" PHP_INI_ALL
+soap.wsdl_cache_dir "/tmp" PHP_INI_ALL
+soap.wsdl_cache_ttl 86400 PHP_INI_ALL
SoapFault is a special class that can be used for error reporting during -handling of SOAP request (on server). It has not any special methods except -constructor. +handling of SOAP request. It is derived form standard PHP Exception class, +so it can be used to throw exceptions in server side and to catch tham on +client side.
SoapFault -- SoapFault constructor |
<?php - $client = SoapClient("some.wsdl"); + $client = SoapClient("some.wsdl",array("exceptions"=>0)); $result = $client->SomeFunction(...); if (is_soap_fault($result)) { trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faulstring})", E_ERROR); } ?> |
Standard method that used by SOAP extension for error reporting is excptions.
++<?php + try { + $client = SoapClient("some.wsdl"); + $result = $client->SomeFunction(...); + } catch {SoapFault $fault) { + trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faulstring})", E_ERROR); + } +?> |
It is possible to use PHP exception mechanism to throw SOAP Fault.
++<?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: SoapServer::fault