diff options
author | Dmitry Stogov <dmitry@php.net> | 2004-02-05 20:26:05 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2004-02-05 20:26:05 +0000 |
commit | 508273780c5fad4aa000abae84ced11cc055cbda (patch) | |
tree | adad08b08f91ce7370512ef6a299f1238ec75770 | |
parent | 0e3ce62c7b5f28fb9052f62d14d059a2555316a0 (diff) | |
download | php-git-508273780c5fad4aa000abae84ced11cc055cbda.tar.gz |
PHP API was changed (see readme.html for more details).
24 files changed, 872 insertions, 290 deletions
diff --git a/ext/soap/TODO b/ext/soap/TODO index e05dd232d2..bd4743bcce 100644 --- a/ext/soap/TODO +++ b/ext/soap/TODO @@ -1,11 +1,10 @@ General ------- -- rename soapobject to soapclient - make sure soapserver.map(), soap_encode_to_xml() and soap_encode_to_zval() are really need - reimplement SoapObject::__getfunctions() and SoapObject::__gettypes() to return structures instead of strings - memory leaks (libxml and WSDL/Schema use malloc to cache WSDL) - +- error handling??? SOAP ---- @@ -89,10 +88,6 @@ Schema ? support for user defined complex types ? full support for content model encoding/decoding -Error Handling --------------- -- ??? - Transport --------- ? HTTP status codes @@ -100,11 +95,10 @@ Transport - support for HTTP compression (gzip,x-gzip,defalte) - transport abstraction layer??? -UDDI ----- -- ??? - Interop Testing --------------- -- more rounds/groups +- more introp rounds/groups + +UDDI +---- - ??? diff --git a/ext/soap/interop/client_round2_interop.php b/ext/soap/interop/client_round2_interop.php index 7d9f90455e..b543d31643 100644 --- a/ext/soap/interop/client_round2_interop.php +++ b/ext/soap/interop/client_round2_interop.php @@ -90,8 +90,8 @@ class Interop_Client $this->_getEndpoints($test, 1); // retreive endpoints from the endpoint server - $endpointArray = $soapclient->__call("GetEndpointInfo",array("groupName"=>$test),"http://soapinterop.org/","http://soapinterop.org/"); - if ($soapclient->__isfault() || PEAR::isError($endpointArray)) { + $endpointArray = $soapclient->__call("GetEndpointInfo",array("groupName"=>$test),array('soapaction'=>"http://soapinterop.org/",'uri'=>"http://soapinterop.org/")); + if (is_soap_fault($endpointArray) || PEAR::isError($endpointArray)) { print "<pre>".$soapclient->wire."\n"; print_r($endpointArray); print "</pre>"; @@ -134,7 +134,7 @@ class Interop_Client */ function fetchEndpoints($test = NULL) { // fetch from the interop server - $soapclient = new SoapObject($this->interopServer); + $soapclient = new SoapClient($this->interopServer); if ($test) { $this->_fetchEndpoints($soapclient, $test); @@ -358,8 +358,7 @@ class Interop_Client if ($this->useWSDL) { if (array_key_exists('wsdlURL',$endpoint_info)) { if (!array_key_exists('client',$endpoint_info)) { - $endpoint_info['client'] = new SoapObject($endpoint_info['wsdlURL']); - $endpoint_info['client']->__trace(1); + $endpoint_info['client'] = new SoapClient($endpoint_info['wsdlURL'], array("trace"=>1)); } $soap =& $endpoint_info['client']; @@ -394,8 +393,7 @@ class Interop_Client $soapaction = 'urn:soapinterop'; } if (!array_key_exists('client',$endpoint_info)) { - $endpoint_info['client'] = new SoapObject($endpoint_info['endpointURL'],$soapaction); - $endpoint_info['client']->__trace(1); + $endpoint_info['client'] = new SoapClient(null,array('location'=>$endpoint_info['endpointURL'],'uri'=>$soapaction,'trace'=>1)); } $soap = $endpoint_info['client']; } @@ -418,14 +416,14 @@ class Interop_Client $return = eval('return $soap->'.$soap_test->method_name.'('.$args.');'); } else { if ($soap_test->headers || $soap_test->headers_expect) { - $return = $soap->__call($soap_test->method_name,$soap_test->method_params,$soapaction, $namespace, $soap_test->headers, $result_headers); + $return = $soap->__call($soap_test->method_name,$soap_test->method_params,array('soapaction'=>$soapaction,'uri'=>$namespace), $soap_test->headers, $result_headers); } else { - $return = $soap->__call($soap_test->method_name,$soap_test->method_params,$soapaction, $namespace); + $return = $soap->__call($soap_test->method_name,$soap_test->method_params,array('soapaction'=>$soapaction,'uri'=>$namespace)); } } - if(!$soap->__isfault()){ + if(!is_soap_fault($return)){ if ($soap_test->expect !== NULL) { $sent = $soap_test->expect; } else if (is_array($soap_test->method_params) && count($soap_test->method_params) == 1) { @@ -493,7 +491,7 @@ class Interop_Client ); } } else { - $fault = $soap->__getfault(); + $fault = $return; if ($soap_test->expect_fault) { $ok = 1; $res = 'OK'; diff --git a/ext/soap/interop/server_round2_base.php b/ext/soap/interop/server_round2_base.php index b059cd887f..50c98aa139 100644 --- a/ext/soap/interop/server_round2_base.php +++ b/ext/soap/interop/server_round2_base.php @@ -99,8 +99,7 @@ class SOAP_Interop_Base { } } -$server = new SoapServer("http://soapinterop.org/"); -$server->bind((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/interop.wsdl.php"); +$server = new SoapServer((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/interop.wsdl.php"); $server->setClass("SOAP_Interop_Base"); $server->handle(); ?>
\ No newline at end of file diff --git a/ext/soap/interop/server_round2_groupB.php b/ext/soap/interop/server_round2_groupB.php index 9501912008..a390a4c75a 100644 --- a/ext/soap/interop/server_round2_groupB.php +++ b/ext/soap/interop/server_round2_groupB.php @@ -52,8 +52,7 @@ class SOAP_Interop_GroupB { } } -$server = new SoapServer("http://soapinterop.org/"); -$server->bind((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/interopB.wsdl.php"); +$server = new SoapServer((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/interopB.wsdl.php"); $server->setClass("SOAP_Interop_GroupB"); $server->handle(); ?>
\ No newline at end of file diff --git a/ext/soap/interop/server_round2_groupC.php b/ext/soap/interop/server_round2_groupC.php index 5d5544b1db..539c9f4d6e 100644 --- a/ext/soap/interop/server_round2_groupC.php +++ b/ext/soap/interop/server_round2_groupC.php @@ -41,8 +41,7 @@ class SOAP_Interop_GroupC { } } -$server = new SoapServer("http://soapinterop.org/"); -$server->bind((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/echoheadersvc.wsdl.php"); +$server = new SoapServer((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/echoheadersvc.wsdl.php"); $server->setClass("SOAP_Interop_GroupC"); $server->handle(); ?>
\ No newline at end of file diff --git a/ext/soap/php_encoding.h b/ext/soap/php_encoding.h index 5e82854ef2..4673d3ee0e 100644 --- a/ext/soap/php_encoding.h +++ b/ext/soap/php_encoding.h @@ -46,49 +46,49 @@ #define XSD_STRING 101 #define XSD_STRING_STRING "string" -#define XSD_BOOLEAN 103 +#define XSD_BOOLEAN 102 #define XSD_BOOLEAN_STRING "boolean" -#define XSD_DECIMAL 104 +#define XSD_DECIMAL 103 #define XSD_DECIMAL_STRING "decimal" -#define XSD_FLOAT 105 +#define XSD_FLOAT 104 #define XSD_FLOAT_STRING "float" -#define XSD_DOUBLE 106 +#define XSD_DOUBLE 105 #define XSD_DOUBLE_STRING "double" -#define XSD_DURATION 107 +#define XSD_DURATION 106 #define XSD_DURATION_STRING "duration" -#define XSD_DATETIME 108 +#define XSD_DATETIME 107 #define XSD_DATETIME_STRING "dateTime" -#define XSD_TIME 109 +#define XSD_TIME 108 #define XSD_TIME_STRING "time" -#define XSD_DATE 110 +#define XSD_DATE 109 #define XSD_DATE_STRING "date" -#define XSD_GYEARMONTH 111 +#define XSD_GYEARMONTH 110 #define XSD_GYEARMONTH_STRING "gYearMonth" -#define XSD_GYEAR 112 +#define XSD_GYEAR 111 #define XSD_GYEAR_STRING "gYear" -#define XSD_GMONTHDAY 113 +#define XSD_GMONTHDAY 112 #define XSD_GMONTHDAY_STRING "gMonthDay" -#define XSD_GDAY 114 +#define XSD_GDAY 113 #define XSD_GDAY_STRING "gDay" -#define XSD_GMONTH 115 +#define XSD_GMONTH 114 #define XSD_GMONTH_STRING "gMonth" -#define XSD_HEXBINARY 116 +#define XSD_HEXBINARY 115 #define XSD_HEXBINARY_STRING "hexBinary" -#define XSD_BASE64BINARY 117 +#define XSD_BASE64BINARY 116 #define XSD_BASE64BINARY_STRING "base64Binary" -#define XSD_ANYURI 118 +#define XSD_ANYURI 117 #define XSD_ANYURI_STRING "anyURI" -#define XSD_QNAME 119 +#define XSD_QNAME 118 #define XSD_QNAME_STRING "QName" -#define XSD_NOTATION 120 +#define XSD_NOTATION 119 #define XSD_NOTATION_STRING "NOTATION" -#define XSD_NORMALIZEDSTRING 121 +#define XSD_NORMALIZEDSTRING 120 #define XSD_NORMALIZEDSTRING_STRING "normalizedString" -#define XSD_TOKEN 122 +#define XSD_TOKEN 121 #define XSD_TOKEN_STRING "token" -#define XSD_LANGUAGE 123 +#define XSD_LANGUAGE 122 #define XSD_LANGUAGE_STRING "language" -#define XSD_NMTOKEN 124 +#define XSD_NMTOKEN 123 #define XSD_NMTOKEN_STRING "NMTOKEN" #define XSD_NAME 124 #define XSD_NAME_STRING "Name" @@ -98,44 +98,44 @@ #define XSD_ID_STRING "ID" #define XSD_IDREF 127 #define XSD_IDREF_STRING "IDREF" -#define XSD_IDREFS 127 +#define XSD_IDREFS 128 #define XSD_IDREFS_STRING "IDREFS" -#define XSD_ENTITY 128 +#define XSD_ENTITY 129 #define XSD_ENTITY_STRING "ENTITY" -#define XSD_ENTITIES 129 -#define XSD_ENTITIES_STRING "ENTITYS" -#define XSD_INTEGER 130 +#define XSD_ENTITIES 130 +#define XSD_ENTITIES_STRING "ENTITIES" +#define XSD_INTEGER 131 #define XSD_INTEGER_STRING "integer" -#define XSD_NONPOSITIVEINTEGER 131 +#define XSD_NONPOSITIVEINTEGER 132 #define XSD_NONPOSITIVEINTEGER_STRING "nonPositiveInteger" -#define XSD_NEGATIVEINTEGER 132 +#define XSD_NEGATIVEINTEGER 133 #define XSD_NEGATIVEINTEGER_STRING "negativeInteger" -#define XSD_LONG 133 +#define XSD_LONG 134 #define XSD_LONG_STRING "long" -#define XSD_INT 134 +#define XSD_INT 135 #define XSD_INT_STRING "int" -#define XSD_SHORT 135 +#define XSD_SHORT 136 #define XSD_SHORT_STRING "short" -#define XSD_BYTE 136 +#define XSD_BYTE 137 #define XSD_BYTE_STRING "byte" -#define XSD_NONNEGATIVEINTEGER 137 +#define XSD_NONNEGATIVEINTEGER 138 #define XSD_NONNEGATIVEINTEGER_STRING "nonNegativeInteger" -#define XSD_UNSIGNEDLONG 138 +#define XSD_UNSIGNEDLONG 139 #define XSD_UNSIGNEDLONG_STRING "unsignedLong" -#define XSD_UNSIGNEDINT 139 +#define XSD_UNSIGNEDINT 140 #define XSD_UNSIGNEDINT_STRING "unsignedInt" -#define XSD_UNSIGNEDSHORT 140 +#define XSD_UNSIGNEDSHORT 141 #define XSD_UNSIGNEDSHORT_STRING "unsignedShort" -#define XSD_UNSIGNEDBYTE 141 +#define XSD_UNSIGNEDBYTE 142 #define XSD_UNSIGNEDBYTE_STRING "unsignedByte" -#define XSD_POSITIVEINTEGER 142 +#define XSD_POSITIVEINTEGER 143 #define XSD_POSITIVEINTEGER_STRING "positiveInteger" -#define XSD_ANYTYPE 143 +#define XSD_NMTOKENS 144 +#define XSD_NMTOKENS_STRING "NMTOKENS" +#define XSD_ANYTYPE 145 #define XSD_ANYTYPE_STRING "anyType" -#define XSD_UR_TYPE 144 +#define XSD_UR_TYPE 146 #define XSD_UR_TYPE_STRING "ur-type" -#define XSD_NMTOKENS 145 -#define XSD_NMTOKENS_STRING "NMTOKENS" #define APACHE_NAMESPACE "http://xml.apache.org/xml-soap" #define APACHE_MAP 200 diff --git a/ext/soap/readme.html b/ext/soap/readme.html new file mode 100644 index 0000000000..e636cb09e2 --- /dev/null +++ b/ext/soap/readme.html @@ -0,0 +1,570 @@ +<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> +<I>FIXME</I> +<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> +<I>FIXME</I> +<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> +</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> +<tr><td><a href="#ref.soap.soapserver.fault">fault</a> -- generates SOAP fault response</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> +<HR> +<!-- +<H2>Examples</H2> +--> +<h4>Table of Contents</h4> +<table border="0"> +<tr><td><a href="#ref.soap.is_soap_fault">is_sopa_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.soapserver.fault">SoapServer::fault</a> -- generates SOAP fault response</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> +</table> + +<a name="ref.soap.is_soap_fault"></a> +<h2>is_sopa_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. +In this case SOAP method returns a special SoapFault object which encapsulate +the fault details (faultcode, faultstring, faultactor and faultdetails). +is_soap_fault() functions checks if the given parameter is a SoapFault object. +</p> +<h4>Example</h4> +<TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> +<?php + $client = SoapClient("some.wsdl"); + $result = $client->SomeFunction(...); + if (is_soap_fault($result)) { + trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->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> +<h4>Examples</h4> +<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> +<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. +</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>. +<h4>Examples</h4> +<TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> + $server->addFunction("func"); + + $server->addFunction(array("func1","func2")); + + $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>()</p> +It processes a SOAP request, call necessary functions, and send response back. +It assumes request in global <b>$HTTP_RAW_POST_DATA</b> PHP variable. +<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.soapserver.fault"></a> +<h2>SoapServer::fault</h2> +<p>(PHP 5)</p> +<p>generates SOAP fault response</p> +<h3>Description</h3> +<p>void <b>fault</b>(string faultcode, string faultstring [, string faultactor [, mixed details]])</p> +This function is useful when you like to send SOAP fault response from PHP handler. +It never returns. +<h4>Example</h4> +<TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php"> +<?php + function test($x) { + global $server; + $server->fault("Server","Some error message"); + } + + $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> +</BODY> +</HTML>
\ No newline at end of file diff --git a/ext/soap/soap.c b/ext/soap/soap.c index d9bf00e909..7e8cf86f0c 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -108,16 +108,16 @@ static void soap_error_handler(int error_num, const char *error_filename, const static zend_class_entry* soap_class_entry; static zend_class_entry* soap_server_class_entry; static zend_class_entry* soap_fault_class_entry; +static zend_class_entry* soap_header_class_entry; +static zend_class_entry* soap_param_class_entry; zend_class_entry* soap_var_class_entry; -zend_class_entry* soap_param_class_entry; -zend_class_entry* soap_header_class_entry; ZEND_DECLARE_MODULE_GLOBALS(soap) static void (*old_error_handler)(int, const char *, const uint, const char*, va_list); #define PHP_SOAP_SERVER_CLASSNAME "soapserver" -#define PHP_SOAP_CLASSNAME "soapobject" +#define PHP_SOAP_CLIENT_CLASSNAME "soapclient" #define PHP_SOAP_VAR_CLASSNAME "soapvar" #define PHP_SOAP_FAULT_CLASSNAME "soapfault" #define PHP_SOAP_PARAM_CLASSNAME "soapparam" @@ -155,6 +155,7 @@ static char *zend_str_tolower_copy(char *dest, const char *source, unsigned int PHP_FUNCTION(soap_encode_to_xml); PHP_FUNCTION(soap_encode_to_zval); PHP_FUNCTION(use_soap_error_handler); +PHP_FUNCTION(is_soap_fault); /* Server Functions */ @@ -164,24 +165,18 @@ PHP_METHOD(soapserver,addfunction); PHP_METHOD(soapserver,getfunctions); PHP_METHOD(soapserver,handle); PHP_METHOD(soapserver,setpersistence); -PHP_METHOD(soapserver,bind); PHP_METHOD(soapserver,fault); #ifdef HAVE_PHP_DOMXML PHP_METHOD(soapserver,map); #endif /* Client Functions */ -PHP_METHOD(soapobject, soapobject); -PHP_METHOD(soapobject, __login); -PHP_METHOD(soapobject, __useproxy); -PHP_METHOD(soapobject, __isfault); -PHP_METHOD(soapobject, __getfault); -PHP_METHOD(soapobject, __call); -PHP_METHOD(soapobject, __getfunctions); -PHP_METHOD(soapobject, __gettypes); -PHP_METHOD(soapobject, __trace); -PHP_METHOD(soapobject, __getlastresponse); -PHP_METHOD(soapobject, __getlastrequest); +PHP_METHOD(soapclient, soapclient); +PHP_METHOD(soapclient, __call); +PHP_METHOD(soapclient, __getlastrequest); +PHP_METHOD(soapclient, __getlastresponse); +PHP_METHOD(soapclient, __getfunctions); +PHP_METHOD(soapclient, __gettypes); /* SoapVar Functions */ PHP_METHOD(soapvar, soapvar); @@ -201,6 +196,7 @@ static zend_function_entry soap_functions[] = { PHP_FE(soap_encode_to_zval, NULL) #endif PHP_FE(use_soap_error_handler, NULL) + PHP_FE(is_soap_fault, NULL) {NULL, NULL, NULL} }; @@ -216,7 +212,6 @@ static zend_function_entry soap_server_functions[] = { PHP_ME(soapserver, addfunction, NULL, 0) PHP_ME(soapserver, getfunctions, NULL, 0) PHP_ME(soapserver, handle, NULL, 0) - PHP_ME(soapserver, bind, NULL, 0) PHP_ME(soapserver, fault, NULL, 0) #ifdef HAVE_PHP_DOMXML PHP_ME(soapserver, map, NULL, 0) @@ -230,25 +225,19 @@ ZEND_BEGIN_ARG_INFO(__call_args, 0) ZEND_ARG_PASS_INFO(0) ZEND_ARG_PASS_INFO(0) ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) ZEND_ARG_PASS_INFO(1) ZEND_END_ARG_INFO() #else -unsigned char __call_args[] = { 6, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; +unsigned char __call_args[] = { 5, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; #endif static zend_function_entry soap_client_functions[] = { - PHP_ME(soapobject, soapobject, NULL, 0) - PHP_ME(soapobject, __login, NULL, 0) - PHP_ME(soapobject, __useproxy, NULL, 0) - PHP_ME(soapobject, __isfault, NULL, 0) - PHP_ME(soapobject, __getfault, NULL, 0) - PHP_ME(soapobject, __call, __call_args, 0) - PHP_ME(soapobject, __trace, NULL, 0) - PHP_ME(soapobject, __getlastrequest, NULL, 0) - PHP_ME(soapobject, __getlastresponse, NULL, 0) - PHP_ME(soapobject, __getfunctions, NULL, 0) - PHP_ME(soapobject, __gettypes, NULL, 0) + PHP_ME(soapclient, soapclient, NULL, 0) + PHP_ME(soapclient, __call, __call_args, 0) + PHP_ME(soapclient, __getlastrequest, NULL, 0) + PHP_ME(soapclient, __getlastresponse, NULL, 0) + PHP_ME(soapclient, __getfunctions, NULL, 0) + PHP_ME(soapclient, __gettypes, NULL, 0) {NULL, NULL, NULL} }; @@ -372,7 +361,7 @@ PHP_MINIT_FUNCTION(soap) xmlRegisterInputCallbacks(php_stream_xmlIO_match_wrapper, php_stream_xmlIO_open_wrapper, php_stream_xmlIO_read, php_stream_xmlIO_close); - /* Register SoapObject class */ + /* Register SoapClient class */ /* BIG NOTE : THIS EMITS AN COMPILATION WARNING UNDER ZE2 - handle_function_call deprecated. soap_call_function_handler should be of type struct _zend_function, not (*handle_function_call). */ @@ -381,7 +370,7 @@ PHP_MINIT_FUNCTION(soap) zend_internal_function fe; fe.type = ZEND_INTERNAL_FUNCTION; - fe.handler = zif_soapobject___call; + fe.handler = zif_soapclient___call; fe.function_name = NULL; fe.scope = NULL; fe.fn_flags = 0; @@ -390,12 +379,12 @@ PHP_MINIT_FUNCTION(soap) fe.arg_info = NULL; fe.pass_rest_by_reference = 0; - INIT_OVERLOADED_CLASS_ENTRY(ce, PHP_SOAP_CLASSNAME, soap_client_functions, + INIT_OVERLOADED_CLASS_ENTRY(ce, PHP_SOAP_CLIENT_CLASSNAME, soap_client_functions, (zend_function *)&fe, NULL, NULL); soap_class_entry = zend_register_internal_class(&ce TSRMLS_CC); } #else - INIT_OVERLOADED_CLASS_ENTRY(ce, PHP_SOAP_CLASSNAME, soap_client_functions, soap_call_function_handler, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, PHP_SOAP_CLIENT_CLASSNAME, soap_client_functions, soap_call_function_handler, NULL, NULL); soap_class_entry = zend_register_internal_class(&ce TSRMLS_CC); #endif @@ -435,19 +424,12 @@ PHP_MINIT_FUNCTION(soap) REGISTER_LONG_CONSTANT("SOAP_RPC", SOAP_RPC, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SOAP_DOCUMENT", SOAP_DOCUMENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_1999_TIMEINSTANT", XSD_1999_TIMEINSTANT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_ACTOR_NEXT", SOAP_ACTOR_NEXT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SOAP_ACTOR_NONE", SOAP_ACTOR_NONE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SOAP_ACTOR_UNLIMATERECEIVER", SOAP_ACTOR_UNLIMATERECEIVER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("UNKNOWN_TYPE", UNKNOWN_TYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_ENC_OBJECT", SOAP_ENC_OBJECT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_ENC_ARRAY", SOAP_ENC_ARRAY, CONST_CS | CONST_PERSISTENT); - - REGISTER_STRING_CONSTANT("XSD_NAMESPACE", XSD_NAMESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_ANYTYPE", XSD_ANYTYPE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("XSD_STRING", XSD_STRING, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("XSD_BOOLEAN", XSD_BOOLEAN, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("XSD_DECIMAL", XSD_DECIMAL, CONST_CS | CONST_PERSISTENT); @@ -491,6 +473,16 @@ PHP_MINIT_FUNCTION(soap) REGISTER_LONG_CONSTANT("XSD_UNSIGNEDSHORT", XSD_UNSIGNEDSHORT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("XSD_UNSIGNEDBYTE", XSD_UNSIGNEDBYTE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("XSD_POSITIVEINTEGER", XSD_POSITIVEINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_NMTOKENS", XSD_NMTOKENS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_ANYTYPE", XSD_ANYTYPE, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SOAP_ENC_OBJECT", SOAP_ENC_OBJECT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_ENC_ARRAY", SOAP_ENC_ARRAY, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("XSD_1999_TIMEINSTANT", XSD_1999_TIMEINSTANT, CONST_CS | CONST_PERSISTENT); + + REGISTER_STRING_CONSTANT("XSD_NAMESPACE", XSD_NAMESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_STRING_CONSTANT("XSD_1999_NAMESPACE", XSD_1999_NAMESPACE, CONST_CS | CONST_PERSISTENT); old_error_handler = zend_error_cb; zend_error_cb = soap_error_handler; @@ -587,7 +579,6 @@ PHP_METHOD(soapheader,soapheader) } add_property_bool(this_ptr, "mustUnderstand", must_understand); if (actor == NULL) { - add_property_long(this_ptr, "actor", SOAP_ACTOR_NEXT); } else if (Z_TYPE_P(actor) == IS_LONG) { add_property_long(this_ptr, "actor", Z_LVAL_P(actor)); } else if (Z_TYPE_P(actor) == IS_STRING) { @@ -660,29 +651,71 @@ PHP_METHOD(soapvar,soapvar) PHP_METHOD(soapserver,soapserver) { soapServicePtr service; - char *uri, *actor = NULL; - int ret, uri_len, actor_len; - long version = SOAP_1_1; + zval *wsdl, *options = NULL; + int ret; + int version = SOAP_1_1; SOAP_SERVER_BEGIN_CODE(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &uri, &uri_len, &version, &actor, &actor_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|a", &wsdl, &options) == FAILURE) { + php_error(E_ERROR, "Invalid arguments to SoapServer constructor"); + } + + if (Z_TYPE_P(wsdl) == IS_STRING) { + } else if (Z_TYPE_P(wsdl) == IS_NULL) { + wsdl = NULL; + } else { php_error(E_ERROR, "Invalid arguments to SoapServer constructor"); } service = emalloc(sizeof(soapService)); memset(service, 0, sizeof(soapService)); - service->version = version; - service->uri = estrndup(uri, uri_len); - if (actor) { - service->actor = estrndup(actor, actor_len); + if (options != NULL) { + HashTable *ht = Z_ARRVAL_P(options); + zval **tmp; + + if (zend_hash_find(ht, "soap_version", sizeof("soap_version"), (void**)&tmp) == SUCCESS) { + if (Z_TYPE_PP(tmp) == IS_LONG || + (Z_LVAL_PP(tmp) == SOAP_1_1 && Z_LVAL_PP(tmp) == SOAP_1_2)) { + version = Z_LVAL_PP(tmp); + } + } + + if (zend_hash_find(ht, "uri", sizeof("uri"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_STRING) { + service->uri = estrndup(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); + } else if (wsdl == NULL) { + php_error(E_ERROR, "Invalid arguments to SoapServer constructor. 'uri' option is required in nonWSDL mode."); + return; + } + + if (zend_hash_find(ht, "actor", sizeof("actor"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_STRING) { + service->actor = estrndup(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); + } + } else if (wsdl == NULL) { + php_error(E_ERROR, "Invalid arguments to SoapServer constructor. 'uri' option is required in nonWSDL mode."); } + + service->version = version; service->type = SOAP_FUNCTIONS; service->soap_functions.functions_all = FALSE; service->soap_functions.ft = emalloc(sizeof(HashTable)); zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0); + if (wsdl) { + service->sdl = get_sdl(Z_STRVAL_P(wsdl)); + if (service->uri == NULL) { + if (service->sdl->target_ns) { + service->uri = estrdup(service->sdl->target_ns); + } else { + /*FIXME*/ + service->uri = estrdup("http://unknown-uri/"); + } + } + } + ret = zend_list_insert(service, le_service); add_property_resource(this_ptr, "service", ret); zend_list_addref(ret); @@ -810,24 +843,6 @@ PHP_FUNCTION(SoapServer,map) } #endif -PHP_METHOD(soapserver,bind) -{ - char *wsdl; - int wsdl_len; - soapServicePtr service; - - SOAP_SERVER_BEGIN_CODE(); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &wsdl, &wsdl_len) == FAILURE) { - php_error(E_ERROR, "Wrong number of parameters to SoapServer->bind"); - } - - FETCH_THIS_SERVICE(service); - service->sdl = get_sdl(wsdl); - - SOAP_SERVER_END_CODE(); -} - PHP_METHOD(soapserver,setpersistence) { soapServicePtr service; @@ -1441,82 +1456,134 @@ PHP_FUNCTION(use_soap_error_handler) } } +PHP_FUNCTION(is_soap_fault) +{ + zval *fault; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &fault) == SUCCESS && + Z_TYPE_P(fault) == IS_OBJECT && + Z_OBJCE_P(fault) == soap_fault_class_entry) { + RETURN_TRUE; + } + RETURN_FALSE +} -/* SoapObject functions */ +/* SoapClient functions */ /* - SoapObject($wsdl, $version=SOAP_1_1) - SoapObject($location, $uri, $style=SOAP_RPC, $use=SOAP_ENCODED, $version=SOAP_1_1) + SoapClient($wsdl, $options=array()) */ -PHP_METHOD(soapobject, soapobject) +PHP_METHOD(soapclient, soapclient) { - char *location; - int location_len; - zval *arg2 = NULL; - long use = SOAP_RPC; - long style = SOAP_ENCODED; - long version = SOAP_1_1; - long old_soap_version ; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zlll", &location, &location_len, &arg2, &style, &use, &version) == SUCCESS) { - if (arg2 == NULL || Z_TYPE_P(arg2) == IS_LONG) { - /* SoapObject($wsdl, $version=SOAP_1_1) */ - sdlPtr sdl; - int ret; - - if (arg2 != NULL) { - version = Z_LVAL_P(arg2); - } - if (version == SOAP_1_1 || version == SOAP_1_2) { - add_property_long(this_ptr, "_soap_version", version); - } else { - php_error(E_ERROR,"Can't create SoapObject. Wrong 'version' parameter."); - } - old_soap_version = SOAP_GLOBAL(soap_version); - SOAP_GLOBAL(soap_version) = version; - sdl = get_sdl(location); - ret = zend_list_insert(sdl, le_sdl); + zval *wsdl; + zval *options = NULL; + int soap_version = SOAP_1_1; - add_property_resource(this_ptr, "sdl", ret); - zend_list_addref(ret); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|a", &wsdl, &options) == FAILURE) { + php_error(E_ERROR, "Can't create SoapClient. Invalid parameters."); + return; + } - SOAP_GLOBAL(soap_version) = old_soap_version; + if (Z_TYPE_P(wsdl) == IS_STRING) { + } else if (Z_TYPE_P(wsdl) != IS_NULL ) { + php_error(E_ERROR, "Can't create SoapClient. $wsdl must be string or null."); + return; + } else { + wsdl = NULL; + } + if (options != NULL) { + HashTable *ht = Z_ARRVAL_P(options); + zval **tmp; - } else if (arg2 != NULL && Z_TYPE_P(arg2) == IS_STRING) { - /* SoapObject($location, $uri, $style=SOAP_RPC, $use=SOAP_ENCODED, $version=SOAP_1_1) */ - add_property_stringl(this_ptr, "location", location, location_len, 1); - add_property_stringl(this_ptr, "uri", Z_STRVAL_P(arg2), Z_STRLEN_P(arg2), 1); - if (style == SOAP_RPC || style == SOAP_DOCUMENT) { - add_property_long(this_ptr, "style", style); + if (wsdl == NULL) { + /* Fetching non-WSDL mode options */ + if (zend_hash_find(ht, "location", sizeof("location"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_STRING) { + add_property_stringl(this_ptr, "location", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); } else { - php_error(E_ERROR,"Can't create SoapObject. Wrong 'style' parameter."); + php_error(E_ERROR, "Can't create SoapClient. 'location' option is requred in nonWSDL mode."); + return; } - if (use == SOAP_ENCODED || use == SOAP_LITERAL) { - add_property_long(this_ptr, "use", use); + + if (zend_hash_find(ht, "uri", sizeof("uri"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_STRING) { + add_property_stringl(this_ptr, "uri", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); } else { - php_error(E_ERROR,"Can't create SoapObject. Wrong 'use' parameter."); + php_error(E_ERROR, "Can't create SoapClient. 'uri' option is requred in nonWSDL mode."); + return; } - if (version == SOAP_1_1 || version == SOAP_1_2) { - add_property_long(this_ptr, "_soap_version", version); - } else { - php_error(E_ERROR,"Can't create SoapObject. Wrong 'version' parameter."); + + if (zend_hash_find(ht, "style", sizeof("style"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_LONG && + (Z_LVAL_PP(tmp) == SOAP_RPC || Z_LVAL_PP(tmp) == SOAP_DOCUMENT)) { + add_property_long(this_ptr, "style", Z_LVAL_PP(tmp)); } - } else { - php_error(E_ERROR,"Can't create SoapObject. Wrong parameters."); + + if (zend_hash_find(ht, "use", sizeof("use"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_LONG && + (Z_LVAL_PP(tmp) == SOAP_LITERAL || Z_LVAL_PP(tmp) == SOAP_ENCODED)) { + add_property_long(this_ptr, "use", Z_LVAL_PP(tmp)); + } + } + + if (zend_hash_find(ht, "soap_version", sizeof("soap_version"), (void**)&tmp) == SUCCESS) { + if (Z_TYPE_PP(tmp) == IS_LONG || + (Z_LVAL_PP(tmp) == SOAP_1_1 && Z_LVAL_PP(tmp) == SOAP_1_2)) { + soap_version = Z_LVAL_PP(tmp); + } + } + if (zend_hash_find(ht, "login", sizeof("login"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_STRING) { + add_property_stringl(this_ptr, "_login", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + if (zend_hash_find(ht, "password", sizeof("password"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_STRING) { + add_property_stringl(this_ptr, "_password", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + } + } + if (zend_hash_find(ht, "proxy_host", sizeof("proxy_host"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_STRING) { + add_property_stringl(this_ptr, "_proxy_host", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + if (zend_hash_find(ht, "proxy_port", sizeof("proxy_port"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_LONG) { + add_property_long(this_ptr, "_proxy_port", Z_LVAL_PP(tmp)); + } + if (zend_hash_find(ht, "proxy_login", sizeof("proxy_login"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_STRING) { + add_property_stringl(this_ptr, "_proxy_login", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + if (zend_hash_find(ht, "proxy_password", sizeof("proxy_password"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_STRING) { + add_property_stringl(this_ptr, "_proxy_password", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + } + } + } + if (zend_hash_find(ht, "trace", sizeof("trace"), (void**)&tmp) == SUCCESS && + (Z_TYPE_PP(tmp) == IS_BOOL || Z_TYPE_PP(tmp) == IS_LONG) && + Z_LVAL_PP(tmp) == 1) { + add_property_long(this_ptr, "trace", 1); } + } else if (wsdl == NULL) { + php_error(E_ERROR, "Can't create SoapClient. 'location' and 'uri' options are requred in nonWSDL mode."); + return; } -} -PHP_METHOD(soapobject, __trace) -{ - int level; + add_property_long(this_ptr, "_soap_version", soap_version); + + if (wsdl) { + int old_soap_version, ret; + sdlPtr sdl; + + old_soap_version = SOAP_GLOBAL(soap_version); + SOAP_GLOBAL(soap_version) = soap_version; + + sdl = get_sdl(Z_STRVAL_P(wsdl)); + ret = zend_list_insert(sdl, le_sdl); + + add_property_resource(this_ptr, "sdl", ret); + zend_list_addref(ret); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &level)) { - php_error(E_ERROR, "Invalid arguments to SoapObject->__trace"); + SOAP_GLOBAL(soap_version) = old_soap_version; } - add_property_long(this_ptr, "trace", level); - RETURN_TRUE; } static void do_soap_call(zval* thisObj, @@ -1661,52 +1728,12 @@ zend_try { SOAP_GLOBAL(sdl) = old_sdl; } -PHP_METHOD(soapobject, __login) -{ - char *login_name; - char *login_pass; - int login_name_len; - int login_pass_len; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", - &login_name, &login_name_len, &login_pass, &login_pass_len) == FAILURE) { - return; - } - add_property_stringl(this_ptr,"_login",login_name,login_name_len, 1); - add_property_stringl(this_ptr,"_password",login_pass,login_pass_len, 1); -} - -PHP_METHOD(soapobject, __useproxy) -{ - char *proxy_host; - char *proxy_name = NULL; - char *proxy_pass = NULL; - int proxy_host_len; - int proxy_name_len; - int proxy_pass_len; - long proxy_port; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ss", - &proxy_host, &proxy_host_len, &proxy_port, &proxy_name, &proxy_name_len, &proxy_pass, &proxy_pass_len) == FAILURE) { - return; - } - add_property_stringl(this_ptr,"_proxy_host",proxy_host,proxy_host_len, 1); - add_property_long(this_ptr,"_proxy_port",proxy_port); - if (proxy_name) { - add_property_stringl(this_ptr,"_proxy_login",proxy_name,proxy_name_len, 1); - } - if (proxy_pass) { - add_property_stringl(this_ptr,"_proxy_password",proxy_pass,proxy_pass_len, 1); - } - zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")); - zend_hash_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")); -} - -PHP_METHOD(soapobject, __call) +PHP_METHOD(soapclient, __call) { char *function, *soap_action = NULL, *uri = NULL; - int function_len, soap_action_len, uri_len, i = 0; + int function_len, i = 0; HashTable* soap_headers = NULL; + zval *options = NULL; zval *headers = NULL; zval *output_headers = NULL; zval *args; @@ -1716,9 +1743,28 @@ PHP_METHOD(soapobject, __call) HashPosition pos; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|sszz", - &function, &function_len, &args, &soap_action, &soap_action_len, &uri, &uri_len, &headers, &output_headers) == FAILURE) { - php_error(E_ERROR, "Invalid arguments to SoapObject->__call"); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|zzz", + &function, &function_len, &args, &options, &headers, &output_headers) == FAILURE) { + php_error(E_ERROR, "Invalid arguments to SoapClient->__call"); + } + + if (options) { + if (Z_TYPE_P(options) == IS_ARRAY) { + HashTable *ht = Z_ARRVAL_P(options); + zval **tmp; + + if (zend_hash_find(ht, "soapaction", sizeof("soapaction"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_STRING) { + soap_action = Z_STRVAL_PP(tmp); + } + + if (zend_hash_find(ht, "uri", sizeof("uri"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_STRING) { + soap_action = Z_STRVAL_PP(tmp); + } + } else if (Z_TYPE_P(options) != IS_NULL) { + php_error(E_ERROR, "Invalid arguments to SoapClient->__call"); + } } if (headers == NULL || Z_TYPE_P(headers) == IS_NULL) { @@ -1730,7 +1776,7 @@ PHP_METHOD(soapobject, __call) while (zend_hash_get_current_data(soap_headers, (void**)&tmp) == SUCCESS) { if (Z_TYPE_PP(tmp) != IS_OBJECT || Z_OBJCE_PP(tmp) != soap_header_class_entry) { - php_error(E_ERROR, "Invalid arguments to SoapObject->__call"); + php_error(E_ERROR, "Invalid arguments to SoapClient->__call"); } zend_hash_move_forward(soap_headers); } @@ -1741,7 +1787,7 @@ PHP_METHOD(soapobject, __call) zend_hash_next_index_insert(soap_headers, &headers, sizeof(zval*), NULL); headers = NULL; } else{ - php_error(E_ERROR, "Invalid arguments to SoapObject->__call"); + php_error(E_ERROR, "Invalid arguments to SoapClient->__call"); } arg_count = zend_hash_num_elements(Z_ARRVAL_P(args)); @@ -1765,28 +1811,7 @@ PHP_METHOD(soapobject, __call) } } -PHP_METHOD(soapobject, __isfault) -{ - if (zend_hash_exists(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"))) { - RETURN_TRUE - } else { - RETURN_FALSE - } -} - -PHP_METHOD(soapobject, __getfault) -{ - zval **tmp; - - if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **)&tmp) == SUCCESS) { - *return_value = *(*tmp); - zval_copy_ctor(return_value); - return; - } - RETURN_NULL(); -} - -PHP_METHOD(soapobject, __getfunctions) +PHP_METHOD(soapclient, __getfunctions) { sdlPtr sdl; HashPosition pos; @@ -1808,7 +1833,7 @@ PHP_METHOD(soapobject, __getfunctions) } } -PHP_METHOD(soapobject, __gettypes) +PHP_METHOD(soapclient, __gettypes) { sdlPtr sdl; HashPosition pos; @@ -1832,7 +1857,7 @@ PHP_METHOD(soapobject, __gettypes) } } -PHP_METHOD(soapobject, __getlastrequest) +PHP_METHOD(soapclient, __getlastrequest) { zval **tmp; @@ -1842,7 +1867,7 @@ PHP_METHOD(soapobject, __getlastrequest) RETURN_NULL(); } -PHP_METHOD(soapobject, __getlastresponse) +PHP_METHOD(soapclient, __getlastresponse) { zval **tmp; @@ -3077,6 +3102,8 @@ static void delete_service(void *data) if (service->actor) { efree(service->actor); } - efree(service->uri); + if (service->uri) { + efree(service->uri); + } efree(service); } diff --git a/ext/soap/tests/schema/test_schema.inc b/ext/soap/tests/schema/test_schema.inc index 4e1e2df9eb..3bdcd95ef7 100644 --- a/ext/soap/tests/schema/test_schema.inc +++ b/ext/soap/tests/schema/test_schema.inc @@ -53,13 +53,11 @@ EOF; $f = fopen($fname,"w"); fwrite($f,$wsdl); fclose($f); - $x = new SoapObject($fname); - $y = new SoapServer("http://test-uri/"); - $y->bind($fname); + $x = new SoapClient($fname, array("trace"=>1)); + $y = new SoapServer($fname); $y->addfunction("test"); unlink($fname); - $x->__trace(1); $x->test($param); $xml = xml_parser_create(); $req = $x->__getlastrequest(); diff --git a/ext/soap/tests/server001.phpt b/ext/soap/tests/server001.phpt index 0ee679889b..582759f06f 100644 --- a/ext/soap/tests/server001.phpt +++ b/ext/soap/tests/server001.phpt @@ -8,7 +8,7 @@ function test() { return "Hello World"; } -$server = new soapserver("http://testuri.org"); +$server = new soapserver(null,array('uri'=>"http://testuri.org")); $server->addfunction("test"); $HTTP_RAW_POST_DATA = <<<EOF diff --git a/ext/soap/tests/server002.phpt b/ext/soap/tests/server002.phpt index af211bc7ac..8416f4fb08 100644 --- a/ext/soap/tests/server002.phpt +++ b/ext/soap/tests/server002.phpt @@ -8,7 +8,7 @@ function Add($x,$y) { return $x+$y; } -$server = new soapserver("http://testuri.org"); +$server = new soapserver(null,array('uri'=>"http://testuri.org")); $server->addfunction("Add"); $HTTP_RAW_POST_DATA = <<<EOF diff --git a/ext/soap/tests/server003.phpt b/ext/soap/tests/server003.phpt index 888fe9b5d1..d4a15e0d69 100644 --- a/ext/soap/tests/server003.phpt +++ b/ext/soap/tests/server003.phpt @@ -4,7 +4,7 @@ SOAP Server 3: all functions <?php require_once('skipif.inc'); ?> --FILE-- <?php -$server = new soapserver("http://testuri.org"); +$server = new soapserver(null,array('uri'=>"http://testuri.org")); $server->addfunction(SOAP_FUNCTIONS_ALL); $HTTP_RAW_POST_DATA = <<<EOF diff --git a/ext/soap/tests/server004.phpt b/ext/soap/tests/server004.phpt index c97b4ef1ad..5bfef4fcd4 100644 --- a/ext/soap/tests/server004.phpt +++ b/ext/soap/tests/server004.phpt @@ -11,7 +11,7 @@ function Sub($x,$y) { return $x-$y; } -$server = new soapserver("http://testuri.org"); +$server = new soapserver(null,array('uri'=>"http://testuri.org")); $server->addfunction(array("Sub","Add")); $HTTP_RAW_POST_DATA = <<<EOF diff --git a/ext/soap/tests/server005.phpt b/ext/soap/tests/server005.phpt index a0e4afa540..4aae3b2d99 100644 --- a/ext/soap/tests/server005.phpt +++ b/ext/soap/tests/server005.phpt @@ -10,7 +10,7 @@ class Foo { } } -$server = new soapserver("http://testuri.org"); +$server = new soapserver(null,array('uri'=>"http://testuri.org")); $server->setclass("Foo"); $HTTP_RAW_POST_DATA = <<<EOF diff --git a/ext/soap/tests/server006.phpt b/ext/soap/tests/server006.phpt index b75482ba3a..f382d9f2f1 100644 --- a/ext/soap/tests/server006.phpt +++ b/ext/soap/tests/server006.phpt @@ -16,7 +16,7 @@ class Foo { } } -$server = new soapserver("http://testuri.org"); +$server = new soapserver(null,array('uri'=>"http://testuri.org")); $server->setclass("Foo","Hello"); $HTTP_RAW_POST_DATA = <<<EOF diff --git a/ext/soap/tests/server007.phpt b/ext/soap/tests/server007.phpt index 113ddac4a3..676aa56c44 100644 --- a/ext/soap/tests/server007.phpt +++ b/ext/soap/tests/server007.phpt @@ -11,7 +11,7 @@ function Sub($x,$y) { return $x-$y; } -$server = new soapserver("http://testuri.org"); +$server = new soapserver(null,array('uri'=>"http://testuri.org")); $server->addfunction(array("Sub","Add")); var_dump($server->getfunctions()); echo "ok\n"; diff --git a/ext/soap/tests/server008.phpt b/ext/soap/tests/server008.phpt index 73f91f3891..87fb69d25f 100644 --- a/ext/soap/tests/server008.phpt +++ b/ext/soap/tests/server008.phpt @@ -14,7 +14,7 @@ class Foo { } } -$server = new soapserver("http://testuri.org"); +$server = new soapserver(null,array('uri'=>"http://testuri.org")); $server->setclass("Foo"); var_dump($server->getfunctions()); echo "ok\n"; diff --git a/ext/soap/tests/server009.phpt b/ext/soap/tests/server009.phpt index 9e338450da..0a7b30f40c 100644 --- a/ext/soap/tests/server009.phpt +++ b/ext/soap/tests/server009.phpt @@ -17,7 +17,7 @@ class foo { } } -$server = new soapserver("http://testuri.org"); +$server = new soapserver(null,array('uri'=>"http://testuri.org")); $server->setclass("foo"); $server->setpersistence(SOAP_PERSISTENCE_SESSION); diff --git a/ext/soap/tests/server010.phpt b/ext/soap/tests/server010.phpt index 8cbdc4af46..76cc1e6949 100644 --- a/ext/soap/tests/server010.phpt +++ b/ext/soap/tests/server010.phpt @@ -12,7 +12,7 @@ class foo { } } -$server = new soapserver("http://testuri.org"); +$server = new soapserver(null,array('uri'=>"http://testuri.org")); $server->setclass("foo"); $server->setpersistence(SOAP_PERSISTENCE_REQUEST); diff --git a/ext/soap/tests/server011.phpt b/ext/soap/tests/server011.phpt index d5f6d3703d..fb9aabe89c 100644 --- a/ext/soap/tests/server011.phpt +++ b/ext/soap/tests/server011.phpt @@ -10,8 +10,7 @@ function Add($x,$y) { return $x+$y; } -$server = new soapserver("http://testuri.org"); -$server->bind(dirname(__FILE__)."/test.wsdl"); +$server = new soapserver(dirname(__FILE__)."/test.wsdl"); ob_start(); $server->handle(); $wsdl = ob_get_contents(); diff --git a/ext/soap/tests/server012.phpt b/ext/soap/tests/server012.phpt index 5739f5beae..9a41de9d50 100644 --- a/ext/soap/tests/server012.phpt +++ b/ext/soap/tests/server012.phpt @@ -10,7 +10,7 @@ function Add($x,$y) { return $x+$y; } -$server = new soapserver("http://testuri.org"); +$server = new soapserver(null,array('uri'=>"http://testuri.org")); $server->addfunction("Add"); $server->handle(); echo "ok\n"; diff --git a/ext/soap/tests/server013.phpt b/ext/soap/tests/server013.phpt index ca7efbfeeb..4bb94c79c4 100644 --- a/ext/soap/tests/server013.phpt +++ b/ext/soap/tests/server013.phpt @@ -14,7 +14,7 @@ function Sum($a) { return $sum; } -$server = new soapserver("http://testuri.org"); +$server = new soapserver(null,array('uri'=>"http://testuri.org")); $server->addfunction("Sum"); $HTTP_RAW_POST_DATA = <<<EOF diff --git a/ext/soap/tests/server014.phpt b/ext/soap/tests/server014.phpt index 01a05d772e..7375264872 100644 --- a/ext/soap/tests/server014.phpt +++ b/ext/soap/tests/server014.phpt @@ -9,7 +9,7 @@ function Add($x,$y) { return $x+$y; } -$server = new soapserver("http://testuri.org"); +$server = new soapserver(null,array('uri'=>"http://testuri.org")); $server->addfunction("Add"); $HTTP_RAW_POST_DATA = <<<EOF diff --git a/ext/soap/tests/soap12/soap12-test.inc b/ext/soap/tests/soap12/soap12-test.inc index c38bbb1cb2..03da1f65b6 100644 --- a/ext/soap/tests/soap12/soap12-test.inc +++ b/ext/soap/tests/soap12/soap12-test.inc @@ -113,8 +113,7 @@ class Soap12test { } } -$server = new soapserver("http://example.org/ts-tests", SOAP_1_2, "http://example.org/ts-tests/C"); -$server->bind(dirname(__FILE__)."/soap12-test.wsdl"); +$server = new soapserver(dirname(__FILE__)."/soap12-test.wsdl", array('soap_version'=>SOAP_1_2,'actor'=>"http://example.org/ts-tests/C")); $server->setClass("Soap12test"); $server->handle(); |