mirror of
https://github.com/php/php-src.git
synced 2024-11-25 10:54:15 +08:00
.. | ||
interop | ||
tests | ||
config.m4 | ||
config.w32 | ||
CREDITS | ||
EXPERIMENTAL | ||
package.xml | ||
php_encoding.c | ||
php_encoding.h | ||
php_http.c | ||
php_http.h | ||
php_packet_soap.c | ||
php_packet_soap.h | ||
php_schema.c | ||
php_schema.h | ||
php_sdl.c | ||
php_sdl.h | ||
php_soap.dsp | ||
php_soap.h | ||
php_xml.c | ||
php_xml.h | ||
readme.html | ||
soap.c | ||
TODO | ||
TODO.old |
<HTML> <HEAD> <TITLE>PHP SOAP Manual</TITLE> <STYLE> TR{ vertical-align: "top"; } TH{ text-align: "left"; } TD:{ text-align: "left"; } </STYLE> </HEAD> <BODY> <A name="ref.soap"> <H1>PHP SOAP</H1> <H2>Introduction</H2> <TABLE BORDER="1"> <TR><TD ALIGN="center"><B>Warning</B></TD></TR> <TR><TD ALIGN="left">This extension is <I>EXPERIMENTAL</I>. 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. </TD></TR> </TABLE> <p> SOAP extension can be used to write SOAP Servers and Clients. It supports subsets of <a href="http://www.w3.org/TR/2000/NOTE-SOAP-20000508" target="_top">SOAP 1.1</a>, <a href="http://www.w3.org/TR/" target="_top">SOAP 1.2</a> and <a href="http://www.w3.org/TR/wsdl" target="_top">WSDL 1.1</a> specifications. </p> <HR> <H2>Requirements</H2> This extension makes use of the <A HREF="http://www.xmlsoft.org" TARGET="_top">GNOME XML library</A>. Download and install this library. You will need at least libxml-2.5.4. <HR> <H2>Installation</H2> This extension is only available if PHP was configured with --enable-soap. <HR> <H2>Runtime Configuration</H2> <p>The behaviour of these functions is affected by settings in php.ini.</p> <TABLE BORDER="1"> <TR><TH>Name</TH><TH>Default</TH><TH>Changeable</TH></TR> <TR><TD>soap.wsdl_cache_enabled</TD><TD>"1"</TD><TD>PHP_INI_ALL</TD></TR> <TR><TD>soap.wsdl_cache_dir</TD><TD>"/tmp"</TD><TD>PHP_INI_ALL</TD></TR> <TR><TD>soap.wsdl_cache_ttl</TD><TD>86400</TD><TD>PHP_INI_ALL</TD></TR> </TABLE> </p>Here is a short explanation of the configuration directives.</p> <dl> <dt><b>soap.wsdl_cache_enabled</b> (boolean)</dt> <dd>enables or disables WSDL caching feature.</dd> <dt><b>soap.wsdl_cache_dir</b> (string)</dt> <dd>sets the directory name where SOAP extension will put cache files</dd> <dt><b>soap.wsdl_cache_ttl</b> (integer)</dt> <dd>(time to live) sets the number of second while cached file will be used instead of original one.</dd> </dl> <HR> <H2>Predefined Constants</H2> The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime. <TABLE BORDER="1"> <TR><TH>Constant</TH><TH>Value</TH><TH>Description</TH></TR> <TR><TH>SOAP_1_1 (integer)</TH><TD>1</TD><TD>SOAP version - SOAP 1.1. Can be used as an option in SoapClient and SoapServer constructors.</TD></TR> <TR><TH>SOAP_1_2 (integer)</TH><TD>2</TD><TD>SOAP version - SOAP 1.2. Can be used as an option in SoapClient and SoapServer constructors.</TD></TR> <TR><TH>SOAP_FUNCTIONS_ALL (integer)</TH><TD>999</TD><TD>Allows to export all defined functions with SoapClient::addFunction</TD></TR> <TR><TH>SOAP_PERSISTENCE_SESSION (integer)</TH><TD>1</TD><TD>Allows making class passed to SoapServer::setClass persistent for a PHP session.</TD></TR> <TR><TH>SOAP_PERSISTENCE_REQUEST (integer)</TH><TD>2</TD><TD>Allows making class passed to SoapServer::setClass non-persistent for a PHP session.</TD></TR> <TR><TH>SOAP_ENCODED (integer)</TH><TD>1</TD><TD>Can be passed as <b>style</b> option to SoapClient constructor in nonWSDL mode.</TD></TR> <TR><TH>SOAP_LITERAL (integer)</TH><TD>2</TD><TD>Can be passed as <b>style</b> option to SoapClient constructor in nonWSDL mode.</TD></TR> <TR><TH>SOAP_RPC (integer)</TH><TD>1</TD><TD>Can be passed as <b>use</b> option to SoapClient constructor in nonWSDL mode.</TD></TR> <TR><TH>SOAP_DOCUMENT (integer)</TH><TD>2</TD><TD>Can be passed as <b>use</b> option to SoapClient constructor in nonWSDL mode.</TD></TR> <TR><TH>SOAP_ACTOR_NEXT (integer)</TH><TD>1</TD><TD>Can be passed as <b>actor</b> to SoapHeader constructor.</TD></TR> <TR><TH>SOAP_ACTOR_NONE (integer)</TH><TD>2</TD><TD>Can be passed as <b>actor</b> to SoapHeader constructor</TD></TR> <TR><TH>SOAP_ACTOR_UNLIMATERECEIVER (integer)</TH><TD>3</TD><TD>Can be passed as <b>actor</b> to SoapHeader constructor</TD></TR> <TR><TH>UNKNOWN_TYPE (integer)</TH><TD>999998</TD><TD>Encoding for unknown type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_STRING (integer)</TH><TD>101</TD><TD>Encoding for standard XMLSchema <b>string</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_BOOLEAN (integer)</TH><TD>102</TD><TD>Encoding for standard XMLSchema <b>boolen</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_DECIMAL (integer)</TH><TD>103</TD><TD>Encoding for standard XMLSchema <b>decimal</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_FLOAT (integer)</TH><TD>104</TD><TD>Encoding for standard XMLSchema <b>float</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_DOUBLE (integer)</TH><TD>105</TD><TD>Encoding for standard XMLSchema <b>double</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_DURATION (integer)</TH><TD>106</TD><TD>Encoding for standard XMLSchema <b>duration</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_DATETIME (integer)</TH><TD>107</TD><TD>Encoding for standard XMLSchema <b>dateTime</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_TIME (integer)</TH><TD>108</TD><TD>Encoding for standard XMLSchema <b>time</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_DATE (integer)</TH><TD>109</TD><TD>Encoding for standard XMLSchema <b>data</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_GYEARMONTH (integer)</TH><TD>110</TD><TD>Encoding for standard XMLSchema <b>gYearMonth</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_GYEAR (integer)</TH><TD>111</TD><TD>Encoding for standard XMLSchema <b>gYear</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_GMONTHDAY (integer)</TH><TD>112</TD><TD>Encoding for standard XMLSchema <b>gMonthDay</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_GDAY (integer)</TH><TD>113</TD><TD>Encoding for standard XMLSchema <b>gDay</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_GMONTH (integer)</TH><TD>114</TD><TD>Encoding for standard XMLSchema <b>gMonth</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_HEXBINARY (integer)</TH><TD>115</TD><TD>Encoding for standard XMLSchema <b>hexBinary</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_BASE64BINARY (integer)</TH><TD>116</TD><TD>Encoding for standard XMLSchema <b>base64Binary</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_ANYURI (integer)</TH><TD>117</TD><TD>Encoding for standard XMLSchema <b>anyURI</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_QNAME (integer)</TH><TD>118</TD><TD>Encoding for standard XMLSchema <b>QName</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_NOTATION (integer)</TH><TD>119</TD><TD>Encoding for standard XMLSchema <b>NOTATION</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_NORMALIZEDSTRING (integer)</TH><TD>120</TD><TD>Encoding for standard XMLSchema <b>normalizedString</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_TOKEN (integer)</TH><TD>121</TD><TD>Encoding for standard XMLSchema <b>token</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_LANGUAGE (integer)</TH><TD>122</TD><TD>Encoding for standard XMLSchema <b>language</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_NMTOKEN (integer)</TH><TD>123</TD><TD>Encoding for standard XMLSchema <b>NMTOKEN</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_NAME (integer)</TH><TD>124</TD><TD>Encoding for standard XMLSchema <b>Name</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_NCNAME (integer)</TH><TD>125</TD><TD>Encoding for standard XMLSchema <b>NCName</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_ID (integer)</TH><TD>126</TD><TD>Encoding for standard XMLSchema <b>ID</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_IDREF (integer)</TH><TD>127</TD><TD>Encoding for standard XMLSchema <b>IDREF</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_IDREFS (integer)</TH><TD>128</TD><TD>Encoding for standard XMLSchema <b>IDREFS</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_ENTITY (integer)</TH><TD>129</TD><TD>Encoding for standard XMLSchema <b>ENTITY</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_ENTITIES (integer)</TH><TD>130</TD><TD>Encoding for standard XMLSchema <b>ENTITIES</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_INTEGER (integer)</TH><TD>131</TD><TD>Encoding for standard XMLSchema <b>integer</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_NONPOSITIVEINTEGER (integer)</TH><TD>132</TD><TD>Encoding for standard XMLSchema <b>nonPositiveInteger</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_NEGATIVEINTEGER (integer)</TH><TD>133</TD><TD>Encoding for standard XMLSchema <b>negativeInteger</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_LONG (integer)</TH><TD>134</TD><TD>Encoding for standard XMLSchema <b>long</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_INT (integer)</TH><TD>135</TD><TD>Encoding for standard XMLSchema <b>int</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_SHORT (integer)</TH><TD>136</TD><TD>Encoding for standard XMLSchema <b>short</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_BYTE (integer)</TH><TD>137</TD><TD>Encoding for standard XMLSchema <b>byte</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_NONNEGATIVEINTEGER (integer)</TH><TD>138</TD><TD>Encoding for standard XMLSchema <b>nonNegativeInteger</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_UNSIGNEDLONG (integer)</TH><TD>139</TD><TD>Encoding for standard XMLSchema <b>unsignedLong</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_UNSIGNEDINT (integer)</TH><TD>140</TD><TD>Encoding for standard XMLSchema <b>unsignedInt</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_UNSIGNEDSHORT (integer)</TH><TD>141</TD><TD>Encoding for standard XMLSchema <b>unsignedShort</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_UNSIGNEDBYTE (integer)</TH><TD>142</TD><TD>Encoding for standard XMLSchema <b>unsignedByte</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_POSITIVEINTEGER (integer)</TH><TD>143</TD><TD>Encoding for standard XMLSchema <b>positiveInteger</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_NMTOKENS (integer)</TH><TD>144</TD><TD>Encoding for standard XMLSchema <b>NMTOKENS</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_ANYTYPE (integer)</TH><TD>145</TD><TD>Encoding for standard XMLSchema <b>anyType</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>SOAP_ENC_ARRAY (integer)</TH><TD>300</TD><TD>Encoding for SOAP <b>Array</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>SOAP_ENC_OBJECT (integer)</TH><TD>301</TD><TD>Encoding for SOAP <b>Struct</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_1999_TIMEINSTANT (integer)</TH><TD>401</TD><TD>Encoding for old XMLSchema <b>timeInstant</b> type. Can be passed to SoapVar constructor.</TD></TR> <TR><TH>XSD_NAMESPACE (string)</TH><TD> </TD><TD>The XML Schema namespace.</TD></TR> <TR><TH>XSD_1999_NAMESPACE (string)</TH><TD> </TD><TD>The old XML Schema namespace.</TD></TR> </TABLE> <HR> <H2>Classes</H2> <h4>List of classes</h4> <table border="0"> <tr><td><a href="#ref.soap.soapclient">SoapClient</a></td></tr> <tr><td><a href="#ref.soap.soapserver">SoapServer</a></td></tr> <tr><td><a href="#ref.soap.soapparam">SoapParam</a></td></tr> <tr><td><a href="#ref.soap.soapvar">SoapVar</a></td></tr> <tr><td><a href="#ref.soap.soapheader">SoapHeader</a></td></tr> <tr><td><a href="#ref.soap.soapfault">SoapFault</a></td></tr> </table> <a name="ref.soap.soapclient"> <h4>SoapClient class</h4> A SOAP client, that allows calling remote methods on SOAP WebService over HTTP or HTTPS. <table border="0"> <tr><td><a href="#ref.soap.soapclient.soapclient">SoapClient</a> -- SoapClient constructor</td></tr> <tr><td><a href="#ref.soap.soapclient.__call">__call</a> -- calls a SOAP function</td></tr> <tr><td><a href="#ref.soap.soapclient.__getlastrequest">__getLastRequest</a> -- returns last SOAP request</td></tr> <tr><td><a href="#ref.soap.soapclient.__getlastresponse">__getLastResponse</a> -- returns last SOAP response</td></tr> <tr><td><a href="#ref.soap.soapclient.__getfunctions">__getFunctions</a> -- returns list of SOAP functions</td></tr> <tr><td><a href="#ref.soap.soapclient.__gettypes">__getTypes</a> -- returns list of SOAP types</td></tr> </table> <a name="ref.soap.soapserver"> <h4>SoapServer class</h4> This class can be used to build SOAP WebServices, which can be accessed from remote SOAP clients over HTTP or HTTPS. <table border="0"> <tr><td><a href="#ref.soap.soapserver.soapserver">SoapServer</a> -- SoapServer constructor</td></tr> <tr><td><a href="#ref.soap.soapserver.addfunction">addFunction</a> -- adds one or several functions those will handle SOAP requests</td></tr> <tr><td><a href="#ref.soap.soapserver.setclass">setClass</a> -- sets class which will handle SOAP requests</td></tr> <tr><td><a href="#ref.soap.soapserver.getfunctions">getFunctions</a> -- returns list of defined functions</td></tr> <tr><td><a href="#ref.soap.soapserver.setpersistence">setPersistence</a> -- sets persistence mode of SoapServer</td></tr> <tr><td><a href="#ref.soap.soapserver.handle">handle</a> -- handles a SOAP request</td></tr> </table> <a name="ref.soap.soapparam"> <h4>SoapParam class</h4> <p> SoapParam is a special low-level class for naming parameters and return values in nonWSDL mode. It is just a data holder and it has not any special method except constructor. </p> <table border="0"> <tr><td><a href="#ref.soap.soapparam.soapparam">SoapParam</a> -- SoapParam constructor</td></tr> </table> <a name="ref.soap.soapvar"> <h4>SoapVar classes</h4> <p> SoapVar is a special low-level class for encoding parameters and return values in nonWSDL mode. It is just a data holder and it has not any special method except constructor. It is useful when you like to set type property in SOAP request or response. </p> <table border="0"> <tr><td><a href="#ref.soap.soapvar.soapvar">SoapVar</a> -- SoapVar constructor</td></tr> </table> <a name="ref.soap.soapheader"> <h4>SoapHeader class</h4> <p> SoapHeader is a special low-level class for passing or returning SOAP headers. It is just a data holder and it has not any special method except constructor. </p> <table border="0"> <tr><td><a href="#ref.soap.soapheader.soapheader">SoapHeader</a> -- SoapHeader constructor</td></tr> </table> <a name="ref.soap.soapfault"> <h4>SoapFault class</h4> <p> SoapFault is a special class that can be used for error reporting during 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. </p> <table border="0"> <tr><td><a href="#ref.soap.soapfault.soapfault">SoapFault</a> -- SoapFault constructor</td></tr> </table> <HR> <!-- <H2>Examples</H2> --> <h4>Table of Contents</h4> <table border="0"> <tr><td><a href="#ref.soap.is_soap_fault">is_soap_fault</a> -- checks if SOAP call was failed</td></tr> <tr><td><a href="#ref.soap.soapclient.soapclient">SoapClient::SoapClient</a> -- SoapClient constructor</td></tr> <tr><td><a href="#ref.soap.soapclient.__call">SoapClient::__call</a> -- calls a SOAP function</td></tr> <tr><td><a href="#ref.soap.soapclient.__getlastrequest">SoapClient::__getLastRequest</a> -- returns last SOAP request</td></tr> <tr><td><a href="#ref.soap.soapclient.__getlastresponse">SoapClient::__getLastResponse</a> -- returns last SOAP response</td></tr> <tr><td><a href="#ref.soap.soapclient.__getfunctions">SoapClient::__getFunctions</a> -- returns list of SOAP functions</td></tr> <tr><td><a href="#ref.soap.soapclient.__gettypes">SoapClient::__getTypes</a> -- returns list of SOAP types</td></tr> <tr><td><a href="#ref.soap.soapserver.soapserver">SoapServer::SoapServer</a> -- SoapServer constructor</td></tr> <tr><td><a href="#ref.soap.soapserver.addfunction">SoapServer::addFunction</a> -- adds one or several functions those will handle SOAP requests</td></tr> <tr><td><a href="#ref.soap.soapserver.setclass">SoapServer::setClass</a> -- sets class which will handle SOAP requests</td></tr> <tr><td><a href="#ref.soap.soapserver.getfunctions">SoapServer::getFunctions</a> -- returns list of defined functions</td></tr> <tr><td><a href="#ref.soap.soapserver.setpersistence">SoapServer::setPersistence</a> -- sets persistence mode of SoapServer</td></tr> <tr><td><a href="#ref.soap.soapserver.handle">SoapServer::handle</a> -- handles a SOAP request</td></tr> <tr><td><a href="#ref.soap.soapparam.soapparam">SoapParam::SoapParam</a> -- SoapParam constructor</td></tr> <tr><td><a href="#ref.soap.soapvar.soapvar">SoapVar::SoapVar</a> -- SoapVar constructor</td></tr> <tr><td><a href="#ref.soap.soapheader.soapheader">SoapHeader::SoapHeader</a> -- SoapHeader constructor</td></tr> <tr><td><a href="#ref.soap.soapfault.soapfault">SoapFault::SoapFault</a> -- SoapFault constructor</td></tr> </table> <a name="ref.soap.is_soap_fault"></a> <h2>is_soap_fault</h2> <p>(PHP 5)</p> <p>checks if SOAP call was failed</p> <h3>Description</h3> <p>bool <b>is_soap_fault</b>(mixed obj)</p> <p> This function is useful when you like to check if the SOAP call was failed, but don't like to use exceptions. To use it you must create SoapClient object with <b>exceptions</b> option set to zero or false. In this case SOAP method will return a special SoapFault object which encapsulate the fault details (faultcode, faultstring, faultactor and faultdetails). If <b>exceptions</b> is not set then SOAP call will throw an exception on error.<br> is_soap_fault() functions checks if the given parameter is a SoapFault object.<br> </p> <h4>Example</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> <?php $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); } ?></PRE></TD></TR></TABLE> <p>Standard method that used by SOAP extension for error reporting is excptions.</p> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> <?php try { $client = SoapClient("some.wsdl"); $result = $client->SomeFunction(...); } catch (SoapFault $fault) { trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faulstring})", E_ERROR); } ?></PRE></TD></TR></TABLE> <a name="ref.soap.soapclient.soapclient"></a> <h2>SoapClient::SoapClient</h2> <p>(PHP 5)</p> <p>SoapClient constructor</p> <h3>Description</h3> <p><b>SoapClient</b>(mixed wsdl [, array options])</p> <p> The constructor allows creating SoapClient objects in WSDL or nonWSDL mode. The first case requires URI of WSDL file as first parameter and optional options array. The second case requires NULL as first parameter and options array with <b>location</b> and <b>uri</b> options set. Where <b>location</b> is a URL to request and <b>uri</b> is a target namespace of the SOAP service. <b>style</b> and <b>use</b> options has effect only on nonWSDL (in WSDL mode they comes from WSDL file). <b>soap_version</b> option allows to work as SOAP 1.1 or SOAP 1.2 client. Some additional optional options allow using HTTP authentication (<b>login</b> and <b>password</b>) and HTTP connection through proxy server (<b>proxy_host</b>, <b>proxy_port</b>, <b>proxy_login</b> and <b>proxy_password</b>). </p> <h4>Examples</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> $client = new SoapClient("some.wsdl"); $client = new SoapClient("some.wsdl",array('soap_version' => SOAP_1_2)); $client = new SoapClient("some.wsdl",array('login' => "some_name", 'password' => "some_password")); $client = new SoapClient("some.wsdl",array('proxy_host' => "localhost", 'proxy_port' => 8080)); $client = new SoapClient("some.wsdl",array('proxy_host' => "localhost", 'proxy_port' => 8080, 'proxy_login' => "some_name", 'proxy_password' => "some_password")); $client = new SoapClient(null,array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $client = new SoapClient(null,array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/", 'style' => SOAP_DOCUMENT, 'use' => SOAP_LITERAL)); </PRE></TD></TR></TABLE> <a name="ref.soap.soapclient.__call"></a> <h2>SoapClient::__call</h2> <p>(PHP 5)</p> <p>calls a SOAP function</p> <h3>Description</h3> <p>mixed <b>__call</b>(string function_name, array arguments, [array options [, mixed input_headers [, mixed &output_headers]]])</p> <p> This is a low level API function to make a SOAP call. Usually in WSDL mode you can simple call SOAP functions as SoapClient methods. It is useful for nonWSDL mode when 'soapaction' is unknown, 'uri' is differ form default or when ypu like to send and/or receive SOAP Headers. To check if function call is failed check the result with is_soap_fault() function.<br> SOAP function may return one or several values. In the first case __call will return just the value of output parameter, in the second it will return array with named output parameters. </p> <h4>Examples</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> $client = new SoapClient("some.wsdl"); $client->SomeFunction($a,$b,$c); $client->__call("SomeFunction",array($a,$b,$c)); $client->__call("SomeFunction",array($a,$b,$c), NULL, new SoapHeader(...), $output_headers); $client = new SoapClient(null,array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $client->SomeFunction($a,$b,$c); $client->__call("SomeFunction",array($a,$b,$c)); $client->__call("SomeFunction",array($a,$b,$c), array('soapaction' => 'some_action', 'uri' => 'some_uri')); </PRE></TD></TR></TABLE> <a name="ref.soap.soapclient.__getlastrequest"></a> <h2>SoapClient::__getLastRequest</h2> <p>(PHP 5)</p> <p>returns last SOAP request</p> <h3>Description</h3> <p>string <b>__getLastRequest</b>()</p> <p> This function works only with SoapClient which was created with trace option. </p> <h4>Example</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> <?php $client = SoapClient("some.wsdl", array('trace'=>1)); $result = $client->SomeFunction(...); echo "REQUEST:\n".$client->__getLastRequest()."\n"; ?> </PRE></TD></TR></TABLE> <a name="ref.soap.soapclient.__getlastresponse"></a> <h2>SoapClient::__getLastResponse</h2> <p>(PHP 5)</p> <p>returns last SOAP response</p> <h3>Description</h3> <p>string <b>__getLastResponse</b>()</p> <p> This function works only with SoapClient which was created with trace option. </p> <h4>Example</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> <?php $client = SoapClient("some.wsdl", array('trace'=>1)); $result = $client->SomeFunction(...); echo "RESPONSE:\n".$client->__getLastResponse()."\n"; ?> </PRE></TD></TR></TABLE> <a name="ref.soap.soapclient.__getfunctions"></a> <h2>SoapClient::__getFunctions</h2> <p>(PHP 5)</p> <p>returns list of SOAP functions</p> <h3>Description</h3> <p>array <b>__getFunctions</b>()</p> <p> This function works only in WSDL mode. </p> <h4>Example</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> <?php $client = SoapClient("some.wsdl"); var_dump($client->__getFunctions()); ?> </PRE></TD></TR></TABLE> <a name="ref.soap.soapclient.__gettypes"></a> <h2>SoapClient::__getTypes</h2> <p>(PHP 5)</p> <p>returns list of SOAP types</p> <h3>Description</h3> <p>array <b>__getTypes</b>()</p> <p> This function works only in WSDL mode. </p> <h4>Example</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> <?php $client = SoapClient("some.wsdl"); var_dump($client->__getTypes()); ?> </PRE></TD></TR></TABLE> <a name="ref.soap.soapserver.soapserver"></a> <h2>SoapServer::SoapServer</h2> <p>(PHP 5)</p> <p>SoapServer constructor</p> <h3>Description</h3> <p><b>SoapServer</b>(mixed wsdl [, array options])</p> It allows creating SoapServer objects in WSDL or nonWSDL mode. In the first case <b>wsdl</b> must be set to URI of WSDL file. In the second <b>wsdl</b> must be set to null and <b>uti</b> option must be set. Additional options allow setting a default SOAP version (<b>soap_version</b>) and actor URI (<b>actor</b>). <h4>Examples</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> $server = new SoapServer("some.wsdl"); $server = new SoapServer("some.wsdl",array('soap_version'=>SOAP_1_2)); $server = new SoapServer("some.wsdl",array('actor'=>"http://example.org/ts-tests/C")); $server = new SoapServer(null,array('uri'=>"http://test-uri/")); </PRE></TD></TR></TABLE> <a name="ref.soap.soapserver.addfunction"> <h2>SoapServer::addFunction</h2> <p>(PHP 5)</p> <p>adds one or several functions those will handle SOAP requests</p> <h3>Description</h3> <p>void <b>addFunction</b>(mixed functions)</p> Exports one or more functions for remote clients. To export one function pass function name into <b>functions</b> parameter as string. To export several functions pass an array of function names and to export all functions pass a special constant <b>SOAP_FUNCTIONS_ALL</b>.<br> Functions must receive all input arguments in the same order as defined in WSDL file (They should not receive any output parameters as arguments) and return one or more values. To return several values they must return array with named output parameters. <h4>Examples</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> function func($inputString) { return $inputString; } $server->addFunction("echoString"); function echoTwoStrings($inputString1, $inputString2) { return array("outputString1"=>$inputString1,"outputString2"=>$inputString2); } $server->addFunction(array("echoString","echoTwoStrings")); $server->addFunction(SOAP_FUNCTIONS_ALL); </PRE></TD></TR></TABLE> <a name="ref.soap.soapserver.setclass"></a> <h2>SoapServer::setClass</h2> <p>(PHP 5)</p> <p>sets class which will handle SOAP requests</p> <h3>Description</h3> <p>void <b>setClass</b>(string class_name [, ...])</p> Exports all methods from specified class. Additional parameters will be passed to default class constructor during object creation. The object can be maiden persistent across request for a given PHP session with <a href="#ref.soap.soapserver.setpersistence">SoapServer::setPersistence</a> method. <h4>Examples</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> $server->setClass("foo"); $server->setClass("foo", $arg1, $arg2); </PRE></TD></TR></TABLE> <a name="ref.soap.soapserver.getfunctions"> <h2>SoapServer::getFunctions</h2> <p>(PHP 5)</p> <p>returns list of defined functions</p> <h3>Description</h3> <p>array <b>getFunctions</b>()</p> <a name="ref.soap.soapserver.setpersistence"></a> <h2>SoapServer::setPersistence</h2> <p>(PHP 5)</p> <p>sets persistence mode of SoapServer</p> <h3>Description</h3> <p>void <b>setPersistence</b>(int mode)</p> This function allows saving data between requests in PHP session. It works only with server that exports functions form class (see <a href="#ref.soap.soapserver.setclass">SoapServer:setCalss</a>). <h4>Examples</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> $server->setpersistence(SOAP_PERSISTENCE_SESSION); $server->setpersistence(SOAP_PERSISTENCE_REQUEST); </PRE></TD></TR></TABLE> <a name="ref.soap.soapserver.handle"></a> <h2>SoapServer::handle</h2> <p>(PHP 5)</p> <p>handles a SOAP request</p> <h3>Description</h3> <p>void <b>handle</b>([string soap_envelope])</p> It processes a SOAP request, call necessary functions, and send response back. It assumes request in input parameter or in global <b>$HTTP_RAW_POST_DATA</b> PHP variable if the argument is omitted. <h4>Example</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> <?php function test($x) { return $x; } $server = new SoapServer(null,array('uri'=>"http://test-uri/")); $server->addFunction("test"); $server->handle(); ?> </PRE></TD></TR></TABLE> <a name="ref.soap.soapparam.soapparam"></a> <h2>SoapParam::SoapParam</h2> <p>(PHP 5)</p> <p>SoapParam constructor</p> <h3>Description</h3> <p><b>SoapParam</b>(mixed data, string name)</p> <p> SoapParam is a special low-level class for naming parameters and return values in nonWSDL mode. It is just a data holder and it has not any special method except constructor. The constructor takes <b>data</b> to pass or return and <b>name</b>. It is possible to pass parameter directly as PHP value, but in this case it will be named as <b><i>paramN</i></b> and SOAP Service may not understand it. </p> <h4>Example</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> <?php $client = new SoapClient(null,array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $client->SomeFunction(new SoapParam($a,"a"), new SoapParam($b,"b"), new SoapParam($c,"c")); ?> </PRE></TD></TR></TABLE> <a name="ref.soap.soapvar.soapvar"></a> <h2>SoapVar::SoapVar</h2> <p>(PHP 5)</p> <p>SoapVar constructor</p> <h3>Description</h3> <p><b>SoapVar</b>(mixed data, int encoding [, string type [, string type_ns [, string name [, string name_ns]]]])</p> <p> SoapVar is a special low-level class for encoding parameters and return values in nonWSDL mode. It is just a data holder and it has not any special method except constructor. It is useful when you like to set type property in SOAP request or response. The constructor takes <b>data</b> to pass or return, <b>encoding</b> ID to encode it (see <b><i>XSD_...</i></b> constants) and as option type name and namespace and value name and namespace. </p> <h4>Example</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> <?php class SOAPStruct { function SOAPStruct($s, $i, $f) { $this->varString = $s; $this->varInt = $i; $this->varFloat = $f; } } $client = new SoapClient(null,array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $struct = new SOAPStruct('arg',34,325.325); $soapstruct = new SoapVar($struct,SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd"); $client->echoStruct(new SoapParam($soapstruct, "inputStruct")); ?> </PRE></TD></TR></TABLE> <a name="ref.soap.soapheader.soapheader"></a> <h2>SoapHeader::SoapHeader</h2> <p>(PHP 5)</p> <p>SoapHeader constructor</p> <h3>Description</h3> <p><b>SoapHeader</b>(string name_ns, string name [, mixed data [, bool must_understand [, mixed actor]]])</p> <p> SoapHeader is a special low-level class for passing or returning SOAP headers. It is just a data holder and it has not any special method except constructor. It can be used in <a href="#ref.soap.soapclient.__call">SoapClient::__call</a> method to pass SOAP header or in SOAP header handler to return header in SOAP response. <b>name_ns</b> and <b>name</b> are namespace and name of the SOAP header element. <b>data</b> is a SOAP header's content. It can be a PHP value or SoapVar object. <b>must_understand</b> and <b>actor</b> are values for <b><i>mustUnderstand</i></b> and <b><i>actor</i></b> attributes of this SOAP Header element. </p> <h4>Example</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> <?php $client = new SoapClient(null,array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $client->__call("echoVoid",NULL,NULL, new SoapHeader('http://soapinterop.org/echoheader/', 'echoMeStringRequest', 'hello world')); ?> </PRE></TD></TR></TABLE> <a name="ref.soap.soapfault.soapfault"></a> <h2>SoapFault::SoapFault</h2> <p>(PHP 5)</p> <p>SoapFault constructor</p> <h3>Description</h3> <p><b>SoapFault</b>(string faultcode, string faultstring [, string faultactor [, mixed details [, string faultname [, mixed headerfault]]]])</p> This class is useful when you like to send SOAP fault response from PHP handler.<br> <b>faultcode</b>, <b>faultstring</b>, <b>faultactor</b> and <b>details</b> are standard elements of SOAP Fault;<br> <b>faultname</b> is an optional parameter that can be used to select proper fault encoding from WSDL.<br> <b>headerfault</b> is an optional parameter that can be used during SOAP header handling to report error in response header. <h4>Example</h4> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> <?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(); ?> </PRE></TD></TR></TABLE> <p>It is possible to use PHP exception mechanism to throw SOAP Fault.</p> <TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> <?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(); ?> </PRE></TD></TR></TABLE> </BODY> </HTML>