summaryrefslogtreecommitdiff
path: root/ext/soap
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2004-01-25 12:03:25 +0000
committerSVN Migration <svn@php.net>2004-01-25 12:03:25 +0000
commit22476b36ce621bdd115493bab84cbe706e422a7c (patch)
tree1124d1c5af68860a78c2252bb0dac63c9f18156e /ext/soap
parenteb7aca4ea896b09cb9afc2466a46f4720acc4a4e (diff)
downloadphp-git-php_ibase_before_split.tar.gz
This commit was manufactured by cvs2svn to create tagphp_ibase_before_split
'php_ibase_before_split'.
Diffstat (limited to 'ext/soap')
-rw-r--r--ext/soap/EXPERIMENTAL0
-rw-r--r--ext/soap/Makefile.in8
-rw-r--r--ext/soap/TODO137
-rw-r--r--ext/soap/TODO.old39
-rw-r--r--ext/soap/config.m433
-rw-r--r--ext/soap/config.w3214
-rw-r--r--ext/soap/interop/client_round2.php113
-rw-r--r--ext/soap/interop/client_round2_interop.php815
-rw-r--r--ext/soap/interop/client_round2_params.php653
-rw-r--r--ext/soap/interop/client_round2_results.php75
-rw-r--r--ext/soap/interop/client_round2_run.php54
-rw-r--r--ext/soap/interop/config.php.dist4
-rw-r--r--ext/soap/interop/database_round2.sql44
-rw-r--r--ext/soap/interop/echoheadersvc.wsdl.php20
-rw-r--r--ext/soap/interop/index.php68
-rw-r--r--ext/soap/interop/interop.wsdl.php335
-rw-r--r--ext/soap/interop/interopB.wsdl.php196
-rw-r--r--ext/soap/interop/server_round2_base.php145
-rw-r--r--ext/soap/interop/server_round2_groupB.php70
-rw-r--r--ext/soap/interop/server_round2_groupC.php39
-rw-r--r--ext/soap/interop/test.utility.php143
-rw-r--r--ext/soap/package.xml64
-rw-r--r--ext/soap/php_encoding.c2268
-rw-r--r--ext/soap/php_encoding.h238
-rw-r--r--ext/soap/php_http.c526
-rw-r--r--ext/soap/php_http.h7
-rw-r--r--ext/soap/php_packet_soap.c233
-rw-r--r--ext/soap/php_packet_soap.h6
-rw-r--r--ext/soap/php_schema.c2122
-rw-r--r--ext/soap/php_schema.h8
-rw-r--r--ext/soap/php_sdl.c1222
-rw-r--r--ext/soap/php_sdl.h183
-rw-r--r--ext/soap/php_soap.dsp148
-rw-r--r--ext/soap/php_soap.h161
-rw-r--r--ext/soap/php_xml.c205
-rw-r--r--ext/soap/php_xml.h59
-rw-r--r--ext/soap/soap.c2395
-rw-r--r--ext/soap/tests/server001.phpt33
-rw-r--r--ext/soap/tests/server002.phpt37
-rw-r--r--ext/soap/tests/server003.phpt32
-rw-r--r--ext/soap/tests/server004.phpt40
-rw-r--r--ext/soap/tests/server005.phpt36
-rw-r--r--ext/soap/tests/server006.phpt42
-rw-r--r--ext/soap/tests/server007.phpt26
-rw-r--r--ext/soap/tests/server008.phpt29
-rw-r--r--ext/soap/tests/server009.phpt66
-rw-r--r--ext/soap/tests/server010.phpt61
-rw-r--r--ext/soap/tests/server011.phpt26
-rw-r--r--ext/soap/tests/server012.phpt20
-rw-r--r--ext/soap/tests/server013.phpt44
-rw-r--r--ext/soap/tests/server014.phpt37
-rw-r--r--ext/soap/tests/skipif.inc3
-rw-r--r--ext/soap/tests/test.wsdl55
53 files changed, 0 insertions, 13437 deletions
diff --git a/ext/soap/EXPERIMENTAL b/ext/soap/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/soap/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/soap/Makefile.in b/ext/soap/Makefile.in
deleted file mode 100644
index eb52167d2d..0000000000
--- a/ext/soap/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libsoap.la
-LTLIBRARY_SOURCES = soap.c php_sdl.c php_schema.c php_xml.c php_encoding.c php_http.c php_packet_soap.c
-LTLIBRARY_SHARED_NAME = soap.la
-LTLIBRARY_SHARED_LIBADD = $(SOAP_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/soap/TODO b/ext/soap/TODO
deleted file mode 100644
index 9f83a91a4b..0000000000
--- a/ext/soap/TODO
+++ /dev/null
@@ -1,137 +0,0 @@
-General
--------
-- rename soapobject to soapclient
-- make sure soapvar and soapparam are really need
-- 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
-
-SOAP
-----
-+ SOAP versioning model
-+ SOAP message must not contain a Document Type Declaration
-- SOAP message MUST NOT contain Processing Instructions <?xml-stylesheet ... ?> (XML_PI_NODE)
-+ SOAP 1.1 fault codes ("client","server"), SOAP 1.1 fault codes ("Sender","Receiver")
-+ SOAP 1.1 Content-Type - "text/xml", SOAP 1.2 - "application/soap+xml"
-- support for SOAP 1.2 <rpc:result> (ignore it???)
-- support for SOAP headers
- - actor attribute
- - mustUnderstend attribute
-- make sure soap 1.1 and 1.2 are supported fully
-
-Encoding
---------
-? full support for standard simple types (
- + anyType
- + anyURI,
- + QName,
- + NOTATION,
- + normalizedString,
- + token,
- ? language, (pattern: "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*")
- ? NMTOKEN, (pattern: "\c+") (\c: [a-zA-Z0-9.\-_:])
- ? NMTOKENS, (list: NMTOKEN, minLength: 1)
- ? Name, (pattern: "\i\c*") (\i: [a-zA-Z_:]
- ? NCName, (pattern: "[\i-[:]][\c-[:]]*")
- ? ID, (base: NCName)
- ? IDREF, (base: NCName)
- ? IDREFS, (list: IDREF; minLength: 1)
- ? ENTITY, (base: NCName)
- ? ENTITIES, (list: ENTITY; minLength: 1)
- ? duration,
- + unsignedLong)
-? full support for standard date/time types (
- ? dateTime,
- ? time,
- ? date,
- ? gYearMonth,
- ? gYear,
- ? gMonthDay,
- ? gDay,
- ? gMonth)
-? proper encoding of standard hexBinary type
-? proper encoding of standard base64Binary type
-? full support for arrays
- - SOAP 1.1 encoding of arrays with holes (partially transmitted and sparse arrays)
- SOAP 1.2 doesn't support partially transmitted and sparse arrays
-- references to external resources
-? support for "nillable" and "nil"
-- default values
-- root attribute
-? provide schema 1999/2001 support???
-? make internal refrences for soap encoding (use seralization logic)???
-? provide user space overriding of serialization certin objects and types???
-
-WSDL
-----
-+ wsdl and schema import
-+ support for message/part element attribute
-+ support for portType operation input/output name attribute
-+ support for <opperation> without <input>
-- support for portType operation parameterOrder attribute
-- support for binding operation input/output name attribute (part of overloading)
-- support for <opperation> <fault>
-+ support for style "rpc"/"document" encoding (client part)
-- support for style "rpc"/"document" encoding (server part)
- How to get function name from request? May be SoapAction HTTP header?
-+ support for "encoded"/"literal" encoding
-? arrayType and "literal" encoding
-- function/method overloading/redeclaration (test(int); test(string))
-- wsdl caching
-- wsdl auto generation
-? SOAP binding
- - <soap:body> parts attribute
- - <soap:fault>
- - <soap:header> and <soap:headerfault>
-- HTTP GET/POST binding
-- MIME binding
-- SOAP 1.2 bindings???
-
-Schema
-------
-- <redefine>
-? support for user defined simple types
- ? restiction
- + base
- ? enumeration
- ? length (for string, anyURI, hexBinary, base64Binary and derived) list???
- ? minLength (for string, hexBinary, base64Binary and derived) list???
- ? maxLength (for string, hexBinary, base64Binary and derived) list???
- + whiteSpace (preserve, replace [#x9,#xA,#xD=>#x20], collapse [replace+?])
- - pattern
- - minExclusive (for numeric, date types)
- - minInclusive (for numeric, date types)
- - maxExclusive (for numeric, date types)
- - maxInclusive (for numeric, date types)
- - totalDigits (for decimal)
- - fractionDigits (for decimal)
- ? list
- ? union
-? support for user defined complex types
- ? full support for content model encoding/decoding
-
-Error Handling
---------------
-- ???
-
-Transport
----------
-+ support for https://
-+ support for persistent HTTP connections (keep_alive)
-- support for HTTP compression (gzip,x-gzip,defalte)
-+ support for HTTP authentication
-+ HTTP Cookies support
-- support for HTTP proxies
-- transport abstraction layer
-+ SoapAction HTTP header field
-? HTTP status codes
-? HTTP chunked Transfer-Encoding
-
-UDDI
-----
-- ???
-
-Interop Testing
----------------
-- more rounds/groups
-- ???
diff --git a/ext/soap/TODO.old b/ext/soap/TODO.old
deleted file mode 100644
index a1cc15c397..0000000000
--- a/ext/soap/TODO.old
+++ /dev/null
@@ -1,39 +0,0 @@
-TODO:
-make sure soap 1.1 and 1.2 is supported fully
-Better WSDL support Client and server (how much validation is needed here?)
-UDDI??
-make internal refrences for soap encoding (use seralization logic)
-add ini option for always soap_error_handler
-provide user space overriding of serialization certin objects and types
-serialization in general needs to be polished/finished... all xsd types
-make perstistant objects and work with or without register_globals on
-look to see if php-soap will work with out always_populate_raw_post_data on
-see if client will work with ssl.. should be eaiser with php_streams
-work on soap seralizer (php serialization)
--work on a soap-service 'regiestry' and 'proxy' (apache soap style)
--convert all string mainpulation to use smart_str
-make the 'soap' packet abstract.. maybe incorperate xml-rpc
-make the transport layer abstract.. what other transport layers are needed?... who uses smtp? what about jabber?
-make $soap_object->data = 'text'; maybe invoke a set_*() and/or get_*() method
-when using wsdls and function names are similar find the best match
- void test(int);
- void test(string);
- maybe use the same alogrithim as ext/java.
-investigate further http keep_alive... inital testing proved slower.. maybe php_streams will speed things up..
-provide schema 1999/2001 support....
-through memory leak testing
-possible using shared memory for sdl caching...
-api for clearing/checking sdl caching...
-make php-soap work as a standalone server using php_streams and the new socket extension
-http authication
-proxy support
-wsdl generation static and auto (.net style (http://server.com/soapserver.php?WSDL)) using phpdoc parsing engine
-interpo testing...
-BENCHMARKING...... lets prove how fast it is.
-do some more work on website
-
-does this list stop... what exactly have i done?
-im sure im forgetting 20 thousand more things....
-
-
- - brad
diff --git a/ext/soap/config.m4 b/ext/soap/config.m4
deleted file mode 100644
index 0b27165bcb..0000000000
--- a/ext/soap/config.m4
+++ /dev/null
@@ -1,33 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension soap
-
-PHP_ARG_ENABLE(soap, whether to enable soap support,
-[ --enable-soap[=DIR] Enable soap support. DIR is libxml2
- library directory.])
-
-if test "$PHP_SOAP" != "no"; then
- if test "$PHP_SOAP" = "yes"; then
- for i in /usr/local /usr; do
- if test -d "$i/include/libxml2/libxml"; then
- XML2_INCDIR=$i/include/libxml2
- XML2_LIBDIR=$i/lib
- fi
- done
- else
- if test -d "$PHP_SOAP/include/libxml2/libxml"; then
- XML2_INCDIR=$PHP_SOAP/include/libxml2
- XML2_LIBDIR=$PHP_SOAP/lib
- fi
- fi
-
- if test -z "$XML2_INCDIR"; then
- AC_MSG_ERROR(Cannot find libxml2 header. Please specify correct libxml2 installation path)
- fi
-
- AC_DEFINE(HAVE_PHP_SOAP,1,[Whether you have soap module])
-
- PHP_ADD_INCLUDE($XML2_INCDIR)
- PHP_ADD_LIBRARY_WITH_PATH(xml2,$XML2_LIBDIR,SOAP_SHARED_LIBADD)
- PHP_NEW_EXTENSION(soap, soap.c php_encoding.c php_http.c php_packet_soap.c php_schema.c php_sdl.c php_xml.c, $ext_shared)
- PHP_SUBST(SOAP_SHARED_LIBADD)
-fi
diff --git a/ext/soap/config.w32 b/ext/soap/config.w32
deleted file mode 100644
index f579f32a04..0000000000
--- a/ext/soap/config.w32
+++ /dev/null
@@ -1,14 +0,0 @@
-// $Id$
-// vim:ft=javascript
-
-ARG_ENABLE("soap", "SOAP support", "no");
-
-if (PHP_SOAP != "no" && PHP_LIBXML == "yes") {
- EXTENSION('soap', 'soap.c php_encoding.c php_http.c php_packet_soap.c php_schema.c php_sdl.c php_xml.c');
- AC_DEFINE('HAVE_PHP_SOAP', 1);
-
- if (!PHP_SOAP_SHARED) {
- ADD_FLAG('CFLAGS_SOAP', "/D LIBXML_STATIC ");
- }
-}
-
diff --git a/ext/soap/interop/client_round2.php b/ext/soap/interop/client_round2.php
deleted file mode 100644
index c1307472c4..0000000000
--- a/ext/soap/interop/client_round2.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
- <title>Round 2 Interop Client Tests</title>
-</head>
-
-<body>
-<a href="index.php">Back to Interop Index</a><br>
-<p>&nbsp;</p>
-<?php
-require_once 'client_round2_interop.php';
-
-$iop = new Interop_Client();
-
-function endpointList($test,$sel_endpoint)
-{
- global $iop;
- $iop->getEndpoints($test);
- echo "<select name='endpoint'>\n";
- echo "<option value=''>-- All Endpoints --</option>\n";
- foreach ($iop->endpoints as $epname => $epinfo) {
- $selected = '';
- if ($sel_endpoint == $epname) $selected = ' SELECTED';
- echo "<option value='$epname'$selected>$epname</option>\n";
- }
- echo "</select>\n";
-}
-function methodList($test,$sel_method)
-{
- global $iop;
- global $soap_tests;
-
- echo "<select name='method'>\n";
- echo "<option value='ALL'>-- Run All Methods --</option>\n";
- $prev_method = "";
- foreach ($soap_tests[$test] as $x) {
- $method = $x->test_name;
- if ($method != $prev_method) {
- $prev_method = $method;
- $selected = '';
- if ($sel_method == $method) $selected = ' SELECTED';
- echo "<option value='$method'$selected>$method</option>\n";
- }
- }
- echo "</select>\n";
-}
-
-function endpointTestForm($test, $endpoint, $method, $paramType, $useWSDL)
-{
- global $PHP_SELF;
- if (!$test) $test = 'base';
- echo "Round 2 '$test' Selected<br>\n";
- echo "Select endpoint and method to run:<br>\n";
- echo "<form action='$PHP_SELF' method='post'>\n";
- echo "<input type='hidden' name='test' value='$test'>\n";
- endpointList($test, $endpoint);
- methodList($test, $method);
- echo "<select name='paramType'>";
-// echo "<option value='all'>-- All --</option>";
- echo "<option value='soapval'".($paramType=='soapval'?' selected':'').">soap value</option>";
- echo "<option value='php'".($paramType=='php'?' selected':'').">php internal type</option></select>\n";
- echo "<select name='useWSDL'>";
-// echo "<option value='all'>-- All --</option>";
- echo "<option value='0'>go Direct</option>";
- echo "<option value='1'".($useWSDL?' selected':'').">use WSDL</option></select>\n";
- echo "<input type='submit' value='Go'>\n";
- echo "</form><br>\n";
-}
-
-function testSelectForm($selected_test = NULL)
-{
- global $iop, $PHP_SELF;
- echo "Select a Round 2 test case to run:<br>\n";
- echo "<form action='$PHP_SELF' method='post'>\n";
- echo "<select name='test'>\n";
- foreach ($iop->tests as $test) {
- $selected = '';
- if ($selected_test == $test) $selected = ' SELECTED';
- echo "<option value='$test'$selected>$test</option>\n";
- }
- echo "</select>\n";
- echo "<input type='submit' value='Go'>\n";
- echo "</form><br>\n";
-}
-
-testSelectForm($_POST['test']);
-endpointTestForm($_POST['test'],$_POST['endpoint'],$_POST['method'],$_POST['paramType'],$_POST['useWSDL']);
-
-if ($_POST['test'] && array_key_exists('endpoint', $_POST) && array_key_exists('method', $_POST)) {
- // here we execute the orders
- echo "<h2>Calling {$_POST['method']} at {$_POST['endpoint']}</h2>\n";
- echo "NOTE: wire's are slightly modified to display better in web browsers.<br>\n";
-
- $iop->currentTest = $_POST['test']; // see $tests above
- $iop->paramType = $_POST['paramType']; // 'php' or 'soapval'
- $iop->useWSDL = $_POST['useWSDL']; // 1= do wsdl tests
- $iop->numServers = 0; // 0 = all
- $iop->specificEndpoint = $_POST['endpoint']; // test only this endpoint
- $iop->testMethod = $_POST['method']=='ALL'?'':$_POST['method']; // test only this method
- $iop->skipEndpointList = array(); // endpoints to skip
- $iop->nosave = 0; // 1= disable saving results to database
- // debug output
- $iop->show = 0;
- $iop->debug = 0;
- $iop->showFaults = 0; // used in result table output
- echo '<pre>';
- $iop->doTest(); // run a single set of tests using above options
- echo '</pre>';
-}
-?>
-</body>
-</html>
diff --git a/ext/soap/interop/client_round2_interop.php b/ext/soap/interop/client_round2_interop.php
deleted file mode 100644
index 7d981b33d2..0000000000
--- a/ext/soap/interop/client_round2_interop.php
+++ /dev/null
@@ -1,815 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-require_once 'DB.php'; // PEAR/DB
-require_once 'client_round2_params.php';
-require_once 'test.utility.php';
-require_once 'config.php';
-
-error_reporting(E_ALL ^ E_NOTICE);
-
-class Interop_Client
-{
- // database DNS
- var $DSN = "";
-
- // our central interop server, where we can get the list of endpoints
- var $interopServer = "http://www.whitemesa.net/wsdl/interopInfo.wsdl";
-
- // our local endpoint, will always get added to the database for all tests
- var $localEndpoint;
-
- // specify testing
- var $currentTest = 'base'; // see $tests above
- var $paramType = 'php'; // 'php' or 'soapval'
- var $useWSDL = 0; // 1= do wsdl tests
- var $numServers = 0; // 0 = all
- var $specificEndpoint = ''; // test only this endpoint
- var $testMethod = ''; // test only this method
- var $skipEndpointList = array(); // endpoints to skip
- var $nosave = 0;
- var $startAt = ''; // start in list at this endpoint
- // debug output
- var $show = 1;
- var $debug = 0;
- var $showFaults = 0; // used in result table output
-
- // PRIVATE VARIABLES
- var $dbc = NULL;
- var $totals = array();
- var $tests = array('base','GroupB', 'GroupC');
- var $paramTypes = array('php', 'soapval');
- var $endpoints = array();
-
- function Interop_Client() {
- global $interopConfig;
- $this->DSN = $interopConfig['DSN'];
- // set up the database connection
- $this->dbc = DB::connect($this->DSN, true);
- // if it errors out, just ignore it and rely on regular methods
- if (DB::isError($this->dbc)) {
- echo $this->dbc->getMessage();
- $this->dbc = NULL;
- }
- // set up local endpoint
- $this->localEndpoint['base'] = (object)array(
- 'endpointName'=>'PHP ext/soap',
- 'endpointURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/server_round2_base.php',
- 'wsdlURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/interop.wsdl.php'
- );
- $this->localEndpoint['GroupB'] = (object)array(
- 'endpointName'=>'PHP ext/soap',
- 'endpointURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/server_round2_groupB.php',
- 'wsdlURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/interopB.wsdl.php'
- );
- $this->localEndpoint['GroupC'] = (object)array(
- 'endpointName'=>'PHP ext/soap',
- 'endpointURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/server_round2_groupC.php',
- 'wsdlURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/echoheadersvc.wsdl.php'
- );
- }
-
- function _fetchEndpoints(&$soapclient, $test) {
- $this->_getEndpoints($test, 1);
-
- // retreive endpoints from the endpoint server
- $endpointArray = $soapclient->__call("GetEndpointInfo",array("groupName"=>$test),"http://soapinterop.org/info/","http://soapinterop.org/info/");
- if (PEAR::isError($endpointArray)) {
- print $soapclient->wire;
- print_r($endpointArray);
- return;
- }
-
- // add our local endpoint
- if ($this->localEndpoint[$test]) {
- array_push($endpointArray, $this->localEndpoint[$test]);
- }
-
- if (!$endpointArray) return;
-
- // reset the status to zero
- $res = $this->dbc->query("update endpoints set status = 0 where class='$test'");
- if (DB::isError($res)) {
- die ($res->getMessage());
- }
- if (is_object($res)) $res->free();
- // save new endpoints into database
- foreach($endpointArray as $k => $v){
- if (array_key_exists($v->endpointName,$this->endpoints)) {
- $res = $this->dbc->query("update endpoints set endpointURL='{$v->endpointURL}', wsdlURL='{$v->wsdlURL}', status=1 where id={$this->endpoints[$v->endpointName]['id']}");
- } else {
- $res = $this->dbc->query("insert into endpoints (endpointName,endpointURL,wsdlURL,class) values('{$v->endpointName}','{$v->endpointURL}','{$v->wsdlURL}','$test')");
- }
- if (DB::isError($res)) {
- die ($res->getMessage());
- }
- if (is_object($res)) $res->free();
- }
- }
-
- /**
- * fetchEndpoints
- * retreive endpoints interop server
- *
- * @return boolean result
- * @access private
- */
- function fetchEndpoints($test = NULL) {
- // fetch from the interop server
- $soapclient = new SoapObject($this->interopServer);
-
- if ($test) {
- $this->_fetchEndpoints($soapclient, $test);
- } else {
- foreach ($this->tests as $test) {
- $this->_fetchEndpoints($soapclient, $test);
- }
- $test = 'base';
- }
-
- // retreive all endpoints now
- $this->currentTest = $test;
- $x = $this->_getEndpoints();
- return $x;
- }
-
- /**
- * getEndpoints
- * retreive endpoints from either database or interop server
- *
- * @param string base (see local var $tests)
- * @param boolean all (if false, only get valid endpoints, status=1)
- * @return boolean result
- * @access private
- */
- function getEndpoints($base = 'base', $all = 0) {
- if (!$this->_getEndpoints($base, $all)) {
- return $this->fetchEndpoints($base);
- }
- return TRUE;
- }
-
- /**
- * _getEndpoints
- * retreive endpoints from database
- *
- * @param string base (see local var $tests)
- * @param boolean all (if false, only get valid endpoints, status=1)
- * @return boolean result
- * @access private
- */
- function _getEndpoints($base = "", $all = 0) {
- $this->endpoints = array();
-
- // build sql
- $sql = "select * from endpoints ";
- if ($base) {
- $sql .= "where class='$base' ";
- if (!$all) $sql .= "and status=1";
- } else
- if (!$all) $sql .= "where status=1";
-
- $db_ep = $this->dbc->getAll($sql,NULL, DB_FETCHMODE_ASSOC );
- if (DB::isError($db_ep)) {
- echo $sql."\n";
- echo $db_ep->getMessage();
- return FALSE;
- }
- // rearange the array
- foreach ($db_ep as $entry) {
- $this->endpoints[$entry['endpointName']] = $entry;
- }
-/*
- $this->endpoints["PHP ext/soap"] =
- array("endpointName" => "PHP ext/soap",
- "endpointURL" => "http://soap.4s4c.com/ilab/soap.asp",
- "wsdlURL" => "http://www.pocketsoap.com/services/ilab.wsdl",
- "class" => "base" "status"]=> string(1) "1" }
-*/
- if (count($this->endpoints) > 0) {
- $this->currentTest = $base;
- return TRUE;
- }
- return FALSE;
- }
-
- /**
- * getResults
- * retreive results from the database, stuff them into the endpoint array
- *
- * @access private
- */
- function getResults($test = 'base', $type = 'php', $wsdl = 0) {
- // be sure we have the right endpoints for this test result
- $this->getEndpoints($test);
-
- // retreive the results and put them into the endpoint info
- $sql = "select * from results where class='$test' and type='$type' and wsdl=$wsdl";
- $results = $this->dbc->getAll($sql,NULL, DB_FETCHMODE_ASSOC );
- foreach ($results as $result) {
- // find the endpoint
- foreach ($this->endpoints as $epn => $epi) {
- if ($epi['id'] == $result['endpoint']) {
- // store the info
- $this->endpoints[$epn]['methods'][$result['function']] = $result;
- break;
- }
- }
- }
- }
-
- /**
- * saveResults
- * save the results of a method test into the database
- *
- * @access private
- */
- function _saveResults($endpoint_id, &$soap_test) {
- if ($this->nosave) return;
-
- $result = $soap_test->result;
- $wire = $result['wire'];
- if ($result['success']) {
- $success = 'OK';
- $error = '';
- } else {
- $success = $result['fault']->faultcode;
- $error = $result['fault']->faultstring;
- if (!$wire) $wire= $result['fault']->detail;
- }
-
- $test_name = $soap_test->test_name;
- // add header info to the test name
- if ($soap_test->headers) {
- foreach ($soap_test->headers as $h) {
- $destination = 0;
- if (get_class($h) == 'soap_header') {
- if ($h->attributes['SOAP-ENV:actor'] == 'http://schemas.xmlsoap.org/soap/actor/next') $destination = 1;
- $test_name .= ":{$h->name},$destination,{$h->attributes['SOAP-ENV:mustUnderstand']}";
- } else {
- if (!$h[3] || $h[3] == 'http://schemas.xmlsoap.org/soap/actor/next') $destination = 1;
- if (!$h[2]) $h[2] = 0;
- $qn = new QName($h[0]);
- $test_name .= ":{$qn->name},$destination,".(int)$h[2];
- }
- }
- }
-
- $sql = "delete from results where endpoint=$endpoint_id ".
- "and class='$this->currentTest' and type='$this->paramType' ".
- "and wsdl=$this->useWSDL and function=".
- $this->dbc->quote($test_name);
- #echo "\n".$sql;
- $res = $this->dbc->query($sql);
- if (DB::isError($res)) {
- die ($res->getMessage());
- }
- if (is_object($res)) $res->free();
-
- $sql = "insert into results (endpoint,stamp,class,type,wsdl,function,result,error,wire) ".
- "values($endpoint_id,".time().",'$this->currentTest',".
- "'$this->paramType',$this->useWSDL,".
- $this->dbc->quote($test_name).",".
- $this->dbc->quote($success).",".
- $this->dbc->quote($error).",".
- ($wire?$this->dbc->quote($wire):"''").")";
- #echo "\n".$sql;
- $res = $this->dbc->query($sql);
-
- if (DB::isError($res)) {
- die ($res->getMessage());
- }
- if (is_object($res)) $res->free();
- }
-
- /**
- * decodeSoapval
- * decodes a soap value to php type, used for test result comparisions
- *
- * @param SOAP_Value soapval
- * @return mixed result
- * @access public
- */
- function decodeSoapval($soapval)
- {
- if (gettype($soapval) == "object" &&
- (strcasecmp(get_class($soapval),"soapparam") == 0 ||
- strcasecmp(get_class($soapval),"soapvar") == 0)) {
- if (strcasecmp(get_class($soapval),"soapparam") == 0)
- $val = $soapval->param_data->enc_value;
- else
- $val = $soapval->enc_value;
- } else {
- $val = $soapval;
- }
- if (is_array($val)) {
- foreach($val as $k => $v) {
- if (gettype($v) == "object" &&
- (strcasecmp(get_class($soapval),"soapparam") == 0 ||
- strcasecmp(get_class($soapval),"soapvar") == 0)) {
- $val[$k] = $this->decodeSoapval($v);
- }
- }
- }
- return $val;
- }
-
- /**
- * compareResult
- * compare two php types for a match
- *
- * @param string expect
- * @param string test_result
- * @return boolean result
- * @access public
- */
- function compareResult($expect, $result, $type = NULL)
- {
- return compare($expect, $result);
- }
-
-
- /**
- * doEndpointMethod
- * run a method on an endpoint and store it's results to the database
- *
- * @param array endpoint_info
- * @param SOAP_Test test
- * @return boolean result
- * @access public
- */
- function doEndpointMethod(&$endpoint_info, &$soap_test) {
- $ok = FALSE;
-
- // prepare a holder for the test results
- $soap_test->result['class'] = $this->currentTest;
- $soap_test->result['type'] = $this->paramType;
- $soap_test->result['wsdl'] = $this->useWSDL;
-
- 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);
- }
- $soap =& $endpoint_info['client'];
-
- # XXX how do we determine a failure on retreiving/parsing wsdl?
- if ($soap->wsdl->fault) {
- $fault = $soap->wsdl->fault->getFault();
- $soap_test->setResult(0,'WSDL',
- $fault->faultstring."\n\n".$fault->detail,
- $fault->faultstring,
- $fault
- );
- return FALSE;
- }
- } else {
- $fault = new SoapFault('WSDL',"no WSDL defined for $endpoint");
- $soap_test->setResult(0,'WSDL',
- $fault->faultstring,
- $fault->faultstring,
- $fault
- );
- return FALSE;
- }
- $namespace = false;
- $soapaction = false;
- } else {
- $namespace = $soapaction = 'http://soapinterop.org/';
- // hack to make tests work with MS SoapToolkit
- // it's the only one that uses this soapaction, and breaks if
- // it isn't right. Can't wait for soapaction to be fully depricated
- if ($this->currentTest == 'base' &&
- strstr($endpoint_info['endpointName'],'MS SOAP ToolKit 2.0')) {
- $soapaction = 'urn:soapinterop';
- }
- if (!array_key_exists('client',$endpoint_info)) {
- $endpoint_info['client'] = new SoapObject($endpoint_info['endpointURL'],$soapaction);
- $endpoint_info['client']->__trace(1);
- }
- $soap = $endpoint_info['client'];
- }
- // add headers to the test
- if ($soap_test->headers) {
- // $header is already a SOAP_Header class
- foreach ($soap_test->headers as $header) {
- $soap->addHeader($header);
- }
- }
- // XXX no way to set encoding
- // this lets us set UTF-8, US-ASCII or other
- //$soap->setEncoding($soap_test->encoding);
- if ($this->useWSDL) {
- $args = '';
- foreach ($soap_test->method_params as $pname => $param) {
- $arg = '$soap_test->method_params["'.$pname.'"]';
- $args .= $args?','.$arg:$arg;
- }
- $return = eval('return $soap->'.$soap_test->method_name.'('.$args.');');
- } else {
- $return = $soap->__call($soap_test->method_name,$soap_test->method_params,$soapaction, $namespace);
- }
-
-
- if(!$soap->__isfault()){
- if ($soap_test->expect !== NULL) {
- $sent = $soap_test->expect;
- } else if (is_array($soap_test->method_params) && count($soap_test->method_params) == 1) {
- reset($soap_test->method_params);
- $sent = current($soap_test->method_params);
- } else if (is_array($soap_test->method_params) && count($soap_test->method_params) == 0) {
- $sent = null;
- } else {
- $sent = $soap_test->method_params;
- }
-
- // compare header results
- $header_result = array();
- $headers_ok = TRUE;
-
- # XXX need to implement header support!
- #
- #if ($soap_test->headers) {
- # // $header is already a SOAP_Header class
- # foreach ($soap_test->headers as $header) {
- # if (get_class($header) != 'soap_header') {
- # // assume it's an array
- # $header = new SOAP_Header($header[0], NULL, $header[1], $header[2], $header[3], $header[4]);
- # }
- # $expect = $soap_test->headers_expect[$header->name];
- # $header_result[$header->name] = array();
- # // XXX need to fix need_result to identify the actor correctly
- # $need_result = $hresult ||
- # ($header->attributes['SOAP-ENV:actor'] == 'http://schemas.xmlsoap.org/soap/actor/next'
- # && $header->attributes['SOAP-ENV:mustUnderstand']);
- # if ($expect) {
- # $hresult = $soap->headers[key($expect)];
- # $ok = !$need_result || $this->compareResult($hresult ,$expect[key($expect)]);
- # } else {
- # $hresult = $soap->headers[$header->name];
- # $expect = $this->decodeSoapval($header);
- # $ok = !$need_result || $this->compareResult($hresult ,$expect);
- # }
- # $header_result[$header->name]['ok'] = $ok;
- # if (!$ok) $headers_ok = FALSE;
- # }
- #}
-
- # we need to decode what we sent so we can compare!
- $sent_d = $this->decodeSoapval($sent);
-
- $soap_test->result['sent'] = $sent;
- $soap_test->result['return'] = $return;
-
- // compare the results with what we sent
-
- if ($soap_test->cmp_func !== NULL) {
- $cmp_func = $soap_test->cmp_func;
- $ok = $cmp_func($sent_d,$return);
- } else {
- $ok = $this->compareResult($sent_d,$return, $sent->type);
- if (!$ok && $soap_test->expect) {
- $ok = $this->compareResult($soap_test->expect,$return);
- }
- }
-
- // save the wire
- $wire = "REQUEST:\n".str_replace('" ',"\" \n",str_replace('>',">\n",$soap->__getlastrequest()))."\n\n".
- "RESPONSE:\n".str_replace('" ',"\" \n",str_replace('>',">\n",$soap->__getlastresponse()))."\n\n".
- "EXPECTED:\n".var_dump_str($sent_d)."\n".
- "RESULTL:\n".var_dump_str($return);
- #print "Wire:".htmlentities($wire);
-
- if($ok){
- if (!$headers_ok) {
- $fault = new SoapFault('HEADER','The returned result did not match what we expected to receive');
- $soap_test->setResult(0,$fault->faultcode,
- $wire,
- $fault->faultstring,
- $fault
- );
- } else {
- $soap_test->setResult(1,'OK',$wire);
- $success = TRUE;
- }
- } else {
- $fault = new SoapFault('RESULT','The returned result did not match what we expected to receive');
- $soap_test->setResult(0,$fault->faultcode,
- $wire,
- $fault->faultstring,
- $fault
- );
- }
- } else {
- $fault = $soap->__getfault();
- if ($soap_test->expect_fault) {
- $ok = 1;
- $res = 'OK';
- } else {
- $ok = 0;
- $res =$fault->faultcode;
- }
- // save the wire
- $wire = "REQUEST:\n".str_replace('" ',"\" \n",str_replace('>',">\n",$soap->__getlastrequest()))."\n\n".
- "RESPONSE:\n".str_replace('" ',"\" \n",str_replace('>',">\n",$soap->__getlastresponse()));
- #print "Wire:".htmlentities($wire);
-
- $soap_test->setResult($ok,$res, $wire,$fault->faultstring, $fault);
-
- }
- return $ok;
- }
-
-
- /**
- * doTest
- * run a single round of tests
- *
- * @access public
- */
- function doTest() {
- global $soap_tests;
- // get endpoints for this test
- $this->getEndpoints($this->currentTest);
- #clear totals
- $this->totals = array();
-
- $i = 0;
- foreach($this->endpoints as $endpoint => $endpoint_info){
-
- // if we specify an endpoint, skip until we find it
- if ($this->specificEndpoint && $endpoint != $this->specificEndpoint) continue;
- if ($this->useWSDL && !$endpoint_info['endpointURL']) continue;
-
- $skipendpoint = FALSE;
- $this->totals['servers']++;
- #$endpoint_info['tests'] = array();
-
- if ($this->show) print "Processing $endpoint at {$endpoint_info['endpointURL']}<br>\n";
-
- foreach($soap_tests[$this->currentTest] as $soap_test) {
- //foreach(array_keys($method_params[$this->currentTest][$this->paramType]) as $method)
-
- // only run the type of test we're looking for (php or soapval)
- if ($soap_test->type != $this->paramType) continue;
-
- // if we haven't reached our startpoint, skip
- if ($this->startAt && $this->startAt != $endpoint_info['endpointName']) continue;
- $this->startAt = '';
-
- // if this is in our skip list, skip it
- if (in_array($endpoint, $this->skipEndpointList)) {
- $skipendpoint = TRUE;
- $skipfault = new SoapFault('SKIP','endpoint skipped');
- $soap_test->setResult(0,$fault->faultcode, '',
- $skipfault->faultstring,
- $skipfault
- );
- #$endpoint_info['tests'][] = &$soap_test;
- #$soap_test->showTestResult($this->debug);
- #$this->_saveResults($endpoint_info['id'], $soap_test->method_name);
- $soap_test->result = NULL;
- continue;
- }
-
- // if we're looking for a specific method, skip unless we have it
- if ($this->testMethod && strcmp($this->testMethod,$soap_test->test_name) != 0) continue;
- if ($this->testMethod && $this->currentTest == 'GroupC') {
- // we have to figure things out now
- if (!preg_match('/(.*):(.*),(\d),(\d)/',$this->testMethod, $m)) continue;
-
- // is the header in the headers list?
- $gotit = FALSE;
- foreach ($soap_test->headers as $header) {
- if (get_class($header) == 'soap_header') {
- if ($header->name == $m[2]) {
- $gotit = $header->attributes['SOAP-ENV:actor'] == ($m[3]?SOAP_TEST_ACTOR_NEXT:SOAP_TEST_ACTOR_OTHER);
- $gotit = $gotit && $header->attributes['SOAP-ENV:mustUnderstand'] == $m[4];
- }
- } else {
- if ($header[0] == $m[2]) {
- $gotit = $gotit && $header[3] == ($m[3]?SOAP_TEST_ACTOR_NEXT:SOAP_TEST_ACTOR_OTHER);
- $gotit = $gotit && $header[4] == $m[4];
- }
- }
- }
- if (!$gotit) continue;
- }
-
- // if we are skipping the rest of the tests (due to error) note a fault
- if ($skipendpoint) {
- $soap_test->setResult(0,$fault->faultcode, '',
- $skipfault->faultstring,
- $skipfault
- );
- #$endpoint_info['tests'][] = &$soap_test;
- $this->totals['fail']++;
- } else {
- // run the endpoint test
- if ($this->doEndpointMethod($endpoint_info, $soap_test)) {
- $this->totals['success']++;
- } else {
- $skipendpoint = $soap_test->result['fault']->faultcode=='HTTP'
- && strstr($soap_test->result['fault']->faultstring,'Connect Error');
- $skipfault = $soap_test->result['fault'];
- $this->totals['fail']++;
- }
- #$endpoint_info['tests'][] = &$soap_test;
- }
- $soap_test->showTestResult($this->debug);
- $this->_saveResults($endpoint_info['id'], $soap_test);
- $soap_test->result = NULL;
- $this->totals['calls']++;
- }
- if ($this->numservers && ++$i >= $this->numservers) break;
- }
- }
-
- function doGroupTests() {
- $dowsdl = array(0,1);
- foreach($dowsdl as $usewsdl) {
- $this->useWSDL = $usewsdl;
- foreach($this->paramTypes as $ptype) {
- // skip a pointless test
- if ($usewsdl && $ptype == 'soapval') break;
- $this->paramType = $ptype;
- $this->doTest();
- }
- }
- }
-
- /**
- * doTests
- * go all out. This takes time.
- *
- * @access public
- */
- function doTests() {
- // the mother of all interop tests
- $dowsdl = array(0,1);
- foreach($this->tests as $test) {
- $this->currentTest = $test;
- foreach($dowsdl as $usewsdl) {
- $this->useWSDL = $usewsdl;
- foreach($this->paramTypes as $ptype) {
- // skip a pointless test
- if ($usewsdl && $ptype == 'soapval') break;
- $this->paramType = $ptype;
- $this->doTest();
- }
- }
- }
- }
-
- // ***********************************************************
- // output functions
-
- /**
- * getResults
- * retreive results from the database, stuff them into the endpoint array
- *
- * @access private
- */
- function getMethodList($test = 'base') {
- // retreive the results and put them into the endpoint info
- $sql = "select distinct(function) from results where class='$test' order by function";
- $results = $this->dbc->getAll($sql);
- $ar = array();
- foreach($results as $result) {
- $ar[] = $result[0];
- }
- return $ar;
- }
-
- function outputTable()
- {
- $methods = $this->getMethodList($this->currentTest);
- if (!$methods) return;
- $this->getResults($this->currentTest,$this->paramType,$this->useWSDL);
-
- echo "<b>Testing $this->currentTest ";
- if ($this->useWSDL) echo "using WSDL ";
- else echo "using Direct calls ";
- echo "with $this->paramType values</b><br>\n";
-
- // calculate totals for this table
- $this->totals['success'] = 0;
- $this->totals['fail'] = 0;
- $this->totals['servers'] = 0; #count($this->endpoints);
- foreach ($this->endpoints as $endpoint => $endpoint_info) {
- if (count($endpoint_info['methods']) > 0) {
- $this->totals['servers']++;
- foreach ($methods as $method) {
- $r = $endpoint_info['methods'][$method]['result'];
- if ($r == 'OK') $this->totals['success']++;
- else $this->totals['fail']++;
- }
- } else {
- unset($this->endpoints[$endpoint]);
- }
- }
- $this->totals['calls'] = count($methods) * $this->totals['servers'];
-
-# if ($this->totals['fail'] == $this->totals['calls']) {
-# // assume tests have not run, skip outputing table
-# print "No Data Available<br>\n";
-# return;
-# }
-
- echo "\n\n<b>Servers: {$this->totals['servers']} Calls: {$this->totals['calls']} Success: {$this->totals['success']} Fail: {$this->totals['fail']}</b><br>\n";
-
- echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\">\n";
- echo "<tr><td class=\"BLANK\">Endpoint</td>\n";
- foreach ($methods as $method) {
- $info = split(':', $method);
- echo "<td class='BLANK' valign='top'>";
- foreach ($info as $m) {
- $hi = split(',',$m);
- echo '<b>'.$hi[0]."</b><br>\n";
- if (count($hi) > 1) {
- echo "&nbsp;&nbsp;Actor=".($hi[1]?'Target':'Not Target')."<br>\n";
- echo "&nbsp;&nbsp;MustUnderstand=$hi[2]<br>\n";
- }
- }
- echo "</td>\n";
- }
- echo "</tr>\n";
- $faults = array();
- $fi = 0;
- foreach ($this->endpoints as $endpoint => $endpoint_info) {
- if (array_key_exists('wsdlURL',$endpoint_info)) {
- echo "<tr><td class=\"BLANK\"><a href=\"{$endpoint_info['wsdlURL']}\">$endpoint</a></td>\n";
- } else {
- echo "<tr><td class=\"BLANK\">$endpoint</td>\n";
- }
- foreach ($methods as $method) {
- $id = $endpoint_info['methods'][$method]['id'];
- $r = $endpoint_info['methods'][$method]['result'];
- $e = $endpoint_info['methods'][$method]['error'];
- if ($e) {
- $faults[$fi++] = $e;
- }
- if ($r) {
- echo "<td class='$r'><a href='$PHP_SELF?wire=$id'>$r</a></td>\n";
- } else {
- echo "<td class='untested'>untested</td>\n";
- }
- }
- echo "</tr>\n";
- }
- echo "</table><br>\n";
- if ($this->showFaults && count($faults) > 0) {
- echo "<b>ERROR Details:</b><br>\n<ul>\n";
- # output more error detail
- foreach ($faults as $fault) {
- echo '<li>'.HTMLSpecialChars($fault)."</li>\n";
- }
- }
- echo "</ul><br><br>\n";
- }
-
- function outputTables() {
- // the mother of all interop tests
- $dowsdl = array(0,1);
- foreach($this->tests as $test) {
- $this->currentTest = $test;
- foreach($dowsdl as $usewsdl) {
- $this->useWSDL = $usewsdl;
- foreach($this->paramTypes as $ptype) {
- // skip a pointless test
- if ($usewsdl && $ptype == 'soapval') break;
- $this->paramType = $ptype;
- $this->outputTable();
- }
- }
- }
- }
-
- function showWire($id) {
- $results = $this->dbc->getAll("select * from results where id=$id",NULL, DB_FETCHMODE_ASSOC );
- #$wire = preg_replace("/>/",">\n",$results[0]['wire']);
- $wire = $results[0]['wire'];
- echo "<pre>\n".HTMLSpecialChars($wire)."</pre>\n";
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/ext/soap/interop/client_round2_params.php b/ext/soap/interop/client_round2_params.php
deleted file mode 100644
index 0cadd979a7..0000000000
--- a/ext/soap/interop/client_round2_params.php
+++ /dev/null
@@ -1,653 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-define('SOAP_TEST_ACTOR_NEXT','http://schemas.xmlsoap.org/soap/actor/next');
-define('SOAP_TEST_ACTOR_OTHER','http://some/other/actor');
-
-class SOAP_Test {
- var $type = 'php';
- var $test_name = NULL;
- var $method_name = NULL;
- var $method_params = NULL;
- var $cmp_func = NULL;
- var $expect = NULL;
- var $expect_fault = FALSE;
- var $headers = NULL;
- var $headers_expect = NULL;
- var $result = array();
- var $show = 1;
- var $debug = 0;
- var $encoding = 'UTF-8';
-
- function SOAP_Test($methodname, $params, $expect = NULL, $cmp_func = NULL) {
- # XXX we have to do this to make php-soap happy with NULL params
- if (!$params) $params = array();
-
- if (strchr($methodname,'(')) {
- preg_match('/(.*)\((.*)\)/',$methodname,$matches);
- $this->test_name = $methodname;
- $this->method_name = $matches[1];
- } else {
- $this->test_name = $this->method_name = $methodname;
- }
- $this->method_params = $params;
- if ($expect !== NULL) {
- $this->expect = $expect;
- }
- if ($cmp_func !== NULL) {
- $this->cmp_func = $cmp_func;
- }
-
- // determine test type
- if ($params) {
- $v = array_values($params);
- if (gettype($v[0]) == 'object' &&
- (get_class($v[0]) == 'soapvar' || get_class($v[0]) == 'soapparam'))
- $this->type = 'soapval';
- }
- }
-
- function setResult($ok, $result, $wire, $error = '', $fault = NULL)
- {
- $this->result['success'] = $ok;
- $this->result['result'] = $result;
- $this->result['error'] = $error;
- $this->result['wire'] = $wire;
- $this->result['fault'] = $fault;
- }
-
- /**
- * showMethodResult
- * print simple output about a methods result
- *
- * @param array endpoint_info
- * @param string method
- * @access public
- */
- function showTestResult($debug = 0) {
- // debug output
- if ($debug) $this->show = 1;
- if ($debug) {
- echo str_repeat("-",50)."<br>\n";
- }
-
- echo "testing $this->test_name : ";
- if ($this->headers) {
- foreach ($this->headers as $h) {
- if (get_class($h) == 'soap_header') {
-
- echo "\n {$h->name},{$h->attributes['SOAP-ENV:actor']},{$h->attributes['SOAP-ENV:mustUnderstand']} : ";
- } else {
- if (!$h[4]) $h[4] = SOAP_TEST_ACTOR_NEXT;
- if (!$h[3]) $h[3] = 0;
- echo "\n $h[0],$h[4],$h[3] : ";
- }
- }
- }
-
- if ($debug) {
- print "method params: ";
- print_r($this->params);
- print "\n";
- }
-
- $ok = $this->result['success'];
- if ($ok) {
- print "<font color=\"#00cc00\">SUCCESS</font>\n";
- } else {
- $fault = $this->result['fault'];
- if ($fault) {
- print "<font color=\"#ff0000\">FAILED: {$fault->faultcode} {$fault->faultstring}</font>\n";
- } else {
- print "<font color=\"#ff0000\">FAILED: ".$this->result['result']."</font>\n";
- }
- }
- if ($debug) {
- echo "<pre>\n".htmlentities($this->result['wire'])."</pre>\n";
- }
- }
-}
-
-# XXX I know this isn't quite right, need to deal with this better
-function make_2d($x, $y)
-{
- for ($_x = 0; $_x < $x; $_x++) {
- for ($_y = 0; $_y < $y; $_y++) {
- $a[$_x][$_y] = "x{$_x}y{$_y}";
- }
- }
- return $a;
-}
-
-function soap_value($name, $value, $type) {
- return new soapparam(new soapvar($value,$type),$name);
-}
-
-class SOAPStruct {
- var $varString;
- var $varInt;
- var $varFloat;
- function SOAPStruct($s, $i, $f) {
- $this->varString = $s;
- $this->varInt = $i;
- $this->varFloat = $f;
- }
-}
-
-//***********************************************************
-// Base echoString
-
-$soap_tests['base'][] = new SOAP_Test('echoString', array('inputString' => 'hello world!'));
-$soap_tests['base'][] = new SOAP_Test('echoString', array('inputString' => soap_value('inputString','hello world',XSD_STRING)));
-$soap_tests['base'][] = new SOAP_Test('echoString(empty)', array('inputString' => ''));
-$soap_tests['base'][] = new SOAP_Test('echoString(empty)', array('inputString' => soap_value('inputString','',XSD_STRING)));
-$soap_tests['base'][] = new SOAP_Test('echoString(null)', array('inputString' => NULL));
-$soap_tests['base'][] = new SOAP_Test('echoString(null)', array('inputString' => soap_value('inputString',NULL,XSD_STRING)));
-//$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => ">,<,&,\",',0:\x00",1:\x01,2:\x02,3:\x03,4:\x04,5:\x05,6:\x06,7:\x07,8:\x08,9:\x09,10:\x0a,11:\x0b,12:\x0c,13:\x0d,14:\x0e,15:\x0f,16:\x10,17:\x11,18:\x12,19:\x13,20:\x14,21:\x15,22:\x16,23:\x17,24:\x18,25:\x19,26:\x1a,27:\x1b,28:\x1c,29:\x1d,30:\x1e,31:\x1f"));
-//$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => soap_value('inputString',">,<,&,\",',0:\x00",1:\x01,2:\x02,3:\x03,4:\x04,5:\x05,6:\x06,7:\x07,8:\x08,9:\x09,10:\x0a,11:\x0b,12:\x0c,13:\x0d,14:\x0e,15:\x0f,16:\x10,17:\x11,18:\x12,19:\x13,20:\x14,21:\x15,22:\x16,23:\x17,24:\x18,25:\x19,26:\x1a,27:\x1b,28:\x1c,29:\x1d,30:\x1e,31:\x1f",XSD_STRING)));
-$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => ">,<,&,\",',\\,\n"));
-$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => soap_value('inputString',">,<,&,\",',\\,\n",XSD_STRING)));
-$test = new SOAP_Test('echoString(utf-8)', array('inputString' => utf8_encode('ỗÈéóÒ₧⅜ỗỸ')));
-$test->encoding = 'UTF-8';
-$soap_tests['base'][] = $test;
-$test = new SOAP_Test('echoString(utf-8)', array('inputString' => soap_value('inputString',utf8_encode('ỗÈéóÒ₧⅜ỗỸ'),XSD_STRING)));
-$test->encoding = 'UTF-8';
-$soap_tests['base'][] = $test;
-
-//***********************************************************
-// Base echoStringArray
-
-$soap_tests['base'][] = new SOAP_Test('echoStringArray',
- array('inputStringArray' => array('good','bad')));
-$soap_tests['base'][] = new SOAP_Test('echoStringArray',
- array('inputStringArray' =>
- soap_value('inputStringArray',array('good','bad'),SOAP_ENC_ARRAY)));
-
-$soap_tests['base'][] = new SOAP_Test('echoStringArray(one)',
- array('inputStringArray' => array('good')));
-$soap_tests['base'][] = new SOAP_Test('echoStringArray(one)',
- array('inputStringArray' =>
- soap_value('inputStringArray',array('good'),SOAP_ENC_ARRAY)));
-
-// empty array test
-$soap_tests['base'][] = new SOAP_Test('echoStringArray(empty)', array('inputStringArray' => array()));
-$soap_tests['base'][] = new SOAP_Test('echoStringArray(empty)', array('inputStringArray' => soap_value('inputStringArray',array(),SOAP_ENC_ARRAY)));
-
-# XXX NULL Arrays not supported
-// null array test
-$soap_tests['base'][] = new SOAP_Test('echoStringArray(null)', array('inputStringArray' => NULL));
-$soap_tests['base'][] = new SOAP_Test('echoStringArray(null)', array('inputStringArray' => soap_value('inputStringArray',NULL,SOAP_ENC_ARRAY)));
-
-//***********************************************************
-// Base echoInteger
-$x = new SOAP_Test('echoInteger', array('inputInteger' => 34345));
-$soap_tests['base'][] = new SOAP_Test('echoInteger', array('inputInteger' => 34345));
-$soap_tests['base'][] = new SOAP_Test('echoInteger', array('inputInteger' => soap_value('inputInteger',12345,XSD_INT)));
-
-//***********************************************************
-// Base echoIntegerArray
-
-$soap_tests['base'][] = new SOAP_Test('echoIntegerArray', array('inputIntegerArray' => array(1,234324324,2)));
-$soap_tests['base'][] = new SOAP_Test('echoIntegerArray',
- array('inputIntegerArray' =>
- soap_value('inputIntegerArray',
- array(new soapvar(12345,XSD_INT),new soapvar(654321,XSD_INT)),
- SOAP_ENC_ARRAY)));
-
-//***********************************************************
-// Base echoFloat
-
-$soap_tests['base'][] = new SOAP_Test('echoFloat', array('inputFloat' => 342.23));
-$soap_tests['base'][] = new SOAP_Test('echoFloat', array('inputFloat' => soap_value('inputFloat',123.45,XSD_FLOAT)));
-
-//***********************************************************
-// Base echoFloatArray
-
-$soap_tests['base'][] = new SOAP_Test('echoFloatArray', array('inputFloatArray' => array(1.3223,34.2,325.325)));
-$soap_tests['base'][] = new SOAP_Test('echoFloatArray',
- array('inputFloatArray' =>
- soap_value('inputFloatArray',
- array(new soapvar(123.45,XSD_FLOAT),new soapvar(654.321,XSD_FLOAT)),
- SOAP_ENC_ARRAY)));
-//***********************************************************
-// Base echoStruct
-
-$soapstruct = new SOAPStruct('arg',34,325.325);
-# XXX no way to set a namespace!!!
-$soapsoapstruct = soap_value('inputStruct',$soapstruct,SOAP_ENC_OBJECT);
-$soap_tests['base'][] = new SOAP_Test('echoStruct', array('inputStruct' =>$soapstruct));
-$soap_tests['base'][] = new SOAP_Test('echoStruct', array('inputStruct' =>$soapsoapstruct));
-
-//***********************************************************
-// Base echoStructArray
-
-$soap_tests['base'][] = new SOAP_Test('echoStructArray', array('inputStructArray' => array(
- $soapstruct,$soapstruct,$soapstruct)));
-$soap_tests['base'][] = new SOAP_Test('echoStructArray', array('inputStructArray' =>
- soap_value('inputStructArray',array($soapstruct,$soapstruct,$soapstruct),SOAP_ENC_ARRAY)));
-
-
-//***********************************************************
-// Base echoVoid
-
-$soap_tests['base'][] = new SOAP_Test('echoVoid', NULL);
-$test = new SOAP_Test('echoVoid', NULL);
-$test->type = 'soapval';
-$soap_tests['base'][] = $test;
-
-//***********************************************************
-// Base echoBase64
-
-$soap_tests['base'][] = new SOAP_Test('echoBase64', array('inputBase64' => 'TmVicmFza2E='));
-$soap_tests['base'][] = new SOAP_Test('echoBase64', array('inputBase64' =>
- soap_value('inputBase64','TmVicmFza2E=',XSD_BASE64BINARY)));
-
-//***********************************************************
-// Base echoHexBinary
-
-$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' => '736F61707834'),'736F61707834','hex_compare');
-$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' =>
- soap_value('inputHexBinary','736F61707834',XSD_HEXBINARY)),'736F61707834','hex_compare');
-
-//***********************************************************
-// Base echoDecimal
-
-# XXX test fails because php-soap incorrectly sets decimal to long rather than float
-$soap_tests['base'][] = new SOAP_Test('echoDecimal', array('inputDecimal' => '12345.67890'));
-$soap_tests['base'][] = new SOAP_Test('echoDecimal', array('inputDecimal' =>
- soap_value('inputDecimal','12345.67890',XSD_DECIMAL)));
-
-//***********************************************************
-// Base echoDate
-
-# php-soap doesn't handle datetime types properly yet
-$soap_tests['base'][] = new SOAP_Test('echoDate', array('inputDate' => '2001-05-24T17:31:41Z'), null, 'date_compare');
-$soap_tests['base'][] = new SOAP_Test('echoDate', array('inputDate' =>
- soap_value('inputDate','2001-05-24T17:31:41Z',XSD_DATETIME)), null, 'date_compare');
-
-//***********************************************************
-// Base echoBoolean
-
-# php-soap sends boolean as zero or one, which is ok, but to be explicit, send true or false.
-$soap_tests['base'][] = new SOAP_Test('echoBoolean(true)', array('inputBoolean' => TRUE));
-$soap_tests['base'][] = new SOAP_Test('echoBoolean(true)', array('inputBoolean' =>
- soap_value('inputBoolean',TRUE,XSD_BOOLEAN)));
-$soap_tests['base'][] = new SOAP_Test('echoBoolean(false)', array('inputBoolean' => FALSE));
-$soap_tests['base'][] = new SOAP_Test('echoBoolean(false)', array('inputBoolean' =>
- soap_value('inputBoolean',FALSE,XSD_BOOLEAN)));
-$soap_tests['base'][] = new SOAP_Test('echoBoolean(1)', array('inputBoolean' => 1),true);
-$soap_tests['base'][] = new SOAP_Test('echoBoolean(1)', array('inputBoolean' =>
- soap_value('inputBoolean',1,XSD_BOOLEAN)),true);
-$soap_tests['base'][] = new SOAP_Test('echoBoolean(0)', array('inputBoolean' => 0),false);
-$soap_tests['base'][] = new SOAP_Test('echoBoolean(0)', array('inputBoolean' =>
- soap_value('inputBoolean',0,XSD_BOOLEAN)),false);
-
-
-
-//***********************************************************
-// GROUP B
-
-
-//***********************************************************
-// GroupB echoStructAsSimpleTypes
-
-$expect = array(
- 'outputString'=>'arg',
- 'outputInteger'=>34,
- 'outputFloat'=>325.325
- );
-$soap_tests['GroupB'][] = new SOAP_Test('echoStructAsSimpleTypes',
- array('inputStruct' => (object)array(
- 'varString'=>'arg',
- 'varInt'=>34,
- 'varFloat'=>325.325
- )), $expect);
-$soap_tests['GroupB'][] = new SOAP_Test('echoStructAsSimpleTypes',
- array('inputStruct' =>
- soap_value('inputStruct',
- (object)array('varString' => 'arg',
- 'varInt' => 34,
- 'varFloat' => 325.325
- ), SOAP_ENC_OBJECT)), $expect);
-
-//***********************************************************
-// GroupB echoSimpleTypesAsStruct
-
-$expect =
- (object)array(
- 'varString'=>'arg',
- 'varInt'=>34,
- 'varFloat'=>325.325
- );
-$soap_tests['GroupB'][] = new SOAP_Test('echoSimpleTypesAsStruct',
- array(
- 'inputString'=>'arg',
- 'inputInteger'=>34,
- 'inputFloat'=>325.325
- ), $expect);
-$soap_tests['GroupB'][] = new SOAP_Test('echoSimpleTypesAsStruct',
- array(
- soap_value('inputString','arg', XSD_STRING),
- soap_value('inputInteger',34, XSD_INT),
- soap_value('inputFloat',325.325, XSD_FLOAT)
- ), $expect);
-
-//***********************************************************
-// GroupB echo2DStringArray
-
-$soap_tests['GroupB'][] = new SOAP_Test('echo2DStringArray',
- array('input2DStringArray' => make_2d(3,3)));
-
-$multidimarray =
- soap_value('input2DStringArray',
- array(
- array('row0col0', 'row0col1', 'row0col2'),
- array('row1col0', 'row1col1', 'row1col2')
- ), SOAP_ENC_ARRAY
- );
-//$multidimarray->options['flatten'] = TRUE;
-$soap_tests['GroupB'][] = new SOAP_Test('echo2DStringArray',
- array('input2DStringArray' => $multidimarray));
-
-//***********************************************************
-// GroupB echoNestedStruct
-
-$soap_tests['GroupB'][] = new SOAP_Test('echoNestedStruct',
- array('inputStruct' => (object)array(
- 'varString'=>'arg',
- 'varInt'=>34,
- 'varFloat'=>325.325,
- 'varStruct' => (object)array(
- 'varString'=>'arg',
- 'varInt'=>34,
- 'varFloat'=>325.325
- )
- )));
-$soap_tests['GroupB'][] = new SOAP_Test('echoNestedStruct',
- array('inputStruct' =>
- soap_value('inputStruct',
- (object)array(
- 'varString'=>'arg',
- 'varInt'=>34,
- 'varFloat'=>325.325,
- 'varStruct' => (object)array(
- 'varString'=>'arg',
- 'varInt'=>34,
- 'varFloat'=>325.325
- )
-// array( #push struct elements into one soap value
-// soap_value('varString','arg', XSD_STRING),
-// soap_value('varInt',34, XSD_INT),
-// soap_value('varFloat',325.325,XSD_FLOAT),
-// soap_value('varStruct',
-// (object)array('varString' => 'arg',
-// 'varInt' => 34,
-// 'varFloat' => 325.325
-// ), SOAP_ENC_OBJECT
- ), SOAP_ENC_OBJECT
- )));
-
-//***********************************************************
-// GroupB echoNestedArray
-
-$soap_tests['GroupB'][] = new SOAP_Test('echoNestedArray',
- array('inputStruct' => (object)array(
- 'varString'=>'arg',
- 'varInt'=>34,
- 'varFloat'=>325.325,
- 'varArray' => array('red','blue','green')
- )));
-$soap_tests['GroupB'][] = new SOAP_Test('echoNestedArray',
- array('inputStruct' =>
- soap_value('inputStruct',
- (object)array('varString' => 'arg',
- 'varInt' => 34,
- 'varFloat' => 325.325,
- 'varArray' =>
- array("red", "blue", "green")
-// soap_value('item','red', XSD_STRING),
-// soap_value('item','blue', XSD_STRING),
-// soap_value('item','green', XSD_STRING)
-// )
- ), SOAP_ENC_OBJECT
- )));
-
-
-#//***********************************************************
-#// GROUP C header tests
-#
-#//***********************************************************
-#// echoMeStringRequest php val tests
-#
-#// echoMeStringRequest with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 0,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 1,SOAP_TEST_ACTOR_NEXT);
-#$this->type = 'soapval'; // force a soapval version of this test
-#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStringRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStringRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// echoMeStringRequest soapval tests
-#
-#// echoMeStringRequest with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world');
-#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1);
-#$this->type = 'soapval'; // force a soapval version of this test
-#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStringRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStringRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint header destination, must understand,
-#// invalid namespace, should recieve a fault
-##$test = new SOAP_Test('echoVoid', NULL);
-##$test->type = 'soapval';
-##$test->headers[] = new SOAP_Header('{http://unknown.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1);
-##$test->headers_expect['echoMeStringRequest'] = array();
-##$test->expect_fault = TRUE;
-##$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// php val tests
-#// echoMeStructRequest with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
-# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
-# 0,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeStructRequest'] =
-# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
-# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
-# 1,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeStructRequest'] =
-# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
-# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
-# 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStructRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
-# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
-# 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStructRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// soapval tests
-#// echoMeStructRequest with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# ));
-#$test->headers_expect['echoMeStructRequest'] =
-# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# ), 1);
-#$test->headers_expect['echoMeStructRequest'] =
-# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# ), 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStructRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# ), 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStructRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// echoMeUnknown php val tests
-#// echoMeUnknown with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',0,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',1,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$test->expect_fault = TRUE;
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!', 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// echoMeUnknown soapval tests
-#// echoMeUnknown with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!');
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!',1);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$test->expect_fault = TRUE;
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!', 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!', 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-
-
-?> \ No newline at end of file
diff --git a/ext/soap/interop/client_round2_results.php b/ext/soap/interop/client_round2_results.php
deleted file mode 100644
index 42c49e2b39..0000000000
--- a/ext/soap/interop/client_round2_results.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-// NOTE: do not run this directly under a web server, as it will take a very long
-// time to execute. Run from a command line or something, and redirect output
-// to an html file.
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-require_once 'client_round2_interop.php';
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
-<style>
-TD { background-color: Red; }
-TD.BLANK { background-color: White; }
-TD.OK { background-color: Lime; }
-TD.RESULT { background-color: Green; }
-TD.untested { background-color: White; }
-TD.CONNECT { background-color: Yellow; }
-TD.TRANSPORT { background-color: Yellow; }
-TD.WSDL { background-color: Yellow; }
-TD.WSDLCACHE { background-color: Yellow; }
-TD.WSDLPARSER { background-color: Yellow; }
-TD.HTTP { background-color: Yellow; }
-TD.SMTP { background-color: Yellow; }
-</style>
- <title>PEAR-PHP SOAP Interop Tests</title>
-</head>
-
-<body bgcolor="White" text="Black">
-<h2 align="center">SOAP Client Interop Test Results: Round2</h2>
-
-<a href="index.php">Back to Interop Index</a><br>
-<p>&nbsp;</p>
-
-<?php
-$iop = new Interop_Client();
-
-if ($_GET['detail'] == 1) $iop->showFaults = 1;
-
-if ($_GET['wire']) {
- $iop->showWire($_GET['wire']);
-} else {
- $iop->getEndpoints();
- $iop->getResults();
-
- if ($_GET['test']) {
- $iop->currentTest = $_GET['test'];
- $iop->useWSDL = $_GET['wsdl']?$_GET['wsdl']:0;
- $iop->paramType = $_GET['type']?$_GET['type']:'php';
- $iop->outputTable();
- } else {
- $iop->outputTables();
- }
-}
-?>
-</body>
-</html>
diff --git a/ext/soap/interop/client_round2_run.php b/ext/soap/interop/client_round2_run.php
deleted file mode 100644
index d879353694..0000000000
--- a/ext/soap/interop/client_round2_run.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-// this script is usefull for quickly testing stuff, use the 'pretty' file for html output
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-set_time_limit(0);
-require_once 'client_round2_interop.php';
-
-$iop = new Interop_Client();
-// force a fetch of endpoints, this happens irregardless if no endpoints in database
-#$iop->fetchEndpoints();
-
-// set some options
-$iop->currentTest = 'base'; // see $tests above
-$iop->paramType = 'php'; // 'php' or 'soapval'
-$iop->useWSDL = 0; // 1= do wsdl tests
-$iop->numServers = 0; // 0 = all
-//$iop->specificEndpoint = '4s4c'; // test only this endpoint
-//$iop->testMethod = 'echoString'; // test only this method
-
-#XXX MS SOAP ToolKit 2.0/3.0 crashes php-soap in __getfault!
-
-// endpoints to skip
-$iop->skipEndpointList = array('Apache Axis','IONA XMLBus','IONA XMLBus (CORBA)','MS SOAP ToolKit 2.0','MS SOAP ToolKit 3.0','Spheon JSOAP','SQLData SOAP Server','WASP Advanced 3.0');
-$iop->startAt='';
-$iop->nosave = 0; // 1= disable saving results to database
-// debug output
-$iop->show = 1;
-$iop->debug = 0;
-$iop->showFaults = 0; // used in result table output
-
-$iop->doTest(); // run a single set of tests using above options
-#$iop->doGroupTests(); // run a group of tests set in $currentTest
-#$iop->doTests(); // run all tests, ignore above options
-#$iop->outputTables();
-echo "done";
-
-?>
diff --git a/ext/soap/interop/config.php.dist b/ext/soap/interop/config.php.dist
deleted file mode 100644
index 3e9549cdfe..0000000000
--- a/ext/soap/interop/config.php.dist
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-// configuration items
-$interopConfig['DSN'] = 'mysql://root@localhost/soapinterop';
-?> \ No newline at end of file
diff --git a/ext/soap/interop/database_round2.sql b/ext/soap/interop/database_round2.sql
deleted file mode 100644
index 6834b0eeae..0000000000
--- a/ext/soap/interop/database_round2.sql
+++ /dev/null
@@ -1,44 +0,0 @@
-# phpMyAdmin MySQL-Dump
-# version 2.2.5
-# http://phpwizard.net/phpMyAdmin/
-# http://phpmyadmin.sourceforge.net/ (download page)
-#
-# Host: localhost
-# Generation Time: Apr 08, 2002 at 08:32 PM
-# Server version: 3.23.49
-# PHP Version: 4.1.1
-# Database : `interop`
-# --------------------------------------------------------
-
-#
-# Table structure for table `endpoints`
-#
-
-CREATE TABLE endpoints (
- id int(11) NOT NULL auto_increment,
- endpointName varchar(50) NOT NULL default '',
- endpointURL varchar(255) NOT NULL default '',
- wsdlURL varchar(255) NOT NULL default '',
- class varchar(20) NOT NULL default '',
- status int(11) NOT NULL default '1',
- PRIMARY KEY (id)
-) TYPE=MyISAM;
-# --------------------------------------------------------
-
-#
-# Table structure for table `results`
-#
-
-CREATE TABLE results (
- id int(11) NOT NULL auto_increment,
- endpoint int(11) NOT NULL default '0',
- stamp int(11) NOT NULL default '0',
- class varchar(10) NOT NULL default '',
- type varchar(10) default NULL,
- wsdl int(11) NOT NULL default '0',
- function varchar(255) NOT NULL default '',
- result varchar(25) NOT NULL default '',
- error text,
- wire text NOT NULL,
- PRIMARY KEY (id)
-) TYPE=MyISAM;
diff --git a/ext/soap/interop/echoheadersvc.wsdl.php b/ext/soap/interop/echoheadersvc.wsdl.php
deleted file mode 100644
index b310960657..0000000000
--- a/ext/soap/interop/echoheadersvc.wsdl.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-header("Content-Type: text/xml");
-echo '<?xml version="1.0"?>';
-echo "\n";
-?>
-<definitions name="InteropTest" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://soapinterop.org/" xmlns:s="http://soapinterop.org/xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
-
- <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/"/>
- <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/xsd"/>
- <import location="http://www.whitemesa.com/interop/InteropTestC.wsdl" namespace="http://soapinterop.org/"/>
-
- <service name="interopLabEchoHeader">
-
- <port name="interopPortEchoHdr" binding="tns:InteropEchoHeaderBinding">
- <soap:address location="<?php echo ((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']));?>/server_round2.php"/>
- </port>
-
- </service>
-
-</definitions>
diff --git a/ext/soap/interop/index.php b/ext/soap/interop/index.php
deleted file mode 100644
index 999cd47efa..0000000000
--- a/ext/soap/interop/index.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
- <title>PEAR SOAP Interop</title>
-</head>
-<?php
-// get our endpoint
-$server = $_SERVER['HTTP_HOST'].':'.$_SERVER['SERVER_PORT'];
-$base = (isset($_SERVER['HTTPS'])?"https://":"http://").$server.dirname($_SERVER['PHP_SELF'])."/interop.wsdl.php";
-$groupb = (isset($_SERVER['HTTPS'])?"https://":"http://").$server.dirname($_SERVER['PHP_SELF'])."/interopB.wsdl.php";
-$groupc = (isset($_SERVER['HTTPS'])?"https://":"http://").$server.dirname($_SERVER['PHP_SELF'])."/echoheadersvc.wsdl.php";
-?>
-<body>
-
-<h2 align='center'>PEAR SOAP Interop</h2>
-<p>Welcome to the PEAR SOAP Interop pages. These pages are set up for
-SOAP Builder interop tests. You can find out more about the interop tests
-at <a href="http://www.whitemesa.com/interop.htm">White Mesa</a>.</p>
-<p>Currently Round 2 base, Group B and Group C interop tests are enabled.</p>
-
-<h3>Round 2 Interop Server</h3>
-Base WSDL: <a href="<?php echo $base ?>"><?php echo $base ?></a><br>
-Group B WSDL: <a href="<?php echo $groupb ?>"><?php echo $groupb ?></a><br>
-Group C WSDL: <a href="<?php echo $groupc ?>"><?php echo $groupc ?></a><br>
-
-<h3>Interop Client</h3>
-
-<p>
-Notes:
-Tests are done both "Direct" and with "WSDL". WSDL tests use the supplied interop WSDL
-to run the tests against. The Direct method uses an internal prebuilt list of methods and parameters
-for the test.</p>
-<p>
-Tests are also run against two methods of generating method parameters. The first, 'php', attempts
-to directly serialize PHP variables into soap values. The second method, 'soapval', uses a SOAP_Value
-class to define what the type of the value is. The second method is more interopable than the first
-by nature.
-</p>
-
-<h3>Client Test Interface</h3>
-<p>The <a href="client_round2.php">client interface</a> allows you to run the PEAR SOAP
-Client against a choosen interop server. Each run updates the results database below.</p>
-
-<h3>Interop Client Test Results</h3>
-<p>This is a database of the current test results using PEAR SOAP Clients against interop servers.</p>
-<p>
-More detail (wire) about errors (marked yellow or red) can be obtained by clicking on the
-link in the result box. If we have an HTTP error
-attempting to connect to the endpoint, we will mark all consecutive attempts as errors, and skip
-testing that endpoint. This reduces the time it takes to run the tests if a server is unavailable.
-WSDLCACHE errors mean we cannot retreive the WSDL file specified for the endpoint.
-</p>
-
-<ul>
-<li><a href="client_round2_results.php?test=base&type=php&wsdl=0">Base results using PHP native types</a></li>
-<li><a href="client_round2_results.php?test=base&type=soapval&wsdl=0">Base results using SOAP types</a></li>
-<li><a href="client_round2_results.php?test=base&type=php&wsdl=1">Base results using PHP native types with WSDL</a></li>
-<li><a href="client_round2_results.php?test=GroupB&type=php&wsdl=0">Group B results using PHP native types</a></li>
-<li><a href="client_round2_results.php?test=GroupB&type=soapval&wsdl=0">Group B results using SOAP types</a></li>
-<li><a href="client_round2_results.php?test=GroupB&type=php&wsdl=1">Group B results using PHP native types with WSDL</a></li>
-<li><a href="client_round2_results.php?test=GroupC&type=php&wsdl=0">Group C results using PHP native types</a></li>
-<li><a href="client_round2_results.php?test=GroupC&type=soapval&wsdl=0">Group C results using SOAP types</a></li>
-<li><a href="client_round2_results.php?test=GroupC&type=php&wsdl=1">Group C results using PHP native types with WSDL</a></li>
-<li><a href="client_round2_results.php">Show All Results</a></li>
-</ul>
-</body>
-</html>
diff --git a/ext/soap/interop/interop.wsdl.php b/ext/soap/interop/interop.wsdl.php
deleted file mode 100644
index b257c56b66..0000000000
--- a/ext/soap/interop/interop.wsdl.php
+++ /dev/null
@@ -1,335 +0,0 @@
-<?php
-header("Content-Type: text/xml");
-echo '<?xml version="1.0"?>';
-echo "\n";
-?>
-<definitions name="InteropTest"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:tns="http://soapinterop.org/"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- targetNamespace="http://soapinterop.org/">
-
- <types>
- <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://soapinterop.org/">
- <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
- <xsd:complexType name="ArrayOfstring">
- <xsd:complexContent>
- <xsd:restriction base="SOAP-ENC:Array">
- <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="string[]"/>
- </xsd:restriction>
- </xsd:complexContent>
- </xsd:complexType>
- <xsd:complexType name="ArrayOfint">
- <xsd:complexContent>
- <xsd:restriction base="SOAP-ENC:Array">
- <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
- </xsd:restriction>
- </xsd:complexContent>
- </xsd:complexType>
- <xsd:complexType name="ArrayOffloat">
- <xsd:complexContent>
- <xsd:restriction base="SOAP-ENC:Array">
- <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="float[]"/>
- </xsd:restriction>
- </xsd:complexContent>
- </xsd:complexType>
- <xsd:complexType name="SOAPStruct">
- <xsd:all>
- <xsd:element name="varString" type="string"/>
- <xsd:element name="varInt" type="int"/>
- <xsd:element name="varFloat" type="float"/>
- </xsd:all>
- </xsd:complexType>
- <xsd:complexType name="ArrayOfSOAPStruct">
- <xsd:complexContent>
- <xsd:restriction base="SOAP-ENC:Array">
- <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:SOAPStruct[]"/>
- </xsd:restriction>
- </xsd:complexContent>
- </xsd:complexType>
- </schema>
- </types>
-
- <message name="echoStringRequest">
- <part name="inputString" type="xsd:string" />
- </message>
- <message name="echoStringResponse">
- <part name="outputString" type="xsd:string" />
- </message>
- <message name="echoStringArrayRequest">
- <part name="inputStringArray" type="tns:ArrayOfstring" />
- </message>
- <message name="echoStringArrayResponse">
- <part name="outputStringArray" type="tns:ArrayOfstring" />
- </message>
- <message name="echoIntegerRequest">
- <part name="inputInteger" type="xsd:int" />
- </message>
- <message name="echoIntegerResponse">
- <part name="outputInteger" type="xsd:int" />
- </message>
- <message name="echoIntegerArrayRequest">
- <part name="inputIntegerArray" type="tns:ArrayOfint" />
- </message>
- <message name="echoIntegerArrayResponse">
- <part name="outputIntegerArray" type="tns:ArrayOfint" />
- </message>
- <message name="echoFloatRequest">
- <part name="inputFloat" type="xsd:float" />
- </message>
- <message name="echoFloatResponse">
- <part name="outputFloat" type="xsd:float" />
- </message>
- <message name="echoFloatArrayRequest">
- <part name="inputFloatArray" type="tns:ArrayOffloat" />
- </message>
- <message name="echoFloatArrayResponse">
- <part name="outputFloatArray" type="tns:ArrayOffloat" />
- </message>
- <message name="echoStructRequest">
- <part name="inputStruct" type="tns:SOAPStruct" />
- </message>
- <message name="echoStructResponse">
- <part name="outputStruct" type="tns:SOAPStruct" />
- </message>
- <message name="echoStructArrayRequest">
- <part name="inputStructArray" type="tns:ArrayOfSOAPStruct" />
- </message>
- <message name="echoStructArrayResponse">
- <part name="outputStructArray" type="tns:ArrayOfSOAPStruct" />
- </message>
- <message name="echoVoidRequest">
- </message>
- <message name="echoVoidResponse">
- </message>
- <message name="echoBase64Request">
- <part name="inputBase64" type="xsd:base64Binary" />
- </message>
- <message name="echoBase64Response">
- <part name="outputBase64" type="xsd:base64Binary" />
- </message>
- <message name="echoDateRequest">
- <part name="inputDate" type="xsd:dateTime" />
- </message>
- <message name="echoDateResponse">
- <part name="outputDate" type="xsd:dateTime" />
- </message>
- <message name="echoHexBinaryRequest">
- <part name="inputHexBinary" type="xsd:hexBinary" />
- </message>
- <message name="echoHexBinaryResponse">
- <part name="outputHexBinary" type="xsd:hexBinary" />
- </message>
- <message name="echoDecimalRequest">
- <part name="inputDecimal" type="xsd:decimal" />
- </message>
- <message name="echoDecimalResponse">
- <part name="outputDecimal" type="xsd:decimal" />
- </message>
- <message name="echoBooleanRequest">
- <part name="inputBoolean" type="xsd:boolean" />
- </message>
- <message name="echoBooleanResponse">
- <part name="outputBoolean" type="xsd:boolean" />
- </message>
-
- <portType name="InteropTestPortType">
- <operation name="echoString">
- <input message="tns:echoStringRequest"/>
- <output message="tns:echoStringResponse"/>
- </operation>
- <operation name="echoStringArray">
- <input message="tns:echoStringArrayRequest"/>
- <output message="tns:echoStringArrayResponse"/>
- </operation>
- <operation name="echoInteger">
- <input message="tns:echoIntegerRequest"/>
- <output message="tns:echoIntegerResponse"/>
- </operation>
- <operation name="echoIntegerArray">
- <input message="tns:echoIntegerArrayRequest"/>
- <output message="tns:echoIntegerArrayResponse"/>
- </operation>
- <operation name="echoFloat">
- <input message="tns:echoFloatRequest"/>
- <output message="tns:echoFloatResponse"/>
- </operation>
- <operation name="echoFloatArray">
- <input message="tns:echoFloatArrayRequest"/>
- <output message="tns:echoFloatArrayResponse"/>
- </operation>
- <operation name="echoStruct">
- <input message="tns:echoStructRequest"/>
- <output message="tns:echoStructResponse"/>
- </operation>
- <operation name="echoStructArray">
- <input message="tns:echoStructArrayRequest"/>
- <output message="tns:echoStructArrayResponse"/>
- </operation>
- <operation name="echoVoid">
- <input message="tns:echoVoidRequest"/>
- <output message="tns:echoVoidResponse"/>
- </operation>
- <operation name="echoBase64">
- <input message="tns:echoBase64Request"/>
- <output message="tns:echoBase64Response"/>
- </operation>
- <operation name="echoDate">
- <input message="tns:echoDateRequest"/>
- <output message="tns:echoDateResponse"/>
- </operation>
- <operation name="echoHexBinary">
- <input message="tns:echoHexBinaryRequest"/>
- <output message="tns:echoHexBinaryResponse"/>
- </operation>
- <operation name="echoDecimal">
- <input message="tns:echoDecimalRequest"/>
- <output message="tns:echoDecimalResponse"/>
- </operation>
- <operation name="echoBoolean">
- <input message="tns:echoBooleanRequest"/>
- <output message="tns:echoBooleanResponse"/>
- </operation>
- </portType>
-
- <binding name="InteropTestBinding" type="tns:InteropTestPortType">
- <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
- <operation name="echoString">
- <soap:operation soapAction="http://" style="rpc"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoStringArray">
- <soap:operation soapAction="http://" style="rpc"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoInteger">
- <soap:operation soapAction="http://" style="rpc"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoIntegerArray">
- <soap:operation soapAction="http://" style="rpc"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoFloat">
- <soap:operation soapAction="http://" style="rpc"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoFloatArray">
- <soap:operation soapAction="http://" style="rpc"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoStruct">
- <soap:operation soapAction="http://" style="rpc"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoStructArray">
- <soap:operation soapAction="http://" style="rpc"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoVoid">
- <soap:operation soapAction="http://" style="rpc"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoBase64">
- <soap:operation soapAction="http://" style="rpc"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoDate">
- <soap:operation soapAction="http://" style="rpc"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoHexBinary">
- <soap:operation soapAction="http://" style="rpc"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoDecimal">
- <soap:operation soapAction="http://" style="rpc"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoBoolean">
- <soap:operation soapAction="http://" style="rpc"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- </binding>
-
- <service name="InteropTest">
- <port name="InteropTestPort" binding="tns:InteropTestBinding">
- <soap:address location="<?php echo ((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']));?>/server_round2_base.php"/>
- </port>
- </service>
-
-</definitions>
diff --git a/ext/soap/interop/interopB.wsdl.php b/ext/soap/interop/interopB.wsdl.php
deleted file mode 100644
index 3113b1c2fe..0000000000
--- a/ext/soap/interop/interopB.wsdl.php
+++ /dev/null
@@ -1,196 +0,0 @@
-<?php
-header("Content-Type: text/xml");
-echo '<?xml version="1.0"?>';
-echo "\n";
-?>
-<definitions name="InteropTest"
- targetNamespace="http://soapinterop.org/"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:tns="http://soapinterop.org/"
- xmlns:s="http://soapinterop.org/xsd"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
-
- <types>
- <schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://soapinterop.org/xsd">
-
- <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
-
- <complexType name="ArrayOfstring">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="string[]"/>
- </restriction>
- </complexContent>
- </complexType>
- <complexType name="ArrayOfint">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
- </restriction>
- </complexContent>
- </complexType>
- <complexType name="ArrayOffloat">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="float[]"/>
- </restriction>
- </complexContent>
- </complexType>
- <complexType name="ArrayOfSOAPStruct">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="s:SOAPStruct[]"/>
- </restriction>
- </complexContent>
- </complexType>
- <complexType name="SOAPStruct">
- <all>
- <element name="varString" type="string" nillable="true"/>
- <element name="varInt" type="int" nillable="true"/>
- <element name="varFloat" type="float" nillable="true"/>
- </all>
- </complexType>
- <complexType name="SOAPStructStruct">
- <all>
- <element name="varString" type="string" nillable="true"/>
- <element name="varInt" type="int" nillable="true"/>
- <element name="varFloat" type="float" nillable="true"/>
- <element name="varStruct" type="s:SOAPStruct"/>
- </all>
- </complexType>
- <complexType name="SOAPArrayStruct">
- <all>
- <element name="varString" type="string" nillable="true"/>
- <element name="varInt" type="int" nillable="true"/>
- <element name="varFloat" type="float" nillable="true"/>
- <element name="varArray" type="s:ArrayOfstring"/>
- </all>
- </complexType>
- <complexType name="ArrayOfString2D">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="string[,]"/>
- </restriction>
- </complexContent>
- </complexType>
- </schema>
- </types>
-
- <message name="echoStructAsSimpleTypesRequest">
- <part name="inputStruct" type="s:SOAPStruct"/>
- </message>
- <message name="echoStructAsSimpleTypesResponse">
- <part name="outputString" type="xsd:string"/>
- <part name="outputInteger" type="xsd:int"/>
- <part name="outputFloat" type="xsd:float"/>
- </message>
- <message name="echoSimpleTypesAsStructRequest">
- <part name="inputString" type="xsd:string"/>
- <part name="inputInteger" type="xsd:int"/>
- <part name="inputFloat" type="xsd:float"/>
- </message>
- <message name="echoSimpleTypesAsStructResponse">
- <part name="return" type="s:SOAPStruct"/>
- </message>
- <message name="echo2DStringArrayRequest">
- <part name="input2DStringArray" type="s:ArrayOfString2D"/>
- </message>
- <message name="echo2DStringArrayResponse">
- <part name="return" type="s:ArrayOfString2D"/>
- </message>
- <message name="echoNestedStructRequest">
- <part name="inputStruct" type="s:SOAPStructStruct"/>
- </message>
- <message name="echoNestedStructResponse">
- <part name="return" type="s:SOAPStructStruct"/>
- </message>
- <message name="echoNestedArrayRequest">
- <part name="inputStruct" type="s:SOAPArrayStruct"/>
- </message>
- <message name="echoNestedArrayResponse">
- <part name="return" type="s:SOAPArrayStruct"/>
- </message>
-
- <portType name="InteropTestPortTypeB">
- <operation name="echoStructAsSimpleTypes" parameterOrder="inputStruct outputString outputInteger outputFloat">
- <input message="tns:echoStructAsSimpleTypesRequest" name="echoStructAsSimpleTypes"/>
- <output message="tns:echoStructAsSimpleTypesResponse" name="echoStructAsSimpleTypesResponse"/>
- </operation>
- <operation name="echoSimpleTypesAsStruct" parameterOrder="inputString inputInteger inputFloat">
- <input message="tns:echoSimpleTypesAsStructRequest" name="echoSimpleTypesAsStruct"/>
- <output message="tns:echoSimpleTypesAsStructResponse" name="echoSimpleTypesAsStructResponse"/>
- </operation>
- <operation name="echo2DStringArray" parameterOrder="input2DStringArray">
- <input message="tns:echo2DStringArrayRequest" name="echo2DStringArray"/>
- <output message="tns:echo2DStringArrayResponse" name="echo2DStringArrayResponse"/>
- </operation>
- <operation name="echoNestedStruct" parameterOrder="inputStruct">
- <input message="tns:echoNestedStructRequest" name="echoNestedStruct"/>
- <output message="tns:echoNestedStructResponse" name="echoNestedStructResponse"/>
- </operation>
- <operation name="echoNestedArray" parameterOrder="inputStruct">
- <input message="tns:echoNestedArrayRequest" name="echoNestedArray"/>
- <output message="tns:echoNestedArrayResponse" name="echoNestedArrayResponse"/>
- </operation>
- </portType>
-
- <binding name="InteropTestSoapBindingB" type="tns:InteropTestPortTypeB">
- <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
- <operation name="echoStructAsSimpleTypes">
- <soap:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoSimpleTypesAsStruct">
- <soap:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echo2DStringArray">
- <soap:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoNestedStruct">
- <soap:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- <operation name="echoNestedArray">
- <soap:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- </binding>
-
- <service name="interopLabB">
- <port name="interopTestPortB" binding="tns:InteropTestSoapBindingB">
- <soap:address location="<?php echo ((isset($_SERVER['HTTPS'])?"https://":"http://").$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']));?>/server_round2_groupB.php"/>
- </port>
- </service>
-
-</definitions>
diff --git a/ext/soap/interop/server_round2_base.php b/ext/soap/interop/server_round2_base.php
deleted file mode 100644
index 0c6771d88e..0000000000
--- a/ext/soap/interop/server_round2_base.php
+++ /dev/null
@@ -1,145 +0,0 @@
-<?
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more |
-// | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-function generateFault($short, $long)
-{
- $params = array(
- "faultcode" => "Server",
- "faultstring" => $short,
- "detail" => $long
- );
-
- $faultmsg = new SOAP_Message("Fault",$params,"http://schemas.xmlsoap.org/soap/envelope/");
- return $faultmsg;
-}
-
-function hex2bin($data)
-{
- $len = strlen($data);
- return pack("H" . $len, $data);
-}
-
-
-class SOAP_Interop_Base {
- var $method_namespace = 'http://soapinterop.org/';
-
- function SOAP_Interop_Base() {
- #if ($server) {
- # $server->addToMap("echoString",array("string"),array("string"));
- # $server->addToMap("echoStringArray",array(),array());
- # $server->addToMap("echoInteger",array("int"),array("int"));
- # $server->addToMap("echoIntegerArray",array(),array());
- # $server->addToMap("echoFloat",array("float"),array("float"));
- # $server->addToMap("echoFloatArray",array(),array());
- # $server->addToMap("echoStruct",array(),array());
- # $server->addToMap("echoStructArray",array(),array());
- # $server->addToMap("echoVoid",array(),array());
- # $server->addToMap("echoBase64",array("base64Binary"),array("base64Binary"));
- # $server->addToMap("echoDate",array("dateTime"),array("dateTime"));
- # $server->addToMap("echoHexBinary",array("hexBinary"),array("hexBinary"));
- # $server->addToMap("echoDecimal",array("decimal"),array("decimal"));
- # $server->addToMap("echoBoolean",array("boolean"),array("boolean"));
- #}
- }
-
- function echoString($inputString)
- {
- return $inputString;
- }
-
- function echoStringArray($inputStringArray)
- {
- return $inputStringArray;
- }
-
-
- function echoInteger($inputInteger)
- {
- return $inputInteger;
- }
-
- function echoIntegerArray($inputIntegerArray)
- {
- return $inputIntegerArray;
- }
-
- function echoFloat($inputFloat)
- {
- return $inputFloat;
- }
-
- function echoFloatArray($inputFloatArray)
- {
- return $inputFloatArray;
- }
-
- function echoStruct($inputStruct)
- {
- return $inputStruct;
- }
-
- function echoStructArray($inputStructArray)
- {
- return $inputStructArray;
- }
-
- function echoVoid()
- {
- return NULL;
- }
-
- function echoBase64($b_encoded)
- {
- return $b_encoded;
- }
-
- function echoDate($timeInstant)
- {
- return $timeInstant;
- }
-
- function echoHexBinary($hb)
- {
- return $hb;
- }
-
- function echoDecimal($dec)
- {
- return $dec;
- }
-
- function echoBoolean($boolean)
- {
- return $boolean;
- }
-
- function echoMimeAttachment($stuff)
- {
- return new SOAP_Attachment('return','application/octet-stream',NULL,$stuff);
- }
-}
-
-$server = new SoapServer("http://test-uri");
-$server->bind((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
deleted file mode 100644
index eaae5ba89b..0000000000
--- a/ext/soap/interop/server_round2_groupB.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more |
-// | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-class SOAP_Interop_GroupB {
- var $method_namespace = 'http://soapinterop.org/';
- var $dispatch_map = array();
-
- function SOAP_Interop_GroupB() {
- $this->dispatch_map['echoStructAsSimpleTypes'] =
- array('in' => array('inputStruct' => 'SOAPStruct'),
- 'out' => array('outputString' => 'string', 'outputInteger' => 'int', 'outputFloat' => 'float')
- );
-
- }
-
- function echoStructAsSimpleTypes ($struct)
- {
- return array('outputString' => $struct->varString,
- 'outputInteger' => $struct->varInt,
- 'outputFloat' => $struct->varFloat);
- }
-
- function echoSimpleTypesAsStruct($string, $int, $float)
- {
- return (object)array("varString" => $string,
- "varInt" => $int,
- "varFloat" => $float);
- }
-
- function echoNestedStruct($struct)
- {
- return $struct;
- }
-
- function echo2DStringArray($ary)
- {
-// $ret->options['flatten'] = TRUE;
- return $ary;
- }
-
- function echoNestedArray($ary)
- {
- return $ary;
- }
-}
-
-$server = new SoapServer("http://test-uri");
-$server->bind((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
deleted file mode 100644
index 0c5492cda8..0000000000
--- a/ext/soap/interop/server_round2_groupC.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-class SOAP_Interop_GroupC {
- var $method_namespace = 'http://soapinterop.org/echoheader/';
-
- function echoMeStringRequest($string)
- {
- return new SOAP_Value('{'.$this->method_namespace.'}echoMeStringResponse','string',$string);
- }
-
- function echoMeStructRequest($struct)
- {
- return new SOAP_Value('{'.$this->method_namespace.'}echoMeStructResponse','SOAPStruct',$struct);
- }
-}
-
-$server = new SoapServer("http://test-uri");
-$server->setClass("SOAP_Interop_GroupC");
-$server->handle();
-?> \ No newline at end of file
diff --git a/ext/soap/interop/test.utility.php b/ext/soap/interop/test.utility.php
deleted file mode 100644
index 5b1f699c9b..0000000000
--- a/ext/soap/interop/test.utility.php
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-
-function timestamp_to_soap_datetime($t) {
- return date('Y-m-d\TH:i:sO',$t);
-}
-
-function soap_datetime_to_timestamp($t) {
- /* Ignore Microsecconds */
- $iso8601 = '(-?[0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(\.[0-9]*)?(Z|[+\-][0-9]{4}|[+\-][0-9]{2}:[0-9]{2})?';
- if (!is_int($t)) {
- if (!ereg($iso8601,$t,$r)) {
- return false;
- }
- $t = gmmktime($r[4],$r[5],$r[6],$r[2],$r[3],$r[1]);
- if (!empty($r[8]) && $r[8] != 'Z') {
- $op = substr($r[8],0,1);
- $h = substr($r[8],1,2);
- if (strstr($r[8],':')) {
- $m = substr($r[8],4,2);
- } else {
- $m = substr($r[8],3,2);
- }
- $t += (($op == "-"?1:-1) * $h * 60 + $m) * 60;
- }
- }
- return $t;
-}
-
-function date_compare($f1,$f2)
-{
- return soap_datetime_to_timestamp($f1) == soap_datetime_to_timestamp($f2);
-}
-
-function hex_compare($f1, $f2)
-{
- return strcasecmp($f1,$f2) == 0;
-}
-
-function number_compare($f1, $f2)
-{
- # figure out which has the least fractional digits
- preg_match('/.*?\.(.*)/',$f1,$m1);
- preg_match('/.*?\.(.*)/',$f2,$m2);
- #print_r($m1);
- # always use at least 2 digits of precision
- $d = max(min(strlen(count($m1)?$m1[1]:'0'),strlen(count($m2)?$m2[1]:'0')),2);
- $f1 = round($f1, $d);
- $f2 = round($f2, $d);
- return $f1 == $f2;
-// return bccomp($f1, $f2, $d) == 0;
-}
-
-function boolean_compare($f1, $f2)
-{
- if (($f1 == 'true' || $f1 === TRUE || $f1 != 0) &&
- ($f2 == 'true' || $f2 === TRUE || $f2 != 0)) return TRUE;
- if (($f1 == 'false' || $f1 === FALSE || $f1 == 0) &&
- ($f2 == 'false' || $f2 === FALSE || $f2 == 0)) return TRUE;
- return FALSE;
-}
-
-function string_compare($e1, $e2)
-{
- if (is_numeric($e1) && is_numeric($e2)) {
- return number_compare($e1, $e2);
- }
- # handle dateTime comparison
- $e1_type = gettype($e1);
- $e2_type = gettype($e2);
- $ok = FALSE;
- if ($e1_type == "string") {
-// $dt = new SOAP_Type_dateTime();
-// $ok = $dt->compare($e1, $e2) == 0;
- $oj = false;
- }
- return $ok || $e1 == $e2 || strcasecmp(trim($e1), trim($e2)) == 0;
-}
-
-function array_compare(&$ar1, &$ar2) {
- if (gettype($ar1) != 'array' || gettype($ar2) != 'array') return FALSE;
- if (count($ar1) != count($ar2)) return FALSE;
- foreach ($ar1 as $k => $v) {
- if (!array_key_exists($k,$ar2)) return FALSE;
- if (!compare($v,$ar2[$k])) return FALSE;
- }
- return TRUE;
-}
-
-function object_compare(&$obj1, &$obj2) {
- if (gettype($obj1) != 'object' || gettype($obj2) != 'object') return FALSE;
-// if (class_name(obj1) != class_name(obj2)) return FALSE;
- $ar1 = (array)$obj1;
- $ar2 = (array)$obj2;
- return array_compare($ar1,$ar2);
-}
-
-function compare(&$x,&$y) {
- $ok = 0;
- $x_type = gettype($x);
- $y_type = gettype($y);
- if ($x_type == $y_type) {
- if ($x_type == "array") {
- $ok = array_compare($x, $y);
- } else if ($x_type == "object") {
- $ok = object_compare($x, $y);
- } else if ($x_type == "double") {
- $ok = number_compare($x, $y);
-// } else if ($x_type == 'boolean') {
-// $ok = boolean_compare($x, $y);
- } else {
- $ok = ($x == $y);
-// $ok = string_compare($expect, $result);
- }
- }
- return $ok;
-}
-
-
-function parseMessage($msg)
-{
- # strip line endings
- #$msg = preg_replace('/\r|\n/', ' ', $msg);
- $response = new SOAP_Parser($msg);
- if ($response->fault) {
- return $response->fault->getFault();
- }
- $return = $response->getResponse();
- $v = $response->decode($return);
- if (gettype($v) == 'array' && count($v)==1) {
- return array_shift($v);
- }
- return $v;
-}
-
-function var_dump_str($var) {
- ob_start();
- var_dump($var);
- $res = ob_get_contents();
- ob_end_clean();
- return $res;
-}
-
-?> \ No newline at end of file
diff --git a/ext/soap/package.xml b/ext/soap/package.xml
deleted file mode 100644
index 5d872e6cb4..0000000000
--- a/ext/soap/package.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!-- do not use the "Type" attribute here, that one is only for
- generated package.xml files -->
-<package>
- <name>ext_soap</name>
- <summary>Provides SOAP Services</summary>
- <description>
- Description of package....
- </description>
- <status>beta</status>
- <maintainers>
- <maintainer>
- <user>rodif_bl</user>
- <name>Brad Lafountain</name>
- <email>rodif_bl@yahoo.com</email>
- <role>lead</role>
- </maintainer>
- <maintainer>
- <user>shane</user>
- <name>Shane Caraveo</name>
- <email>shane@caraveo.com</email>
- <role>lead</role>
- </maintainer>
- <maintainer>
- <user>dmitry</user>
- <name>Dmitry Stogov</name>
- <email>dmitry@zend.com</email>
- <role>lead</role>
- </maintainer>
- </maintainers>
- <license>PHP</license>
- <release>
- <version>0.1</version>
- <date>2002-07-07</date>
- <state>alpha</state>
- <notes>
- - First offical PEAR/PECL release
- </notes>
- </release>
- <filelist>
- <dir name="/">
- <file role="doc">EXPERIMENTAL</file>
- <file role="doc">TODO</file>
- <file role="src">config.m4</file>
- <file role="src">Makefile.in</file>
- <file role="src">php_encoding.c</file>
- <file role="src">php_encoding.h</file>
- <file role="src">php_http.c</file>
- <file role="src">php_http.h</file>
- <file role="src">php_packet_soap.c</file>
- <file role="src">php_packet_soap.h</file>
- <file role="src">php_schema.c</file>
- <file role="src">php_schema.h</file>
- <file role="src">php_sdl.c</file>
- <file role="src">php_sdl.h</file>
- <file role="src">php_soap.h</file>
- <file role="src">php_soap.h</file>
- <file role="src">php_xml.c</file>
- <file role="src">php_xml.h</file>
- <file role="src">soap.c</file>
- <file role="src">php_soap.dsp</file>
- </dir>
- </filelist>
-</package>
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
deleted file mode 100644
index 324594f786..0000000000
--- a/ext/soap/php_encoding.c
+++ /dev/null
@@ -1,2268 +0,0 @@
-#include <time.h>
-
-#include "php_soap.h"
-
-/* zval type decode */
-static zval *to_zval_double(encodeTypePtr type, xmlNodePtr data);
-static zval *to_zval_long(encodeTypePtr type, xmlNodePtr data);
-static zval *to_zval_ulong(encodeTypePtr type, xmlNodePtr data);
-static zval *to_zval_bool(encodeTypePtr type, xmlNodePtr data);
-static zval *to_zval_string(encodeTypePtr type, xmlNodePtr data);
-static zval *to_zval_stringr(encodeTypePtr type, xmlNodePtr data);
-static zval *to_zval_stringc(encodeTypePtr type, xmlNodePtr data);
-static zval *to_zval_map(encodeTypePtr type, xmlNodePtr data);
-static zval *to_zval_null(encodeTypePtr type, xmlNodePtr data);
-
-static xmlNodePtr to_xml_long(encodeTypePtr type, zval *data, int style);
-static xmlNodePtr to_xml_ulong(encodeTypePtr type, zval *data, int style);
-static xmlNodePtr to_xml_double(encodeTypePtr type, zval *data, int style);
-static xmlNodePtr to_xml_bool(encodeTypePtr type, zval *data, int style);
-
-/* String encode */
-static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style);
-static xmlNodePtr to_xml_stringl(encodeTypePtr type, zval *data, int style);
-
-/* Null encode */
-static xmlNodePtr to_xml_null(encodeTypePtr type, zval *data, int style);
-
-/* Array encode */
-static xmlNodePtr guess_array_map(encodeTypePtr type, zval *data, int style);
-static xmlNodePtr to_xml_map(encodeTypePtr type, zval *data, int style);
-
-/* Datetime encode/decode */
-static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *format, int style);
-static xmlNodePtr to_xml_datetime(encodeTypePtr type, zval *data, int style);
-static xmlNodePtr to_xml_time(encodeTypePtr type, zval *data, int style);
-static xmlNodePtr to_xml_date(encodeTypePtr type, zval *data, int style);
-static xmlNodePtr to_xml_gyearmonth(encodeTypePtr type, zval *data, int style);
-static xmlNodePtr to_xml_gyear(encodeTypePtr type, zval *data, int style);
-static xmlNodePtr to_xml_gmonthday(encodeTypePtr type, zval *data, int style);
-static xmlNodePtr to_xml_gday(encodeTypePtr type, zval *data, int style);
-static xmlNodePtr to_xml_gmonth(encodeTypePtr type, zval *data, int style);
-static xmlNodePtr to_xml_duration(encodeTypePtr type, zval *data, int style);
-
-static int is_map(zval *array);
-static void get_array_type(xmlNodePtr node, zval *array, smart_str *out_type TSRMLS_DC);
-
-static void get_type_str(xmlNodePtr node, const char* ns, const char* type, smart_str* ret);
-static void set_ns_and_type_ex(xmlNodePtr node, char *ns, char *type);
-
-encode defaultEncoding[] = {
- {{UNKNOWN_TYPE, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert},
-
- {{IS_NULL, "nil", XSI_NAMESPACE, NULL}, to_zval_null, to_xml_null},
- {{IS_STRING, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
- {{IS_LONG, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{IS_DOUBLE, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double},
- {{IS_BOOL, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
- {{IS_CONSTANT, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
- {{IS_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_1_1_ENC_NAMESPACE, NULL}, to_zval_array, guess_array_map},
- {{IS_CONSTANT_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_1_1_ENC_NAMESPACE, NULL}, to_zval_array, to_xml_array},
- {{IS_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_1_1_ENC_NAMESPACE, NULL}, to_zval_object, to_xml_object},
- {{IS_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_1_2_ENC_NAMESPACE, NULL}, to_zval_array, guess_array_map},
- {{IS_CONSTANT_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_1_2_ENC_NAMESPACE, NULL}, to_zval_array, to_xml_array},
- {{IS_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_1_2_ENC_NAMESPACE, NULL}, to_zval_object, to_xml_object},
-
- {{XSD_STRING, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
- {{XSD_BOOLEAN, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
- {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_FLOAT, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double},
- {{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double},
-
- {{XSD_DATETIME, XSD_DATETIME_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_datetime},
- {{XSD_TIME, XSD_TIME_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_time},
- {{XSD_DATE, XSD_DATE_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_date},
- {{XSD_GYEARMONTH, XSD_GYEARMONTH_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_gyearmonth},
- {{XSD_GYEAR, XSD_GYEAR_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_gyear},
- {{XSD_GMONTHDAY, XSD_GMONTHDAY_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_gmonthday},
- {{XSD_GDAY, XSD_GDAY_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_gday},
- {{XSD_GMONTH, XSD_GMONTH_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_gmonth},
- {{XSD_DURATION, XSD_DURATION_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_duration},
-
- {{XSD_HEXBINARY, XSD_HEXBINARY_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_stringl},
- {{XSD_BASE64BINARY, XSD_BASE64BINARY_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_stringl},
-
- {{XSD_LONG, XSD_LONG_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_INT, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_SHORT, XSD_SHORT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_BYTE, XSD_BYTE_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_NONPOSITIVEINTEGER, XSD_NONPOSITIVEINTEGER_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_POSITIVEINTEGER, XSD_POSITIVEINTEGER_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_NONNEGATIVEINTEGER, XSD_NONNEGATIVEINTEGER_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_NEGATIVEINTEGER, XSD_NEGATIVEINTEGER_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_UNSIGNEDBYTE, XSD_UNSIGNEDBYTE_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_UNSIGNEDSHORT, XSD_UNSIGNEDSHORT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_UNSIGNEDINT, XSD_UNSIGNEDINT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_UNSIGNEDLONG, XSD_UNSIGNEDLONG_STRING, XSD_NAMESPACE, NULL}, to_zval_ulong, to_xml_ulong},
-
- {{XSD_ANYTYPE, XSD_ANYTYPE_STRING, XSD_NAMESPACE, NULL}, guess_zval_convert, guess_xml_convert},
- {{XSD_UR_TYPE, XSD_UR_TYPE_STRING, XSD_NAMESPACE, NULL}, guess_zval_convert, guess_xml_convert},
- {{XSD_ANYURI, XSD_ANYURI_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_QNAME, XSD_QNAME_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_NOTATION, XSD_NOTATION_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_NORMALIZEDSTRING, XSD_NORMALIZEDSTRING_STRING, XSD_NAMESPACE, NULL}, to_zval_stringr, to_xml_string},
- {{XSD_TOKEN, XSD_TOKEN_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_LANGUAGE, XSD_LANGUAGE_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_NMTOKEN, XSD_NMTOKEN_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_NMTOKENS, XSD_NMTOKENS_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_NAME, XSD_NAME_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_NCNAME, XSD_NCNAME_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_ID, XSD_ID_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_IDREF, XSD_IDREF_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_IDREFS, XSD_IDREFS_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_ENTITY, XSD_ENTITY_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_ENTITIES, XSD_ENTITIES_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
-
- {{APACHE_MAP, APACHE_MAP_STRING, APACHE_NAMESPACE, NULL}, to_zval_map, to_xml_map},
-
- {{SOAP_ENC_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_1_1_ENC_NAMESPACE, NULL}, to_zval_object, to_xml_object},
- {{SOAP_ENC_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_1_1_ENC_NAMESPACE, NULL}, to_zval_array, to_xml_array},
- {{SOAP_ENC_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_1_2_ENC_NAMESPACE, NULL}, to_zval_object, to_xml_object},
- {{SOAP_ENC_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_1_2_ENC_NAMESPACE, NULL}, to_zval_array, to_xml_array},
-
- /* support some of the 1999 data types */
- {{XSD_STRING, XSD_STRING_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_string, to_xml_string},
- {{XSD_BOOLEAN, XSD_BOOLEAN_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
- {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
- {{XSD_FLOAT, XSD_FLOAT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_double},
- {{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_double},
-
- {{XSD_LONG, XSD_LONG_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_INT, XSD_INT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_SHORT, XSD_SHORT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_BYTE, XSD_BYTE_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_1999_TIMEINSTANT, XSD_1999_TIMEINSTANT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
-
- {{END_KNOWN_TYPES, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert}
-};
-
-void whiteSpace_replace(char* str)
-{
- while (*str != '\0') {
- if (*str == '\x9' || *str == '\xA' || *str == '\xD') {
- *str = ' ';
- }
- str++;
- }
-}
-
-void whiteSpace_collapse(char* str)
-{
- char *orig = str;
- char *tmp = do_alloca(strlen(str)+1);
- char *pos;
- char old;
-
- whiteSpace_replace(str);
- while (*str == ' ') {
- str++;
- }
- pos = tmp; old = '\0';
- while (*str != '\0') {
- if (*str != ' ' || old != ' ') {
- *pos = *str;
- pos++;
- }
- old = *str;
- str++;
- }
- if (old == ' ') {
- --pos;
- }
- *pos = '\0';
- memcpy(orig,tmp,(pos-tmp)+1);
- free_alloca(tmp);
-}
-
-xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style)
-{
- xmlNodePtr node = NULL;
- TSRMLS_FETCH();
-
- if (encode == NULL) {
- encode = get_conversion(UNKNOWN_TYPE);
- }
- if (encode->to_xml_before) {
- data = encode->to_xml_before(&encode->details, data);
- }
- if (encode->to_xml) {
- node = encode->to_xml(&encode->details, data, style);
- }
- if (encode->to_xml_after) {
- node = encode->to_xml_after(&encode->details, node, style);
- }
- return node;
-}
-
-zval *master_to_zval(encodePtr encode, xmlNodePtr data)
-{
- zval *ret = NULL;
- TSRMLS_FETCH();
-
- if (encode == NULL) {
- encode = get_conversion(UNKNOWN_TYPE);
- }
- data = check_and_resolve_href(data);
- if (encode->to_zval_before) {
- data = encode->to_zval_before(&encode->details, data, 0);
- }
- if (encode->to_zval) {
- ret = encode->to_zval(&encode->details, data);
- }
- if (encode->to_zval_after) {
- ret = encode->to_zval_after(&encode->details, ret);
- }
- return ret;
-}
-
-#ifdef HAVE_PHP_DOMXML
-zval *to_xml_before_user(encodeTypePtr type, zval *data)
-{
- TSRMLS_FETCH();
-
- if (type.map->map_functions.to_xml_before) {
- if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml_before, data, 1, &data TSRMLS_CC) == FAILURE) {
- php_error(E_ERROR, "Error calling to_xml_before");
- }
- }
- return data;
-}
-
-xmlNodePtr to_xml_user(encodeTypePtr type, zval *data, int style)
-{
- zval *ret, **addr;
- xmlNodePtr node;
- TSRMLS_FETCH();
-
- if (type.map->map_functions.to_xml) {
- MAKE_STD_ZVAL(ret);
- if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml, ret, 1, &data TSRMLS_CC) == FAILURE) {
- php_error(E_ERROR, "Error calling to_xml");
- }
-
- if (Z_TYPE_P(ret) != IS_OBJECT) {
- php_error(E_ERROR, "Error serializing object from to_xml_user");
- }
-
- if (zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS) {
- node = (xmlNodePtr)Z_LVAL_PP(addr);
- node = xmlCopyNode(node, 1);
- set_ns_and_type(node, type);
- }
- zval_ptr_dtor(&ret);
- }
- return node;
-}
-
-xmlNodePtr to_xml_after_user(encodeTypePtr type, xmlNodePtr node, int style)
-{
- zval *ret, *param, **addr;
- int found;
- TSRMLS_FETCH();
-
- if (type.map->map_functions.to_xml_after) {
- MAKE_STD_ZVAL(ret);
- MAKE_STD_ZVAL(param);
- param = php_domobject_new(node, &found, NULL TSRMLS_CC);
-
- if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml_after, ret, 1, &param TSRMLS_CC) == FAILURE) {
- php_error(E_ERROR, "Error calling to_xml_after");
- }
- if (zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS) {
- node = (xmlNodePtr)Z_LVAL_PP(addr);
- set_ns_and_type(node, type);
- }
- zval_ptr_dtor(&ret);
- zval_ptr_dtor(&param);
- }
- return node;
-}
-
-xmlNodePtr to_zval_before_user(encodeTypePtr type, xmlNodePtr node, int style)
-{
- zval *ret, *param, **addr;
- int found;
- TSRMLS_FETCH();
-
- if (type.map->map_functions.to_zval_before) {
- MAKE_STD_ZVAL(ret);
- MAKE_STD_ZVAL(param);
- param = php_domobject_new(node, &found, NULL TSRMLS_CC);
-
- if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval_before, ret, 1, &param TSRMLS_CC) == FAILURE) {
- php_error(E_ERROR, "Error calling to_zval_before");
- }
- if (zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS) {
- node = (xmlNodePtr)Z_LVAL_PP(addr);
- set_ns_and_type(node, type);
- }
- zval_ptr_dtor(&ret);
- zval_ptr_dtor(&param);
- }
- return node;
-}
-
-zval *to_zval_user(encodeTypePtr type, xmlNodePtr node)
-{
- zval *ret, *param;
- int found;
- TSRMLS_FETCH();
-
- if (type.map->map_functions.to_zval) {
- MAKE_STD_ZVAL(ret);
- MAKE_STD_ZVAL(param);
- param = php_domobject_new(node, &found, NULL TSRMLS_CC);
-
- if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval, ret, 1, &param TSRMLS_CC) == FAILURE) {
- php_error(E_ERROR, "Error calling to_zval");
- }
- zval_ptr_dtor(&param);
- efree(param);
- }
- return ret;
-}
-
-zval *to_zval_after_user(encodeTypePtr type, zval *data)
-{
- TSRMLS_FETCH();
-
- if (type.map->map_functions.to_zval_after) {
- if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval_after, data, 1, &data TSRMLS_CC) == FAILURE) {
- php_error(E_ERROR, "Error calling to_xml_before");
- }
- }
- return data;
-}
-#endif
-
-/* TODO: get rid of "bogus".. ither by passing in the already created xmlnode or passing in the node name */
-/* String encode/decode */
-static zval *to_zval_string(encodeTypePtr type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
- if (data && data->children) {
- if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
- ZVAL_STRING(ret, data->children->content, 1);
- } else {
- php_error(E_ERROR,"Violation of encoding rules");
- }
- } else {
- ZVAL_EMPTY_STRING(ret);
- }
- return ret;
-}
-
-static zval *to_zval_stringr(encodeTypePtr type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
- if (data && data->children) {
- if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
- whiteSpace_replace(data->children->content);
- ZVAL_STRING(ret, data->children->content, 1);
- } else {
- php_error(E_ERROR,"Violation of encoding rules");
- }
- } else {
- ZVAL_EMPTY_STRING(ret);
- }
- return ret;
-}
-
-static zval *to_zval_stringc(encodeTypePtr type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
- if (data && data->children) {
- if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
- whiteSpace_collapse(data->children->content);
- ZVAL_STRING(ret, data->children->content, 1);
- } else {
- php_error(E_ERROR,"Violation of encoding rules");
- }
- } else {
- ZVAL_EMPTY_STRING(ret);
- }
- return ret;
-}
-
-static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style)
-{
- xmlNodePtr ret;
- char *str, *pstr;
- int new_len;
- TSRMLS_FETCH();
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret, style);
-
- if (Z_TYPE_P(data) == IS_STRING) {
- str = php_escape_html_entities(Z_STRVAL_P(data), Z_STRLEN_P(data), &new_len, 0, 0, NULL TSRMLS_CC);
- } else {
- zval tmp = *data;
-
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- str = php_escape_html_entities(Z_STRVAL(tmp), Z_STRLEN(tmp), &new_len, 0, 0, NULL TSRMLS_CC);
- zval_dtor(&tmp);
- }
-
- pstr = malloc(new_len + 1);
- memcpy(pstr, str, new_len);
- pstr[new_len] = '\0';
- efree(str);
-
- xmlNodeSetContentLen(ret, pstr, new_len);
-
- if (style == SOAP_ENCODED) {
- set_ns_and_type(ret, type);
- }
- return ret;
-}
-
-static xmlNodePtr to_xml_stringl(encodeTypePtr type, zval *data, int style)
-{
- xmlNodePtr ret;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret, style);
-
- if (Z_TYPE_P(data) == IS_STRING) {
- xmlNodeSetContentLen(ret, Z_STRVAL_P(data), Z_STRLEN_P(data));
- } else {
- zval tmp = *data;
-
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- xmlNodeSetContentLen(ret, Z_STRVAL(tmp), Z_STRLEN(tmp));
- zval_dtor(&tmp);
- }
-
- if (style == SOAP_ENCODED) {
- set_ns_and_type(ret, type);
- }
- return ret;
-}
-
-static zval *to_zval_double(encodeTypePtr type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- if (data && data->children) {
- if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
- whiteSpace_collapse(data->children->content);
- ZVAL_DOUBLE(ret, atof(data->children->content));
- } else {
- php_error(E_ERROR,"Violation of encoding rules");
- }
- } else {
- ZVAL_NULL(ret);
- }
- return ret;
-}
-
-static zval *to_zval_long(encodeTypePtr type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- if (data && data->children) {
- if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
- whiteSpace_collapse(data->children->content);
- ZVAL_LONG(ret, atol(data->children->content));
- } else {
- php_error(E_ERROR,"Violation of encoding rules");
- }
- } else {
- ZVAL_NULL(ret);
- }
- return ret;
-}
-
-static zval *to_zval_ulong(encodeTypePtr type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- if (data && data->children) {
- if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
- unsigned long val = 0;
- char *s;
- whiteSpace_collapse(data->children->content);
- s = data->children->content;
- while (*s >= '0' && *s <= '9') {
- val = (val*10)+(*s-'0');
- s++;
- }
- if ((long)val >= 0) {
- ZVAL_LONG(ret, val);
- } else {
- ZVAL_STRING(ret, data->children->content, 1);
- }
- } else {
- php_error(E_ERROR,"Violation of encoding rules");
- }
- } else {
- ZVAL_NULL(ret);
- }
- return ret;
-}
-
-static xmlNodePtr to_xml_long(encodeTypePtr type, zval *data, int style)
-{
- xmlNodePtr ret;
- zval tmp;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret, style);
-
- tmp = *data;
- zval_copy_ctor(&tmp);
- if (Z_TYPE(tmp) != IS_LONG) {
- convert_to_long(&tmp);
- }
- convert_to_string(&tmp);
- xmlNodeSetContentLen(ret, Z_STRVAL(tmp), Z_STRLEN(tmp));
- zval_dtor(&tmp);
-
- if (style == SOAP_ENCODED) {
- set_ns_and_type(ret, type);
- }
- return ret;
-}
-
-static xmlNodePtr to_xml_ulong(encodeTypePtr type, zval *data, int style)
-{
- xmlNodePtr ret;
- zval tmp;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret, style);
-
- /* TODO: long overflow */
- tmp = *data;
- zval_copy_ctor(&tmp);
- if (Z_TYPE(tmp) != IS_LONG) {
- convert_to_long(&tmp);
- }
- convert_to_string(&tmp);
- xmlNodeSetContentLen(ret, Z_STRVAL(tmp), Z_STRLEN(tmp));
- zval_dtor(&tmp);
-
- if (style == SOAP_ENCODED) {
- set_ns_and_type(ret, type);
- }
- return ret;
-}
-
-static xmlNodePtr to_xml_double(encodeTypePtr type, zval *data, int style)
-{
- xmlNodePtr ret;
- zval tmp;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret, style);
-
- tmp = *data;
- zval_copy_ctor(&tmp);
- if (Z_TYPE(tmp) != IS_DOUBLE) {
- convert_to_double(&tmp);
- }
- convert_to_string(&tmp);
- xmlNodeSetContentLen(ret, Z_STRVAL(tmp), Z_STRLEN(tmp));
- zval_dtor(&tmp);
-
- if (style == SOAP_ENCODED) {
- set_ns_and_type(ret, type);
- }
- return ret;
-}
-
-static zval *to_zval_bool(encodeTypePtr type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- if (data && data->children) {
- if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
- whiteSpace_collapse(data->children->content);
- if (stricmp(data->children->content,"true") == 0 ||
- stricmp(data->children->content,"t") == 0 ||
- strcmp(data->children->content,"1") == 0) {
- ZVAL_BOOL(ret, 1);
- } else {
- ZVAL_BOOL(ret, 0);
- }
- } else {
- php_error(E_ERROR,"Violation of encoding rules");
- }
- } else {
- ZVAL_NULL(ret);
- }
- return ret;
-}
-
-static xmlNodePtr to_xml_bool(encodeTypePtr type, zval *data, int style)
-{
- xmlNodePtr ret;
- zval tmp;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret, style);
-
- if (Z_TYPE_P(data) != IS_BOOL) {
- tmp = *data;
- zval_copy_ctor(&tmp);
- convert_to_boolean(data);
- data = &tmp;
- }
-
- if (data->value.lval == 1) {
- xmlNodeSetContent(ret, "1");
- } else {
- xmlNodeSetContent(ret, "0");
- }
-
- if (data == &tmp) {
- zval_dtor(&tmp);
- }
-
- if (style == SOAP_ENCODED) {
- set_ns_and_type(ret, type);
- }
- return ret;
-}
-
-/* Null encode/decode */
-static zval *to_zval_null(encodeTypePtr type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- ZVAL_NULL(ret);
- return ret;
-}
-
-static xmlNodePtr to_xml_null(encodeTypePtr type, zval *data, int style)
-{
- xmlNodePtr ret;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret, style);
-
- if (style == SOAP_ENCODED) {
- xmlSetProp(ret, "xsi:nil", "1");
- }
- return ret;
-}
-
-static void model_to_zval_object(zval *ret, sdlContentModelPtr model, xmlNodePtr data, sdlPtr sdl TSRMLS_DC)
-{
- switch (model->kind) {
- case XSD_CONTENT_ELEMENT:
- if (model->u.element->name) {
- xmlNodePtr node = get_node(data->children, model->u.element->name);
- if (node) {
- xmlAttrPtr typeAttr = get_attribute(node->properties,"type");
- encodePtr enc = NULL;
- zval *val;
-
- if (typeAttr != NULL && typeAttr->children && typeAttr->children->content) {
- enc = get_encoder_from_prefix(sdl, node, typeAttr->children->content);
- }
- if (enc == NULL) {
- enc = model->u.element->encode;
- }
- val = master_to_zval(enc, node);
- if ((node = get_node(node->next, model->u.element->name)) != NULL) {
- zval *array;
- MAKE_STD_ZVAL(array);
- array_init(array);
- add_next_index_zval(array, val);
- do {
- typeAttr = get_attribute(node->properties,"type");
- enc = NULL;
- if (typeAttr != NULL && typeAttr->children && typeAttr->children->content) {
- enc = get_encoder_from_prefix(sdl, node, typeAttr->children->content);
- }
- if (enc == NULL) {
- enc = model->u.element->encode;
- }
- val = master_to_zval(enc, node);
- add_next_index_zval(array, val);
- } while ((node = get_node(node->next, model->u.element->name)) != NULL);
- val = array;
- }
-#ifdef ZEND_ENGINE_2
- val->refcount--;
-#endif
- add_property_zval(ret, model->u.element->name, val);
- }
- }
- break;
- case XSD_CONTENT_SEQUENCE:
- case XSD_CONTENT_ALL:
- case XSD_CONTENT_CHOICE: {
- sdlContentModelPtr *tmp;
-
- zend_hash_internal_pointer_reset(model->u.content);
- while (zend_hash_get_current_data(model->u.content, (void**)&tmp) == SUCCESS) {
- model_to_zval_object(ret, *tmp, data, sdl TSRMLS_CC);
- zend_hash_move_forward(model->u.content);
- }
- }
- case XSD_CONTENT_GROUP:
- model_to_zval_object(ret, model->u.group, data, sdl TSRMLS_CC);
- default:
- break;
- }
-}
-
-/* Struct encode/decode */
-zval *to_zval_object(encodeTypePtr type, xmlNodePtr data)
-{
- zval *ret;
- xmlNodePtr trav;
- sdlPtr sdl;
- sdlTypePtr sdlType = type->sdl_type;
- TSRMLS_FETCH();
-
- sdl = SOAP_GLOBAL(sdl);
- if (sdlType) {
- if (sdlType->kind == XSD_TYPEKIND_RESTRICTION &&
- sdlType->encode && type != &sdlType->encode->details) {
- encodePtr enc;
-
- enc = sdlType->encode;
- while (enc && enc->details.sdl_type &&
- enc->details.sdl_type->kind != XSD_TYPEKIND_SIMPLE &&
- enc->details.sdl_type->kind != XSD_TYPEKIND_LIST &&
- enc->details.sdl_type->kind != XSD_TYPEKIND_UNION) {
- enc = enc->details.sdl_type->encode;
- }
- if (enc) {
- zval *base;
-
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- object_init(ret);
- base = master_to_zval(enc, data);
-#ifdef ZEND_ENGINE_2
- base->refcount--;
-#endif
- add_property_zval(ret, "_", base);
- } else {
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
- object_init(ret);
- }
- } else if (sdlType->kind == XSD_TYPEKIND_EXTENSION &&
- sdlType->encode &&
- type != &sdlType->encode->details) {
- if (sdlType->encode->details.sdl_type &&
- sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_SIMPLE &&
- sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_LIST &&
- sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_UNION) {
- ret = master_to_zval(sdlType->encode, data);
- FIND_XML_NULL(data, ret);
- } else {
- zval *base;
-
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- object_init(ret);
- base = master_to_zval(sdlType->encode, data);
-#ifdef ZEND_ENGINE_2
- base->refcount--;
-#endif
- add_property_zval(ret, "_", base);
- }
- } else {
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
- object_init(ret);
- }
- if (sdlType->model) {
- model_to_zval_object(ret, sdlType->model, data, sdl TSRMLS_CC);
- }
- if (sdlType->attributes) {
- sdlAttributePtr *attr;
-
- zend_hash_internal_pointer_reset(sdlType->attributes);
- while (zend_hash_get_current_data(sdlType->attributes, (void**)&attr) == SUCCESS) {
- if ((*attr)->name) {
- xmlAttrPtr val = get_attribute(data->properties, (*attr)->name);
- if (val && val->children && val->children->content) {
- xmlNodePtr dummy;
- zval *data;
-
- dummy = xmlNewNode(NULL, "BOGUS");
- xmlNodeSetContent(dummy, val->children->content);
- data = master_to_zval((*attr)->encode, dummy);
- xmlFreeNode(dummy);
-#ifdef ZEND_ENGINE_2
- data->refcount--;
-#endif
- add_property_zval(ret, (*attr)->name, data);
- }
- }
- zend_hash_move_forward(sdlType->attributes);
- }
- }
- } else {
-
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
- object_init(ret);
-
- trav = data->children;
-
- while (trav != NULL) {
- if (trav->type == XML_ELEMENT_NODE) {
- encodePtr enc = NULL;
- zval *tmpVal;
-
- xmlAttrPtr typeAttr = get_attribute(trav->properties,"type");
- if (typeAttr != NULL && typeAttr->children && typeAttr->children->content) {
- enc = get_encoder_from_prefix(sdl, trav, typeAttr->children->content);
- }
- tmpVal = master_to_zval(enc, trav);
-#ifdef ZEND_ENGINE_2
- tmpVal->refcount--;
-#endif
- add_property_zval(ret, (char *)trav->name, tmpVal);
- }
- trav = trav->next;
- }
- }
- return ret;
-}
-
-static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, HashTable *prop, int style, int strict)
-{
- switch (model->kind) {
- case XSD_CONTENT_ELEMENT: {
- zval **data;
- xmlNodePtr property;
- encodePtr enc;
-
- if (zend_hash_find(prop, model->u.element->name, strlen(model->u.element->name)+1, (void**)&data) == SUCCESS) {
- enc = model->u.element->encode;
- if ((model->max_occurs == -1 || model->max_occurs > 1) && Z_TYPE_PP(data) == IS_ARRAY) {
- HashTable *ht = Z_ARRVAL_PP(data);
- zval **val;
-
- zend_hash_internal_pointer_reset(ht);
- while (zend_hash_get_current_data(ht,(void**)&val) == SUCCESS) {
- property = master_to_xml(enc, *val, style);
- xmlNodeSetName(property, model->u.element->name);
- xmlAddChild(node, property);
- zend_hash_move_forward(ht);
- }
- } else {
- property = master_to_xml(enc, *data, style);
- xmlNodeSetName(property, model->u.element->name);
- xmlAddChild(node, property);
- }
- return 1;
- } else if (model->min_occurs == 0) {
- return 1;
- } else {
- if (strict) {
- php_error(E_ERROR, "object hasn't '%s' property",model->u.element->name);
- }
- return 0;
- }
- break;
- }
- case XSD_CONTENT_SEQUENCE:
- case XSD_CONTENT_ALL: {
- sdlContentModelPtr *tmp;
-
- zend_hash_internal_pointer_reset(model->u.content);
- while (zend_hash_get_current_data(model->u.content, (void**)&tmp) == SUCCESS) {
- if (!model_to_xml_object(node, *tmp, prop, style, model->min_occurs > 0)) {
- return 0;
- }
- zend_hash_move_forward(model->u.content);
- }
- return 1;
- }
- case XSD_CONTENT_CHOICE: {
- sdlContentModelPtr *tmp;
-
- zend_hash_internal_pointer_reset(model->u.content);
- while (zend_hash_get_current_data(model->u.content, (void**)&tmp) == SUCCESS) {
- if (model_to_xml_object(node, *tmp, prop, style, 0)) {
- return 1;
- }
- zend_hash_move_forward(model->u.content);
- }
- return 0;
- }
- case XSD_CONTENT_GROUP: {
- return model_to_xml_object(node, model->u.group, prop, style, model->min_occurs > 0);
- }
- default:
- break;
- }
- return 1;
-}
-
-xmlNodePtr to_xml_object(encodeTypePtr type, zval *data, int style)
-{
- xmlNodePtr xmlParam;
- HashTable *prop;
- int i;
- sdlTypePtr sdlType = type->sdl_type;
- TSRMLS_FETCH();
-
- /* Special handling of class SoapVar */
- if (data &&
- Z_TYPE_P(data) == IS_OBJECT &&
- Z_OBJCE_P(data) == soap_var_class_entry) {
- zval **ztype, **zdata, **zns, **zstype, **zname, **znamens;
- encodePtr enc;
-
- if (zend_hash_find(Z_OBJPROP_P(data), "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE) {
- php_error(E_ERROR, "error encoding SoapVar");
- }
-
- enc = get_conversion(Z_LVAL_P(*ztype));
-
- if (zend_hash_find(Z_OBJPROP_P(data), "enc_value", sizeof("enc_value"), (void **)&zdata) == FAILURE) {
- xmlParam = master_to_xml(enc, NULL, style);
- } else {
- xmlParam = master_to_xml(enc, *zdata, style);
- }
-
- if (zend_hash_find(Z_OBJPROP_P(data), "enc_stype", sizeof("enc_stype"), (void **)&zstype) == SUCCESS) {
- if (zend_hash_find(Z_OBJPROP_P(data), "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS) {
- set_ns_and_type_ex(xmlParam, Z_STRVAL_PP(zns), Z_STRVAL_PP(zstype));
- } else {
- set_ns_and_type_ex(xmlParam, NULL, Z_STRVAL_PP(zstype));
- }
- }
-
- if (zend_hash_find(Z_OBJPROP_P(data), "enc_name", sizeof("enc_name"), (void **)&zname) == SUCCESS) {
- xmlNodeSetName(xmlParam, Z_STRVAL_PP(zname));
- }
- if (zend_hash_find(Z_OBJPROP_P(data), "enc_namens", sizeof("enc_namens"), (void **)&znamens) == SUCCESS) {
- smart_str *ns;
- xmlNsPtr nsp;
-
- ns = encode_new_ns();
- nsp = xmlNewNs(xmlParam, Z_STRVAL_PP(znamens), ns->c);
- xmlSetNs(xmlParam, nsp);
- smart_str_free(ns);
- efree(ns);
- }
- } else if (sdlType) {
- prop = NULL;
- if (Z_TYPE_P(data) == IS_OBJECT) {
- prop = Z_OBJPROP_P(data);
- } else if (Z_TYPE_P(data) == IS_ARRAY) {
- prop = Z_ARRVAL_P(data);
- }
- if (sdlType->kind == XSD_TYPEKIND_RESTRICTION &&
- sdlType->encode && type != &sdlType->encode->details) {
- encodePtr enc;
-
- enc = sdlType->encode;
- while (enc && enc->details.sdl_type &&
- enc->details.sdl_type->kind != XSD_TYPEKIND_SIMPLE &&
- enc->details.sdl_type->kind != XSD_TYPEKIND_LIST &&
- enc->details.sdl_type->kind != XSD_TYPEKIND_UNION) {
- enc = enc->details.sdl_type->encode;
- }
- if (enc) {
- zval **tmp;
- if (prop && zend_hash_find(prop, "_", sizeof("_"), (void**)&tmp) == SUCCESS) {
- xmlParam = master_to_xml(enc, *tmp, style);
- } else if (prop == NULL) {
- xmlParam = master_to_xml(enc, data, style);
- } else {
- xmlParam = xmlNewNode(NULL, "BOGUS");
- }
- } else {
- xmlParam = xmlNewNode(NULL, "BOGUS");
- }
- } else if (sdlType->kind == XSD_TYPEKIND_EXTENSION &&
- sdlType->encode && type != &sdlType->encode->details) {
- if (sdlType->encode->details.sdl_type &&
- sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_SIMPLE &&
- sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_LIST &&
- sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_UNION) {
- xmlParam = master_to_xml(sdlType->encode, data, style);
- } else {
- zval **tmp;
-
- if (prop && zend_hash_find(prop, "_", sizeof("_"), (void**)&tmp) == SUCCESS) {
- xmlParam = master_to_xml(sdlType->encode, *tmp, style);
- } else if (prop == NULL) {
- xmlParam = master_to_xml(sdlType->encode, data, style);
- } else {
- xmlParam = xmlNewNode(NULL, "BOGUS");
- }
- }
- } else {
- xmlParam = xmlNewNode(NULL, "BOGUS");
- }
- FIND_ZVAL_NULL(data, xmlParam, style);
-
- if (prop != NULL) {
- if (sdlType->model) {
- model_to_xml_object(xmlParam, sdlType->model, prop, style, 1);
- }
- if (sdlType->attributes) {
- sdlAttributePtr *attr;
- zval **data;
-
- zend_hash_internal_pointer_reset(sdlType->attributes);
- while (zend_hash_get_current_data(sdlType->attributes, (void**)&attr) == SUCCESS) {
- if ((*attr)->name) {
- if (zend_hash_find(prop, (*attr)->name, strlen((*attr)->name)+1, (void**)&data) == SUCCESS) {
- xmlNodePtr dummy;
-
- dummy = master_to_xml((*attr)->encode, *data, SOAP_LITERAL);
- if (dummy->children && dummy->children->content) {
- xmlSetProp(xmlParam, (*attr)->name, dummy->children->content);
- }
- xmlFreeNode(dummy);
- }
- }
- zend_hash_move_forward(sdlType->attributes);
- }
- }
- }
- if (style == SOAP_ENCODED) {
- set_ns_and_type(xmlParam, type);
- }
- } else {
- xmlParam = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, xmlParam, style);
-
- prop = NULL;
- if (Z_TYPE_P(data) == IS_OBJECT) {
- prop = Z_OBJPROP_P(data);
- } else if (Z_TYPE_P(data) == IS_ARRAY) {
- prop = Z_ARRVAL_P(data);
- }
- if (prop != NULL) {
- i = zend_hash_num_elements(prop);
- zend_hash_internal_pointer_reset(prop);
-
- for (;i > 0;i--) {
- xmlNodePtr property;
- zval **zprop;
- char *str_key;
-
- zend_hash_get_current_key(prop, &str_key, NULL, FALSE);
- zend_hash_get_current_data(prop, (void **)&zprop);
-
- property = master_to_xml(get_conversion((*zprop)->type), (*zprop), style);
-
- xmlNodeSetName(property, str_key);
- xmlAddChild(xmlParam, property);
- zend_hash_move_forward(prop);
- }
- if (style == SOAP_ENCODED) {
- set_ns_and_type(xmlParam, type);
- }
- }
- }
- return xmlParam;
-}
-
-/* Array encode/decode */
-static xmlNodePtr guess_array_map(encodeTypePtr type, zval *data, int style)
-{
- encodePtr enc = NULL;
- TSRMLS_FETCH();
-
- if (data && Z_TYPE_P(data) == IS_ARRAY) {
- if (is_map(data)) {
- enc = get_conversion(APACHE_MAP);
- } else {
- enc = get_conversion(SOAP_ENC_ARRAY);
- }
- }
- if (!enc) {
- enc = get_conversion(IS_NULL);
- }
-
- return master_to_xml(enc, data, style);
-}
-
-static int calc_dimension_12(const char* str)
-{
- int i = 0, flag = 0;
- while (*str != '\0' && (*str < '0' || *str > '9') && (*str != '*')) {
- str++;
- }
- if (*str == '*') {
- i++;
- str++;
- }
- while (*str != '\0') {
- if (*str >= '0' && *str <= '9') {
- if (flag == 0) {
- i++;
- flag = 1;
- }
- } else if (*str == '*') {
- php_error(E_ERROR,"* may only be first arraySize value in list");
- } else {
- flag = 0;
- }
- str++;
- }
- return i;
-}
-
-static int* get_position_12(int dimension, const char* str)
-{
- int *pos;
- int i = -1, flag = 0;
-
- pos = emalloc(sizeof(int)*dimension);
- memset(pos,0,sizeof(int)*dimension);
- while (*str != '\0' && (*str < '0' || *str > '9') && (*str != '*')) {
- str++;
- }
- if (*str == '*') {
- str++;
- i++;
- }
- while (*str != '\0') {
- if (*str >= '0' && *str <= '9') {
- if (flag == 0) {
- i++;
- flag = 1;
- }
- pos[i] = (pos[i]*10)+(*str-'0');
- } else if (*str == '*') {
- php_error(E_ERROR,"* may only be first arraySize value in list");
- } else {
- flag = 0;
- }
- str++;
- }
- return pos;
-}
-
-static int calc_dimension(const char* str)
-{
- int i = 1;
- while (*str != ']' && *str != '\0') {
- if (*str == ',') {
- i++;
- }
- str++;
- }
- return i;
-}
-
-static void get_position_ex(int dimension, const char* str, int** pos)
-{
- int i = 0;
-
- memset(*pos,0,sizeof(int)*dimension);
- while (*str != ']' && *str != '\0' && i < dimension) {
- if (*str >= '0' && *str <= '9') {
- (*pos)[i] = ((*pos)[i]*10)+(*str-'0');
- } else if (*str == ',') {
- i++;
- }
- str++;
- }
-}
-
-static int* get_position(int dimension, const char* str)
-{
- int *pos;
-
- pos = emalloc(sizeof(int)*dimension);
- get_position_ex(dimension, str, &pos);
- return pos;
-}
-
-static void add_xml_array_elements(xmlNodePtr xmlParam,
- sdlTypePtr type,
- encodePtr enc,
- int dimension ,
- int* dims,
- zval* data,
- int style)
-{
- int j;
-
- if (data && Z_TYPE_P(data) == IS_ARRAY) {
- zend_hash_internal_pointer_reset(data->value.ht);
- for (j=0; j<dims[0]; j++) {
- zval **zdata;
-
- if (zend_hash_get_current_data(data->value.ht, (void **)&zdata) != SUCCESS) {
- zdata = NULL;
- }
- if (dimension == 1) {
- xmlNodePtr xparam;
-
- if (zdata) {
- if (enc == NULL) {
- TSRMLS_FETCH();
- xparam = master_to_xml(get_conversion((*zdata)->type), (*zdata), style);
- } else {
- xparam = master_to_xml(enc, (*zdata), style);
- }
- } else {
- xparam = xmlNewNode(NULL, "BOGUS");
- }
-
- if (type) {
- xmlNodeSetName(xparam, type->name);
- } else if (style == SOAP_LITERAL && enc && enc->details.type_str) {
- xmlNodeSetName(xparam, enc->details.type_str);
- } else {
- xmlNodeSetName(xparam, "val");
- }
- xmlAddChild(xmlParam, xparam);
- } else {
- if (zdata) {
- add_xml_array_elements(xmlParam, type, enc, dimension-1, dims+1, *zdata, style);
- } else {
- add_xml_array_elements(xmlParam, type, enc, dimension-1, dims+1, NULL, style);
- }
- }
- zend_hash_move_forward(data->value.ht);
- }
- } else {
- for (j=0; j<dims[0]; j++) {
- if (dimension == 1) {
- xmlNodePtr xparam;
-
- xparam = xmlNewNode(NULL, "BOGUS");
- if (type) {
- xmlNodeSetName(xparam, type->name);
- } else if (style == SOAP_LITERAL && enc && enc->details.type_str) {
- xmlNodeSetName(xparam, enc->details.type_str);
- } else {
- xmlNodeSetName(xparam, "val");
- }
- xmlAddChild(xmlParam, xparam);
- } else {
- add_xml_array_elements(xmlParam, type, enc, dimension-1, dims+1, NULL, style);
- }
- }
- }
-}
-
-static inline int array_num_elements(HashTable* ht)
-{
- if (ht->pListTail && ht->pListTail->nKeyLength == 0) {
- return ht->pListTail->h-1;
- }
- return 0;
-}
-
-xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style)
-{
- sdlTypePtr sdl_type = type->sdl_type;
- smart_str array_type = {0}, array_size = {0};
- int i;
- xmlNodePtr xmlParam;
- encodePtr enc = NULL;
- int dimension = 1;
- int* dims;
- int soap_version;
-
- TSRMLS_FETCH();
-
- soap_version = SOAP_GLOBAL(soap_version);
-
- xmlParam = xmlNewNode(NULL,"BOGUS");
-
- FIND_ZVAL_NULL(data, xmlParam, style);
-
- if (Z_TYPE_P(data) == IS_ARRAY) {
- sdlAttributePtr *arrayType;
- xmlAttrPtr *arrayTypeAttr;
- sdlTypePtr elementType;
-
- i = zend_hash_num_elements(Z_ARRVAL_P(data));
-
- if (sdl_type &&
- sdl_type->attributes &&
- zend_hash_find(sdl_type->attributes, SOAP_1_1_ENC_NAMESPACE":arrayType",
- sizeof(SOAP_1_1_ENC_NAMESPACE":arrayType"),
- (void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arrayType", sizeof(WSDL_NAMESPACE":arrayType"), (void **)&arrayTypeAttr) == SUCCESS) {
-
- char *ns = NULL, *value, *end;
- xmlNsPtr myNs;
- zval** el;
-
- parse_namespace((*arrayTypeAttr)->children->content, &value, &ns);
- myNs = xmlSearchNs((*arrayTypeAttr)->doc, (*arrayTypeAttr)->parent, ns);
-
- end = strrchr(value,'[');
- if (end) {
- *end = '\0';
- end++;
- dimension = calc_dimension(end);
- }
- if (myNs != NULL) {
- enc = get_encoder(SOAP_GLOBAL(sdl), myNs->href, value);
- get_type_str(xmlParam, myNs->href, value, &array_type);
- } else {
- smart_str_appends(&array_type, value);
- }
-
- dims = emalloc(sizeof(int)*dimension);
- dims[0] = i;
- el = &data;
- for (i = 1; i < dimension; i++) {
- if (el != NULL && Z_TYPE_PP(el) == IS_ARRAY && Z_ARRVAL_PP(el)->pListHead) {
- el = (zval**)Z_ARRVAL_PP(el)->pListHead->pData;
- if (Z_TYPE_PP(el) == IS_ARRAY) {
- dims[i] = zend_hash_num_elements(Z_ARRVAL_PP(el));
- } else {
- dims[i] = 0;
- }
- }
- }
-
- smart_str_append_long(&array_size, dims[0]);
- for (i=1; i<dimension; i++) {
- smart_str_appendc(&array_size, ',');
- smart_str_append_long(&array_size, dims[i]);
- }
-
- efree(value);
- if (ns) efree(ns);
-
- } else if (sdl_type &&
- sdl_type->attributes &&
- zend_hash_find(sdl_type->attributes, SOAP_1_2_ENC_NAMESPACE":itemType",
- sizeof(SOAP_1_2_ENC_NAMESPACE":itemType"),
- (void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":itemType", sizeof(WSDL_NAMESPACE":itemType"), (void **)&arrayTypeAttr) == SUCCESS) {
- char *name, *ns;
- xmlNsPtr nsptr;
- xmlAttrPtr attr;
-
- attr = *arrayTypeAttr;
- parse_namespace(attr->children->content, &name, &ns);
- nsptr = xmlSearchNs(attr->doc, attr->parent, ns);
-
- if (nsptr != NULL) {
- enc = get_encoder(SOAP_GLOBAL(sdl), nsptr->href, name);
- get_type_str(xmlParam, nsptr->href, name, &array_type);
- } else {
- smart_str_appends(&array_type, name);
- }
- efree(name);
- if (ns) {efree(ns);}
- if (zend_hash_find(sdl_type->attributes, SOAP_1_2_ENC_NAMESPACE":arraySize",
- sizeof(SOAP_1_2_ENC_NAMESPACE":arraySize"),
- (void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arraySize", sizeof(WSDL_NAMESPACE":arraysize"), (void **)&arrayTypeAttr) == SUCCESS) {
- attr = *arrayTypeAttr;
-
- dimension = calc_dimension_12(attr->children->content);
- dims = get_position_12(dimension, attr->children->content);
- if (dims[0] == 0) {dims[0] = i;}
-
- smart_str_append_long(&array_size, dims[0]);
- for (i=1; i<dimension; i++) {
- smart_str_appendc(&array_size, ',');
- smart_str_append_long(&array_size, dims[i]);
- }
- } else {
- dims = emalloc(sizeof(int));
- *dims = 0;
- smart_str_append_long(&array_size, i);
- }
- } else if (sdl_type &&
- sdl_type->attributes &&
- zend_hash_find(sdl_type->attributes, SOAP_1_2_ENC_NAMESPACE":arraySize",
- sizeof(SOAP_1_2_ENC_NAMESPACE":arraySize"),
- (void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arraySize", sizeof(WSDL_NAMESPACE":arraySize"), (void **)&arrayTypeAttr) == SUCCESS) {
- xmlAttrPtr attr;
-
- attr = *arrayTypeAttr;
-
- dimension = calc_dimension_12(attr->children->content);
- dims = get_position_12(dimension, attr->children->content);
- if (dims[0] == 0) {dims[0] = i;}
-
- smart_str_append_long(&array_size, dims[0]);
- for (i=1; i<dimension; i++) {
- smart_str_appendc(&array_size, ',');
- smart_str_append_long(&array_size, dims[i]);
- }
-
- if (sdl_type && sdl_type->elements &&
- zend_hash_num_elements(sdl_type->elements) == 1 &&
- (elementType = *(sdlTypePtr*)sdl_type->elements->pListHead->pData) != NULL &&
- elementType->encode && elementType->encode->details.type_str) {
- enc = elementType->encode;
- get_type_str(xmlParam, elementType->encode->details.ns, elementType->encode->details.type_str, &array_type);
- } else {
- get_array_type(xmlParam, data, &array_type TSRMLS_CC);
- enc = get_encoder_ex(SOAP_GLOBAL(sdl), array_type.c);
- }
- } else if (sdl_type && sdl_type->elements &&
- zend_hash_num_elements(sdl_type->elements) == 1 &&
- (elementType = *(sdlTypePtr*)sdl_type->elements->pListHead->pData) != NULL &&
- elementType->encode && elementType->encode->details.type_str) {
-
- enc = elementType->encode;
-
- get_type_str(xmlParam, elementType->encode->details.ns, elementType->encode->details.type_str, &array_type);
-
- smart_str_append_long(&array_size, i);
-
- dims = emalloc(sizeof(int)*dimension);
- dims[0] = i;
- } else {
-
- get_array_type(xmlParam, data, &array_type TSRMLS_CC);
- enc = get_encoder_ex(SOAP_GLOBAL(sdl), array_type.c);
- smart_str_append_long(&array_size, i);
- dims = emalloc(sizeof(int)*dimension);
- dims[0] = i;
- }
-
- if (style == SOAP_ENCODED) {
- if (soap_version == SOAP_1_1) {
- smart_str_0(&array_type);
- if (strcmp(array_type.c,"xsd:anyType") == 0) {
- smart_str_free(&array_type);
- smart_str_appendl(&array_type,"xsd:ur-type",sizeof("xsd:ur-type")-1);
- }
- smart_str_appendc(&array_type, '[');
- smart_str_append(&array_type, &array_size);
- smart_str_appendc(&array_type, ']');
- smart_str_0(&array_type);
- xmlSetProp(xmlParam, SOAP_1_1_ENC_NS_PREFIX":arrayType", array_type.c);
- } else {
- int i = 0;
- while (i < array_size.len) {
- if (array_size.c[i] == ',') {array_size.c[i] = ' ';}
- ++i;
- }
- smart_str_0(&array_type);
- smart_str_0(&array_size);
- xmlSetProp(xmlParam, SOAP_1_2_ENC_NS_PREFIX":itemType", array_type.c);
- xmlSetProp(xmlParam, SOAP_1_2_ENC_NS_PREFIX":arraySize", array_size.c);
- }
- }
- smart_str_free(&array_type);
- smart_str_free(&array_size);
-
- add_xml_array_elements(xmlParam, sdl_type, enc, dimension, dims, data, style);
- efree(dims);
- if (style == SOAP_ENCODED) {
- set_ns_and_type(xmlParam, type);
- }
- }
- return xmlParam;
-}
-
-zval *to_zval_array(encodeTypePtr type, xmlNodePtr data)
-{
- zval *ret;
- xmlNodePtr trav;
- encodePtr enc = NULL;
- int dimension = 1;
- int* dims = NULL;
- int* pos = NULL;
- xmlAttrPtr attr, *tmp;
- sdlPtr sdl;
- sdlAttributePtr *arrayType;
- sdlTypePtr elementType;
-
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
- sdl = SOAP_GLOBAL(sdl);
-
- if (data &&
- (attr = get_attribute(data->properties,"arrayType")) &&
- attr->children && attr->children->content) {
- char *type, *end, *ns;
- xmlNsPtr nsptr;
-
- parse_namespace(attr->children->content, &type, &ns);
- nsptr = xmlSearchNs(attr->doc, attr->parent, ns);
-
- end = strrchr(type,'[');
- if (end) {
- *end = '\0';
- dimension = calc_dimension(end+1);
- dims = get_position(dimension, end+1);
- }
- if (nsptr != NULL) {
- enc = get_encoder(SOAP_GLOBAL(sdl), nsptr->href, type);
- }
- efree(type);
- if (ns) {efree(ns);}
-
- } else if ((attr = get_attribute(data->properties,"itemType")) &&
- attr->children &&
- attr->children->content) {
- char *type, *ns;
- xmlNsPtr nsptr;
-
- parse_namespace(attr->children->content, &type, &ns);
- nsptr = xmlSearchNs(attr->doc, attr->parent, ns);
- if (nsptr != NULL) {
- enc = get_encoder(SOAP_GLOBAL(sdl), nsptr->href, type);
- }
- efree(type);
- if (ns) {efree(ns);}
-
- if ((attr = get_attribute(data->properties,"arraySize")) &&
- attr->children && attr->children->content) {
- dimension = calc_dimension_12(attr->children->content);
- dims = get_position_12(dimension, attr->children->content);
- } else {
- dims = emalloc(sizeof(int));
- *dims = 0;
- }
-
- } else if ((attr = get_attribute(data->properties,"arraySize")) &&
- attr->children && attr->children->content) {
-
- dimension = calc_dimension_12(attr->children->content);
- dims = get_position_12(dimension, attr->children->content);
-
- } else if (type->sdl_type != NULL &&
- type->sdl_type->attributes != NULL &&
- zend_hash_find(type->sdl_type->attributes, SOAP_1_1_ENC_NAMESPACE":arrayType",
- sizeof(SOAP_1_1_ENC_NAMESPACE":arrayType"),
- (void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arrayType", sizeof(WSDL_NAMESPACE":arrayType"), (void **)&tmp) == SUCCESS) {
- char *type, *end, *ns;
- xmlNsPtr nsptr;
-
- attr = *tmp;
- parse_namespace(attr->children->content, &type, &ns);
- nsptr = xmlSearchNs(attr->doc, attr->parent, ns);
-
- end = strrchr(type,'[');
- if (end) {
- *end = '\0';
- }
- if (nsptr != NULL) {
- enc = get_encoder(SOAP_GLOBAL(sdl), nsptr->href, type);
- }
- efree(type);
- if (ns) {efree(ns);}
- dims = emalloc(sizeof(int));
- *dims = 0;
-
- } else if (type->sdl_type != NULL &&
- type->sdl_type->attributes != NULL &&
- zend_hash_find(type->sdl_type->attributes, SOAP_1_2_ENC_NAMESPACE":itemType",
- sizeof(SOAP_1_2_ENC_NAMESPACE":itemType"),
- (void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":itemType", sizeof(WSDL_NAMESPACE":itemType"), (void **)&tmp) == SUCCESS) {
-
- char *name, *ns;
- xmlNsPtr nsptr;
-
- attr = *tmp;
- parse_namespace(attr->children->content, &name, &ns);
- nsptr = xmlSearchNs(attr->doc, attr->parent, ns);
-
- if (nsptr != NULL) {
- enc = get_encoder(SOAP_GLOBAL(sdl), nsptr->href, name);
- }
- efree(name);
- if (ns) {efree(ns);}
-
- if (zend_hash_find(type->sdl_type->attributes, SOAP_1_2_ENC_NAMESPACE":arraySize",
- sizeof(SOAP_1_2_ENC_NAMESPACE":arraySize"),
- (void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arraySize", sizeof(WSDL_NAMESPACE":arraysize"), (void **)&tmp) == SUCCESS) {
- attr = *tmp;
- dimension = calc_dimension_12(attr->children->content);
- dims = get_position_12(dimension, attr->children->content);
- } else {
- dims = emalloc(sizeof(int));
- *dims = 0;
- }
- } else if (type->sdl_type != NULL &&
- type->sdl_type->attributes != NULL &&
- zend_hash_find(type->sdl_type->attributes, SOAP_1_2_ENC_NAMESPACE":arraySize",
- sizeof(SOAP_1_2_ENC_NAMESPACE":arraySize"),
- (void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arraySize", sizeof(WSDL_NAMESPACE":arraysize"), (void **)&tmp) == SUCCESS) {
-
- attr = *tmp;
- dimension = calc_dimension_12(attr->children->content);
- dims = get_position_12(dimension, attr->children->content);
- if (type->sdl_type && type->sdl_type->elements &&
- zend_hash_num_elements(type->sdl_type->elements) == 1 &&
- (elementType = *(sdlTypePtr*)type->sdl_type->elements->pListHead->pData) != NULL &&
- elementType->encode) {
- enc = elementType->encode;
- }
- } else if (type->sdl_type && type->sdl_type->elements &&
- zend_hash_num_elements(type->sdl_type->elements) == 1 &&
- (elementType = *(sdlTypePtr*)type->sdl_type->elements->pListHead->pData) != NULL &&
- elementType->encode) {
- enc = elementType->encode;
- }
- if (dims == NULL) {
- dimension = 1;
- dims = emalloc(sizeof(int));
- *dims = 0;
- }
- pos = emalloc(sizeof(int)*dimension);
- memset(pos,0,sizeof(int)*dimension);
- if (data &&
- (attr = get_attribute(data->properties,"offset")) &&
- attr->children && attr->children->content) {
- char* tmp = strrchr(attr->children->content,'[');
-
- if (tmp == NULL) {
- tmp = attr->children->content;
- }
- get_position_ex(dimension, tmp, &pos);
- }
- if (enc == NULL) {
- enc = get_conversion(UNKNOWN_TYPE);
- }
-
- array_init(ret);
- trav = data->children;
- while (trav) {
- if (trav->type == XML_ELEMENT_NODE) {
- int i;
- zval *tmpVal, *ar;
- encodePtr typeEnc = NULL;
- xmlAttrPtr type = get_attribute(trav->properties,"type");
- xmlAttrPtr position = get_attribute(trav->properties,"position");
- if (type != NULL && type->children && type->children->content) {
- typeEnc = get_encoder_from_prefix(sdl, trav, type->children->content);
- }
- if (typeEnc) {
- tmpVal = master_to_zval(typeEnc, trav);
- } else {
- tmpVal = master_to_zval(enc, trav);
- }
- if (position != NULL && position->children && position->children->content) {
- char* tmp = strrchr(position->children->content,'[');
- if (tmp == NULL) {
- tmp = position->children->content;
- }
- get_position_ex(dimension, tmp, &pos);
- }
-
- /* Get/Create intermediate arrays for multidimensional arrays */
- i = 0;
- ar = ret;
- while (i < dimension-1) {
- zval** ar2;
- if (zend_hash_index_find(Z_ARRVAL_P(ar), pos[i], (void**)&ar2) == SUCCESS) {
- ar = *ar2;
- } else {
- zval *tmpAr;
- MAKE_STD_ZVAL(tmpAr);
- array_init(tmpAr);
- zend_hash_index_update(Z_ARRVAL_P(ar), pos[i], &tmpAr, sizeof(zval*), (void**)&ar2);
- ar = *ar2;
- }
- i++;
- }
- zend_hash_index_update(Z_ARRVAL_P(ar), pos[i], &tmpVal, sizeof(zval *), NULL);
-
- /* Increment position */
- i = dimension;
- while (i > 0) {
- i--;
- pos[i]++;
- if (pos[i] >= dims[i]) {
- if (i > 0) {
- pos[i] = 0;
- } else {
- /* TODO: Array index overflow */
- }
- } else {
- break;
- }
- }
- }
- trav = trav->next;
- }
- efree(dims);
- efree(pos);
- return ret;
-}
-
-/* Map encode/decode */
-static xmlNodePtr to_xml_map(encodeTypePtr type, zval *data, int style)
-{
- xmlNodePtr xmlParam;
- int i;
- TSRMLS_FETCH();
-
- xmlParam = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, xmlParam, style);
-
- if (Z_TYPE_P(data) == IS_ARRAY) {
- i = zend_hash_num_elements(Z_ARRVAL_P(data));
- /* TODO: Register namespace...??? */
- xmlSetProp(xmlParam, "xmlns:apache", "http://xml.apache.org/xml-soap");
- zend_hash_internal_pointer_reset(data->value.ht);
- for (;i > 0;i--) {
- xmlNodePtr xparam, item;
- xmlNodePtr key;
- zval **temp_data;
- char *key_val;
- int int_val;
- encodePtr enc;
-
- zend_hash_get_current_data(data->value.ht, (void **)&temp_data);
- if (Z_TYPE_PP(temp_data) != IS_NULL) {
- item = xmlNewNode(NULL, "item");
- key = xmlNewNode(NULL, "key");
- if (zend_hash_get_current_key(data->value.ht, &key_val, (long *)&int_val, FALSE) == HASH_KEY_IS_STRING) {
- if (style == SOAP_ENCODED) {
- xmlSetProp(key, "xsi:type", "xsd:string");
- }
- xmlNodeSetContent(key, key_val);
- } else {
- smart_str tmp = {0};
- smart_str_append_long(&tmp, int_val);
- smart_str_0(&tmp);
-
- if (style == SOAP_ENCODED) {
- xmlSetProp(key, "xsi:type", "xsd:int");
- }
- xmlNodeSetContentLen(key, tmp.c, tmp.len);
-
- smart_str_free(&tmp);
- }
-
-
- enc = get_conversion((*temp_data)->type);
- xparam = master_to_xml(enc, (*temp_data), style);
-
- xmlNodeSetName(xparam, "value");
- xmlAddChild(item, key);
- xmlAddChild(item, xparam);
- xmlAddChild(xmlParam, item);
- }
- zend_hash_move_forward(data->value.ht);
- }
- if (style == SOAP_ENCODED) {
- set_ns_and_type(xmlParam, type);
- }
- }
-
- return xmlParam;
-}
-
-static zval *to_zval_map(encodeTypePtr type, xmlNodePtr data)
-{
- zval *ret, *key, *value;
- xmlNodePtr trav, item, xmlKey, xmlValue;
- encodePtr enc;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- if (data && data->children) {
- array_init(ret);
- trav = data->children;
-
- enc = get_conversion(UNKNOWN_TYPE);
- trav = data->children;
- FOREACHNODE(trav, "item", item) {
- xmlKey = get_node(item->children, "key");
- if (!xmlKey) {
- php_error(E_ERROR, "Error encoding apache map, missing key");
- }
-
- xmlValue = get_node(item->children, "value");
- if (!xmlKey) {
- php_error(E_ERROR, "Error encoding apache map, missing value");
- }
-
- key = master_to_zval(enc, xmlKey);
- value = master_to_zval(enc, xmlValue);
-
- if (Z_TYPE_P(key) == IS_STRING) {
- zend_hash_update(Z_ARRVAL_P(ret), Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL);
- } else if (Z_TYPE_P(key) == IS_LONG) {
- zend_hash_index_update(Z_ARRVAL_P(ret), Z_LVAL_P(key), &value, sizeof(zval *), NULL);
- } else {
- php_error(E_ERROR, "Error encoding apache map, only Strings or Longs are allowd as keys");
- }
- }
- ENDFOREACH(trav);
- } else {
- ZVAL_NULL(ret);
- }
- return ret;
-}
-
-/* Unknown encode/decode */
-xmlNodePtr guess_xml_convert(encodeTypePtr type, zval *data, int style)
-{
- encodePtr enc;
- TSRMLS_FETCH();
-
- if (data) {
- enc = get_conversion(data->type);
- } else {
- enc = get_conversion(IS_NULL);
- }
- return master_to_xml(enc, data, style);
-}
-
-zval *guess_zval_convert(encodeTypePtr type, xmlNodePtr data)
-{
- encodePtr enc = NULL;
- xmlAttrPtr tmpattr;
- TSRMLS_FETCH();
-
- data = check_and_resolve_href(data);
-
- if (data == NULL) {
- enc = get_conversion(IS_NULL);
- } else if (data->properties && get_attribute(data->properties, "nil")) {
- enc = get_conversion(IS_NULL);
- } else {
- tmpattr = get_attribute(data->properties,"type");
- if (tmpattr != NULL) {
- if (tmpattr->children) {
- enc = get_conversion_from_type(data, tmpattr->children->content);
- } else {
- enc = get_conversion_from_type(data, "");
- }
- /*
- if (enc == NULL)
- php_error(E_ERROR, "Error (Don't know how to encode/decode \"%s\")", tmpattr->children->content);
- */
- }
-
- if (enc == NULL) {
- /* Didn't have a type, totally guess here */
- /* Logic: has children = IS_OBJECT else IS_STRING */
- xmlNodePtr trav;
-
- if (get_attribute(data->properties, "arrayType") ||
- get_attribute(data->properties, "itemType") ||
- get_attribute(data->properties, "arraySize")) {
- enc = get_conversion(SOAP_ENC_ARRAY);
- } else {
- enc = get_conversion(XSD_STRING);
- trav = data->children;
- while (trav != NULL) {
- if (trav->type == XML_ELEMENT_NODE) {
- enc = get_conversion(SOAP_ENC_OBJECT);
- break;
- }
- trav = trav->next;
- }
- }
- }
- }
- return master_to_zval(enc, data);
-}
-
-/* Time encode/decode */
-static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *format, int style)
-{
- /* logic hacked from ext/standard/datetime.c */
- struct tm *ta, tmbuf;
- time_t timestamp;
- int max_reallocs = 5;
- size_t buf_len=64, real_len;
- char *buf;
- char tzbuf[6];
-
- xmlNodePtr xmlParam;
-
- xmlParam = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, xmlParam, style);
-
- if (Z_TYPE_P(data) == IS_LONG) {
- timestamp = Z_LVAL_P(data);
- /*time(&timestamp);*/
- ta = php_localtime_r(&timestamp, &tmbuf);
-
- buf = (char *) emalloc(buf_len);
- while ((real_len = strftime(buf, buf_len, format, ta)) == buf_len || real_len == 0) {
- buf_len *= 2;
- buf = (char *) erealloc(buf, buf_len);
- if (!--max_reallocs) break;
- }
-
- /* Time zone support */
-#if HAVE_TM_GMTOFF
- sprintf(tzbuf, "%c%02d%02d", (ta->tm_gmtoff < 0) ? '-' : '+', abs(ta->tm_gmtoff / 3600), abs( (ta->tm_gmtoff % 3600) / 60 ));
-#else
- sprintf(tzbuf, "%c%02d%02d", ((ta->tm_isdst ? tzone - 3600:tzone)>0)?'-':'+', abs((ta->tm_isdst ? tzone - 3600 : tzone) / 3600), abs(((ta->tm_isdst ? tzone - 3600 : tzone) % 3600) / 60));
-#endif
- if (strcmp(tzbuf,"+0000") == 0) {
- strcpy(tzbuf,"Z");
- real_len++;
- } else {
- real_len += 5;
- }
- if (real_len >= buf_len) {
- buf = (char *) erealloc(buf, real_len+1);
- }
- strcat(buf, tzbuf);
-
- xmlNodeSetContent(xmlParam, buf);
- efree(buf);
- } else if (Z_TYPE_P(data) == IS_STRING) {
- buf = malloc(Z_STRLEN_P(data)+1);
- strcpy(buf, Z_STRVAL_P(data));
-
- xmlNodeSetContentLen(xmlParam, buf, Z_STRLEN_P(data));
- } else {
- xmlSetProp(xmlParam, "xsi:nil", "1");
- }
-
- if (style == SOAP_ENCODED) {
- set_ns_and_type(xmlParam, type);
- }
- return xmlParam;
-}
-
-static xmlNodePtr to_xml_duration(encodeTypePtr type, zval *data, int style)
-{
- /* TODO: '-'?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?T([0-9]+H)?([0-9]+M)?([0-9]+S)? */
- return to_xml_string(type, data, style);
-}
-
-static xmlNodePtr to_xml_datetime(encodeTypePtr type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%Y-%m-%dT%H:%M:%S", style);
-}
-
-static xmlNodePtr to_xml_time(encodeTypePtr type, zval *data, int style)
-{
- /* TODO: microsecconds */
- return to_xml_datetime_ex(type, data, "%H:%M:%S", style);
-}
-
-static xmlNodePtr to_xml_date(encodeTypePtr type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%Y-%m-%d", style);
-}
-
-static xmlNodePtr to_xml_gyearmonth(encodeTypePtr type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%Y-%m", style);
-}
-
-static xmlNodePtr to_xml_gyear(encodeTypePtr type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%Y", style);
-}
-
-static xmlNodePtr to_xml_gmonthday(encodeTypePtr type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "--%m-%d", style);
-}
-
-static xmlNodePtr to_xml_gday(encodeTypePtr type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "---%d", style);
-}
-
-static xmlNodePtr to_xml_gmonth(encodeTypePtr type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "--%m--", style);
-}
-
-void set_ns_and_type(xmlNodePtr node, encodeTypePtr type)
-{
- set_ns_and_type_ex(node, type->ns, type->type_str);
-}
-
-static void set_ns_and_type_ex(xmlNodePtr node, char *ns, char *type)
-{
- smart_str nstype = {0};
- get_type_str(node, ns, type, &nstype);
- xmlSetProp(node, "xsi:type", nstype.c);
- smart_str_free(&nstype);
-}
-
-smart_str *encode_new_ns()
-{
- int num;
- smart_str *ns = emalloc(sizeof(smart_str));
-
- TSRMLS_FETCH();
-
- memset(ns, 0, sizeof(smart_str));
- num = ++SOAP_GLOBAL(cur_uniq_ns);
- smart_str_appendl(ns, "ns", 2);
- smart_str_append_long(ns, num);
- smart_str_0(ns);
- return ns;
-}
-
-void encode_reset_ns()
-{
- TSRMLS_FETCH();
- SOAP_GLOBAL(cur_uniq_ns) = 0;
-}
-
-encodePtr get_conversion_ex(HashTable *encoding, int encode)
-{
- encodePtr *enc;
- TSRMLS_FETCH();
-
- if (zend_hash_index_find(encoding, encode, (void **)&enc) == FAILURE) {
- php_error(E_ERROR, "Cannot find encoding");
- }
-
- if (SOAP_GLOBAL(overrides)) {
- smart_str nscat = {0};
-
- smart_str_appendl(&nscat, (*enc)->details.ns, strlen((*enc)->details.ns));
- smart_str_appendc(&nscat, ':');
- smart_str_appendl(&nscat, (*enc)->details.type_str, strlen((*enc)->details.type_str));
- smart_str_0(&nscat);
-
- zend_hash_find(SOAP_GLOBAL(overrides), nscat.c, nscat.len + 1, (void **)&enc);
- smart_str_free(&nscat);
- }
-
- return *enc;
-}
-
-encodePtr get_conversion_from_href_type_ex(HashTable *encoding, const char *type, int len)
-{
- encodePtr *enc = NULL;
-
- if (encoding == NULL) {
- return NULL;
- }
-
- if (zend_hash_find(encoding, (char*)type, len + 1, (void **)&enc) == FAILURE) {
- return NULL;
- }
-
- return (*enc);
-}
-
-encodePtr get_conversion_from_type_ex(HashTable *encoding, xmlNodePtr node, const char *type)
-{
- encodePtr *enc = NULL;
- xmlNsPtr nsptr;
- char *ns, *cptype;
- smart_str nscat = {0};
-
- if (encoding == NULL) {
- return NULL;
- }
-
- parse_namespace(type, &cptype, &ns);
- nsptr = xmlSearchNs(node->doc, node, ns);
- if (nsptr != NULL) {
- smart_str_appends(&nscat, nsptr->href);
- smart_str_appendc(&nscat, ':');
- smart_str_appends(&nscat, cptype);
- smart_str_0(&nscat);
-
- if (zend_hash_find(encoding, nscat.c, nscat.len + 1, (void **)&enc) == FAILURE) {
- if (zend_hash_find(encoding, (char*)type, strlen(type) + 1, (void **)&enc) == FAILURE) {
- enc = NULL;
- }
- }
- smart_str_free(&nscat);
- } else {
- if (zend_hash_find(encoding, (char*)type, strlen(type) + 1, (void **)&enc) == FAILURE) {
- enc = NULL;
- }
- }
-
- if (cptype) {efree(cptype);}
- if (ns) {efree(ns);}
- if (enc == NULL) {
- return NULL;
- } else {
- return (*enc);
- }
-}
-
-static int is_map(zval *array)
-{
- int i, count = zend_hash_num_elements(Z_ARRVAL_P(array));
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(array));
- for (i = 0;i < count;i++) {
- if (zend_hash_get_current_key_type(Z_ARRVAL_P(array)) == HASH_KEY_IS_STRING) {
- return TRUE;
- }
- zend_hash_move_forward(Z_ARRVAL_P(array));
- }
- return FALSE;
-}
-
-static void get_array_type(xmlNodePtr node, zval *array, smart_str *type TSRMLS_DC)
-{
- HashTable *ht = HASH_OF(array);
- int i, count, cur_type, prev_type, different;
- zval **tmp;
-
- if (!array || Z_TYPE_P(array) != IS_ARRAY) {
- smart_str_appendl(type, "xsd:anyType", 11);
- }
-
- different = FALSE;
- cur_type = prev_type = 0;
- count = zend_hash_num_elements(ht);
-
- zend_hash_internal_pointer_reset(ht);
- for (i = 0;i < count;i++) {
- zend_hash_get_current_data(ht, (void **)&tmp);
-
- if (Z_TYPE_PP(tmp) == IS_OBJECT &&
- Z_OBJCE_PP(tmp) == soap_var_class_entry) {
- zval **ztype;
-
- if (zend_hash_find(Z_OBJPROP_PP(tmp), "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE) {
- php_error(E_ERROR, "error encoding SoapVar");
- }
- cur_type = Z_LVAL_P(*ztype);
- } else if (Z_TYPE_PP(tmp) == IS_ARRAY && is_map(*tmp)) {
- cur_type = APACHE_MAP;
- } else {
- cur_type = Z_TYPE_PP(tmp);
- }
-
- if (i > 0) {
- if (cur_type != prev_type) {
- different = TRUE;
- break;
- }
- }
-
- prev_type = cur_type;
- zend_hash_move_forward(ht);
- }
-
- if (different || count == 0) {
- smart_str_appendl(type, "xsd:anyType", 11);
- } else {
- encodePtr enc;
-
- enc = get_conversion(cur_type);
- get_type_str(node, enc->details.ns, enc->details.type_str, type);
- }
-}
-
-static void get_type_str(xmlNodePtr node, const char* ns, const char* type, smart_str* ret)
-{
- char *prefix;
- TSRMLS_FETCH();
- if (ns) {
- if (SOAP_GLOBAL(soap_version) == SOAP_1_2 &&
- strcmp(ns,SOAP_1_1_ENC_NAMESPACE) == 0) {
- ns = SOAP_1_2_ENC_NAMESPACE;
- } else if (SOAP_GLOBAL(soap_version) == SOAP_1_1 &&
- strcmp(ns,SOAP_1_2_ENC_NAMESPACE) == 0) {
- ns = SOAP_1_1_ENC_NAMESPACE;
- }
- if (zend_hash_find(SOAP_GLOBAL(defEncNs), (char*)ns, strlen(ns) + 1, (void **)&prefix) == SUCCESS) {
- smart_str_appendl(ret, prefix, strlen(prefix));
- smart_str_appendc(ret, ':');
- } else if (node != NULL) {
- xmlAttrPtr attr = node->properties;
-
- while (attr != NULL) {
- if (strncmp(attr->name,"xmlns:",sizeof("xmlns:")-1) == 0 &&
- strcmp(attr->children->content,ns) == 0) {
- break;
- }
- attr = attr->next;
- }
- if (attr == NULL) {
- smart_str* prefix = encode_new_ns();
- smart_str xmlns = {0};
-
- smart_str_appendl(&xmlns, "xmlns:", 6);
- smart_str_append(&xmlns, prefix);
- smart_str_0(&xmlns);
-
- xmlSetProp(node, xmlns.c, ns);
-
- smart_str_append(ret, prefix);
- smart_str_appendc(ret, ':');
-
- smart_str_free(&xmlns);
- smart_str_free(prefix);
- efree(prefix);
- } else {
- smart_str_appends(ret, attr->name + sizeof("xmlns:")-1);
- smart_str_appendc(ret, ':');
- }
- } else {
- php_error(E_ERROR,"Unknown namespace '%s'",ns);
- }
- }
- smart_str_appendl(ret, type, strlen(type));
- smart_str_0(ret);
-}
-
-smart_str *build_soap_action(zval *this_ptr, char *soapaction)
-{
- zval **uri;
- smart_str *tmp;
- TSRMLS_FETCH();
-
- tmp = emalloc(sizeof(smart_str));
- memset(tmp, 0, sizeof(smart_str));
-
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "uri", sizeof("uri"), (void *)&uri) == FAILURE) {
- php_error(E_ERROR, "Error finding uri");
- }
-
- smart_str_appendl(tmp, Z_STRVAL_PP(uri), Z_STRLEN_PP(uri));
- smart_str_appends(tmp, "#");
- smart_str_appendl(tmp, soapaction, strlen(soapaction));
- smart_str_0(tmp);
-
- return tmp;
-}
-
-void delete_encoder(void *encode)
-{
- encodePtr t = *((encodePtr*)encode);
- if (t->details.ns) {
- free(t->details.ns);
- }
- if (t->details.type_str) {
- free(t->details.type_str);
- }
- if (t->details.map) {
- delete_mapping(t->details.map);
- }
- free(t);
-}
diff --git a/ext/soap/php_encoding.h b/ext/soap/php_encoding.h
deleted file mode 100644
index 068861fe15..0000000000
--- a/ext/soap/php_encoding.h
+++ /dev/null
@@ -1,238 +0,0 @@
-#ifndef PHP_ENCODING_H
-#define PHP_ENCODING_H
-
-#define XSD_1999_NAMESPACE "http://www.w3.org/1999/XMLSchema"
-#define XSD_1999_TIMEINSTANT 401
-#define XSD_1999_TIMEINSTANT_STRING "timeInstant"
-
-#define SOAP_1_1_ENV_NAMESPACE "http://schemas.xmlsoap.org/soap/envelope/"
-#define SOAP_1_1_ENV_NS_PREFIX "SOAP-ENV"
-
-#define SOAP_1_2_ENV_NAMESPACE "http://www.w3.org/2003/05/soap-envelope"
-#define SOAP_1_2_ENV_NS_PREFIX "env"
-
-#define SOAP_1_1_ENC_NAMESPACE "http://schemas.xmlsoap.org/soap/encoding/"
-#define SOAP_1_1_ENC_NS_PREFIX "SOAP-ENC"
-
-#define SOAP_1_2_ENC_NAMESPACE "http://www.w3.org/2003/05/soap-encoding"
-#define SOAP_1_2_ENC_NS_PREFIX "enc"
-
-#define SCHEMA_NAMESPACE "http://www.w3.org/2001/XMLSchema"
-#define XSD_NAMESPACE "http://www.w3.org/2001/XMLSchema"
-#define XSD_NS_PREFIX "xsd"
-#define XSI_NAMESPACE "http://www.w3.org/2001/XMLSchema-instance"
-#define XSI_NS_PREFIX "xsi"
-
-#define XSD_STRING 101
-#define XSD_STRING_STRING "string"
-#define XSD_BOOLEAN 103
-#define XSD_BOOLEAN_STRING "boolean"
-#define XSD_DECIMAL 104
-#define XSD_DECIMAL_STRING "decimal"
-#define XSD_FLOAT 105
-#define XSD_FLOAT_STRING "float"
-#define XSD_DOUBLE 106
-#define XSD_DOUBLE_STRING "double"
-#define XSD_DURATION 107
-#define XSD_DURATION_STRING "duration"
-#define XSD_DATETIME 108
-#define XSD_DATETIME_STRING "dateTime"
-#define XSD_TIME 109
-#define XSD_TIME_STRING "time"
-#define XSD_DATE 110
-#define XSD_DATE_STRING "date"
-#define XSD_GYEARMONTH 111
-#define XSD_GYEARMONTH_STRING "gYearMonth"
-#define XSD_GYEAR 112
-#define XSD_GYEAR_STRING "gYear"
-#define XSD_GMONTHDAY 113
-#define XSD_GMONTHDAY_STRING "gMonthDay"
-#define XSD_GDAY 114
-#define XSD_GDAY_STRING "gDay"
-#define XSD_GMONTH 115
-#define XSD_GMONTH_STRING "gMonth"
-#define XSD_HEXBINARY 116
-#define XSD_HEXBINARY_STRING "hexBinary"
-#define XSD_BASE64BINARY 117
-#define XSD_BASE64BINARY_STRING "base64Binary"
-#define XSD_ANYURI 118
-#define XSD_ANYURI_STRING "anyURI"
-#define XSD_QNAME 119
-#define XSD_QNAME_STRING "QName"
-#define XSD_NOTATION 120
-#define XSD_NOTATION_STRING "NOTATION"
-#define XSD_NORMALIZEDSTRING 121
-#define XSD_NORMALIZEDSTRING_STRING "normalizedString"
-#define XSD_TOKEN 122
-#define XSD_TOKEN_STRING "token"
-#define XSD_LANGUAGE 123
-#define XSD_LANGUAGE_STRING "language"
-#define XSD_NMTOKEN 124
-#define XSD_NMTOKEN_STRING "NMTOKEN"
-#define XSD_NAME 124
-#define XSD_NAME_STRING "Name"
-#define XSD_NCNAME 125
-#define XSD_NCNAME_STRING "NCName"
-#define XSD_ID 126
-#define XSD_ID_STRING "ID"
-#define XSD_IDREF 127
-#define XSD_IDREF_STRING "IDREF"
-#define XSD_IDREFS 127
-#define XSD_IDREFS_STRING "IDREFS"
-#define XSD_ENTITY 128
-#define XSD_ENTITY_STRING "ENTITY"
-#define XSD_ENTITIES 129
-#define XSD_ENTITIES_STRING "ENTITYS"
-#define XSD_INTEGER 130
-#define XSD_INTEGER_STRING "integer"
-#define XSD_NONPOSITIVEINTEGER 131
-#define XSD_NONPOSITIVEINTEGER_STRING "nonPositiveInteger"
-#define XSD_NEGATIVEINTEGER 132
-#define XSD_NEGATIVEINTEGER_STRING "negativeInteger"
-#define XSD_LONG 133
-#define XSD_LONG_STRING "long"
-#define XSD_INT 134
-#define XSD_INT_STRING "int"
-#define XSD_SHORT 135
-#define XSD_SHORT_STRING "short"
-#define XSD_BYTE 136
-#define XSD_BYTE_STRING "byte"
-#define XSD_NONNEGATIVEINTEGER 137
-#define XSD_NONNEGATIVEINTEGER_STRING "nonNegativeInteger"
-#define XSD_UNSIGNEDLONG 138
-#define XSD_UNSIGNEDLONG_STRING "unsignedLong"
-#define XSD_UNSIGNEDINT 139
-#define XSD_UNSIGNEDINT_STRING "unsignedInt"
-#define XSD_UNSIGNEDSHORT 140
-#define XSD_UNSIGNEDSHORT_STRING "unsignedShort"
-#define XSD_UNSIGNEDBYTE 141
-#define XSD_UNSIGNEDBYTE_STRING "unsignedByte"
-#define XSD_POSITIVEINTEGER 142
-#define XSD_POSITIVEINTEGER_STRING "positiveInteger"
-#define XSD_ANYTYPE 143
-#define XSD_ANYTYPE_STRING "anyType"
-#define XSD_UR_TYPE 144
-#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_NS_PREFIX "apache"
-#define APACHE_MAP 200
-#define APACHE_MAP_STRING "Map"
-
-#define SOAP_ENC_ARRAY 300
-#define SOAP_ENC_ARRAY_STRING "Array"
-#define SOAP_ENC_OBJECT 301
-#define SOAP_ENC_OBJECT_STRING "Struct"
-
-#define WSDL_NAMESPACE "http://schemas.xmlsoap.org/wsdl/"
-#define WSDL_NS_PREFIX "wsdl"
-
-#define WSDL_SOAP11_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap/"
-#define WSDL_SOAP12_NAMESPACE "http://www.w3.org/2003/05/soap-rpc"
-#define WSDL_SOAP12OLD_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap12/"
-#define WSDL_SOAP_NS_PREFIX "wsdlSoap"
-
-#define WSDL_HTTP11_NAMESPACE "http://schemas.xmlsoap.org/wsdl/http/"
-#define WSDL_HTTP12_NAMESPACE "http://www.w3.org/2003/05/soap/bindings/HTTP/"
-#define WSDL_HTTP_NS_PREFIX "http"
-
-#define WSDL_HTTP_TRANSPORT "http://schemas.xmlsoap.org/soap/http"
-
-#define UNKNOWN_TYPE 999998
-#define END_KNOWN_TYPES 999999
-
-struct _encodeType {
- int type;
- char *type_str;
- char *ns;
- sdlTypePtr sdl_type;
- soapMappingPtr map;
-};
-
-struct _encode {
- encodeType details;
- zval *(*to_zval)(encodeTypePtr type, xmlNodePtr data);
- xmlNodePtr (*to_xml)(encodeTypePtr type, zval *data, int style);
-
- xmlNodePtr (*to_zval_before)(encodeTypePtr type, xmlNodePtr data, int style);
- zval *(*to_zval_after)(encodeTypePtr type, zval *data);
-
- zval *(*to_xml_before)(encodeTypePtr type, zval *data);
- xmlNodePtr (*to_xml_after)(encodeTypePtr type, xmlNodePtr data, int style);
-};
-
-smart_str *build_soap_action(zval *this_ptr, char *soapaction);
-
-/* Master functions all encode/decode should be called thur these functions */
-xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style);
-zval *master_to_zval(encodePtr encode, xmlNodePtr data);
-
-#ifdef HAVE_PHP_DOMXML
-/* user defined mapping */
-zval *to_xml_before_user(encodeTypePtr type, zval *data);
-xmlNodePtr to_xml_user(encodeTypePtr type, zval *data, int style);
-xmlNodePtr to_xml_after_user(encodeTypePtr type, xmlNodePtr node, int style);
-xmlNodePtr to_zval_before_user(encodeTypePtr type, xmlNodePtr node, int style);
-zval *to_zval_user(encodeTypePtr type, xmlNodePtr node);
-zval *to_zval_after_user(encodeTypePtr type, zval *data);
-#endif
-
-void whiteSpace_replace(char* str);
-void whiteSpace_collapse(char* str);
-
-zval *to_zval_object(encodeTypePtr type, xmlNodePtr data);
-zval *to_zval_array(encodeTypePtr type, xmlNodePtr data);
-
-xmlNodePtr to_xml_object(encodeTypePtr type, zval *data, int style);
-xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style);
-
-/* Try and guess for non-wsdl clients and servers */
-zval *guess_zval_convert(encodeTypePtr type, xmlNodePtr data);
-xmlNodePtr guess_xml_convert(encodeTypePtr type, zval *data, int style);
-
-#define get_conversion(e) get_conversion_ex(SOAP_GLOBAL(defEncIndex), e)
-#define get_conversion_from_type(n, t) get_conversion_from_type_ex(SOAP_GLOBAL(defEnc), n, t)
-#define get_conversion_from_href_type(t) get_conversion_from_href_type_ex(SOAP_GLOBAL(defEnc), t, strlen(t))
-
-void encode_reset_ns();
-smart_str *encode_new_ns();
-void set_ns_and_type(xmlNodePtr node, encodeTypePtr type);
-
-encodePtr get_conversion_ex(HashTable *encoding, int encode);
-encodePtr get_conversion_from_type_ex(HashTable *encoding, xmlNodePtr node, const char *type);
-encodePtr get_conversion_from_href_type_ex(HashTable *encoding, const char *type, int len);
-
-void delete_encoder(void *handle);
-
-extern encode defaultEncoding[];
-
-#define FIND_XML_NULL(xml,zval) \
- { \
- xmlAttrPtr null; \
- if (!xml) { \
- ZVAL_NULL(zval); \
- return zval; \
- } \
- if (xml->properties) { \
- null = get_attribute(xml->properties, "nil"); \
- if (null) { \
- ZVAL_NULL(zval); \
- return zval; \
- } \
- } \
- }
-
-#define FIND_ZVAL_NULL(zval, xml, style) \
-{ \
- if (!zval || Z_TYPE_P(zval) == IS_NULL) { \
- if (style == SOAP_ENCODED) {\
- xmlSetProp(xml, "xsi:nil", "1"); \
- }\
- return xml; \
- } \
-}
-
-
-#endif
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
deleted file mode 100644
index c7254e4280..0000000000
--- a/ext/soap/php_http.c
+++ /dev/null
@@ -1,526 +0,0 @@
-#include "php_soap.h"
-#include "ext/standard/base64.h"
-
-static char *get_http_header_value(char *headers, char *type);
-static int get_http_body(php_stream *socketd, char *headers, char **response, int *out_size TSRMLS_DC);
-static int get_http_headers(php_stream *socketd,char **response, int *out_size TSRMLS_DC);
-
-#define smart_str_append_const(str, const) \
- smart_str_appendl(str,const,sizeof(const)-1)
-
-int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *location, char *soapaction, int soap_version TSRMLS_DC)
-{
- xmlChar *buf;
- smart_str soap_headers = {0};
- int buf_size,err;
- php_url *phpurl = NULL;
- php_stream *stream;
- zval **trace, **tmp;
-
- if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) {
- return FALSE;
- }
-
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"), (void **)&tmp) == SUCCESS) {
- php_stream_from_zval_no_verify(stream,tmp);
- } else {
- stream = NULL;
- }
-
- xmlDocDumpMemory(doc, &buf, &buf_size);
- if (!buf) {
- add_soap_fault(this_ptr, "Client", "Error build soap request", NULL, NULL TSRMLS_CC);
- return FALSE;
- }
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
- Z_LVAL_PP(trace) > 0) {
- add_property_stringl(this_ptr, "__last_request", buf, buf_size, 1);
- }
-
- /* Check if keep-alive connection is still opened */
- if (stream != NULL) {
- struct timeval tv;
- tv.tv_sec = 0;
- tv.tv_usec = 1;
- php_stream_set_option(stream, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &tv);
- if (php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS, 0, NULL) != PHP_STREAM_OPTION_RETURN_OK) {
- php_stream_close(stream);
- zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
- stream = NULL;
- } else {
- tv.tv_sec = FG(default_socket_timeout);;
- tv.tv_usec = 0;
- php_stream_set_option(stream, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &tv);
- }
- }
-
- if (location != NULL && location[0] != '\000') {
- phpurl = php_url_parse(location);
- }
- if (phpurl == NULL) {
- xmlFree(buf);
- add_soap_fault(this_ptr, "Client", "Unable to parse URL", NULL, NULL TSRMLS_CC);
- return FALSE;
- }
-
- if (!stream) {
- int use_ssl;
- use_ssl = strcmp(phpurl->scheme, "https") == 0;
- if (use_ssl && php_stream_locate_url_wrapper("https://", NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) == NULL) {
- xmlFree(buf);
- php_url_free(phpurl);
- add_soap_fault(this_ptr, "Client", "SSL support not available in this build", NULL, NULL TSRMLS_CC);
- return FALSE;
- }
-
- if (phpurl->port == 0) {
- phpurl->port = use_ssl ? 443 : 80;
- }
-
-#ifdef ZEND_ENGINE_2
- {
- char *res;
- long reslen;
-
- reslen = spprintf(&res, 0, "%s://%s:%d", use_ssl ? "ssl" : "tcp", phpurl->host, phpurl->port);
-
- stream = php_stream_xport_create(res, reslen,
- ENFORCE_SAFE_MODE | REPORT_ERRORS,
- STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT,
- NULL /*persistent_id*/,
- NULL /*timeout*/,
- NULL, NULL, NULL);
-
- efree(res);
- }
-#else
- stream = php_stream_sock_open_host(phpurl->host, (unsigned short)phpurl->port, SOCK_STREAM, NULL, NULL);
- if (use_ssl) {
- if (FAILURE == php_stream_sock_ssl_activate(stream, 1)) {
- xmlFree(buf);
- php_url_free(phpurl);
- add_soap_fault(this_ptr, "Client", "SSL Connection attempt failed", NULL, NULL TSRMLS_CC);
- return FALSE;
- }
- }
-#endif
-
- if (stream) {
- php_stream_auto_cleanup(stream);
- add_property_resource(this_ptr, "httpsocket", php_stream_get_resource_id(stream));
- } else {
- xmlFree(buf);
- php_url_free(phpurl);
- add_soap_fault(this_ptr, "Client", "Could not connect to host", NULL, NULL TSRMLS_CC);
- return FALSE;
- }
- }
-
- if (stream) {
- zval **cookies, **login, **password;
-
- smart_str_append_const(&soap_headers, "POST ");
- smart_str_appends(&soap_headers, phpurl->path);
- smart_str_append_const(&soap_headers, " HTTP/1.1\r\n"
- "Host: ");
- smart_str_appends(&soap_headers, phpurl->host);
- smart_str_append_const(&soap_headers, "\r\n"
- "Connection: Keep-Alive\r\n"
-/*
- "Connection: close\r\n"
- "Accept: text/html; text/xml; text/plain\r\n"
-*/
- "User-Agent: PHP SOAP 0.1\r\n");
- if (soap_version == SOAP_1_2) {
- smart_str_append_const(&soap_headers,"Content-Type: application/soap+xml; charset=\"utf-8\"\r\n");
- } else {
- smart_str_append_const(&soap_headers,"Content-Type: text/xml; charset=\"utf-8\"\r\n");
- }
- smart_str_append_const(&soap_headers,"Content-Length: ");
- smart_str_append_long(&soap_headers, buf_size);
- smart_str_append_const(&soap_headers, "\r\n"
- "SOAPAction: \"");
- smart_str_appends(&soap_headers, soapaction);
- smart_str_append_const(&soap_headers, "\"\r\n");
-
- /* HTTP Authentication */
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login"), (void **)&login) == SUCCESS) {
- char* buf;
- int len;
-
- smart_str auth = {0};
- smart_str_appendl(&auth, Z_STRVAL_PP(login), Z_STRLEN_PP(login));
- smart_str_appendc(&auth, ':');
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password"), (void **)&password) == SUCCESS) {
- smart_str_appendl(&auth, Z_STRVAL_PP(password), Z_STRLEN_PP(password));
- }
- smart_str_0(&auth);
- buf = php_base64_encode(auth.c, auth.len, &len);
- smart_str_append_const(&soap_headers, "Authorization: Basic ");
- smart_str_appendl(&soap_headers, buf, len);
- smart_str_append_const(&soap_headers, "\r\n");
- efree(buf);
- smart_str_free(&auth);
- }
-
- /* Send cookies along with request */
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS) {
- zval **data;
- char *key;
- int i, n;
-
- n = zend_hash_num_elements(Z_ARRVAL_PP(cookies));
- if (n > 0) {
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(cookies));
- smart_str_append_const(&soap_headers, "Cookie: ");
- for (i = 0; i < n; i++) {
- zend_hash_get_current_data(Z_ARRVAL_PP(cookies), (void **)&data);
- zend_hash_get_current_key(Z_ARRVAL_PP(cookies), &key, NULL, FALSE);
-
- smart_str_appendl(&soap_headers, key, strlen(key));
- smart_str_appendc(&soap_headers, '=');
- smart_str_appendl(&soap_headers, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- smart_str_append_const(&soap_headers, ";");
- zend_hash_move_forward(Z_ARRVAL_PP(cookies));
- }
- smart_str_append_const(&soap_headers, "\r\n");
- }
- }
- smart_str_append_const(&soap_headers, "\r\n");
- smart_str_appendl(&soap_headers, buf, buf_size);
- smart_str_0(&soap_headers);
-
- err = php_stream_write(stream, soap_headers.c, soap_headers.len);
- if (err != soap_headers.len) {
- php_url_free(phpurl);
- xmlFree(buf);
- smart_str_free(&soap_headers);
- php_stream_close(stream);
- zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
- add_soap_fault(this_ptr, "Client", "Failed Sending HTTP SOAP request", NULL, NULL TSRMLS_CC);
- return FALSE;
- }
- smart_str_free(&soap_headers);
-
- }
- php_url_free(phpurl);
- xmlFree(buf);
- return TRUE;
-}
-
-int get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS_DC)
-{
- char *http_headers, *http_body, *content_type, *http_version, http_status[4], *cookie_itt;
- int http_header_size, http_body_size, http_close;
- php_stream *stream;
- zval **trace, **tmp;
- char* connection;
- int http_1_1 = 0;
-
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"), (void **)&tmp) == SUCCESS) {
- php_stream_from_zval_no_verify(stream,tmp);
- } else {
- stream = NULL;
- }
- if (stream == NULL) {
- return FALSE;
- }
-
- if (!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC)) {
- php_stream_close(stream);
- zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
- add_soap_fault(this_ptr, "Client", "Error Fetching http headers", NULL, NULL TSRMLS_CC);
- return FALSE;
- }
-
- /* Check to see what HTTP status was sent */
- http_version = get_http_header_value(http_headers,"HTTP/");
- if (http_version) {
- char *tmp;
-
- tmp = strstr(http_version," ");
-
- if (tmp != NULL) {
- tmp++;
- strncpy(http_status,tmp,4);
- http_status[3] = '\0';
- }
-
- /*
- Try and process any respsone that is xml might contain fault code
-
- Maybe try and test for some of the 300's 400's specfics but not
- right now.
-
- if (strcmp(http_status,"200"))
- {
- zval *err;
- char *http_err;
-
- MAKE_STD_ZVAL(err);
- ZVAL_STRING(err, http_body, 1);
- http_err = emalloc(strlen("HTTP request failed ()") + 4);
- sprintf(http_err, "HTTP request failed (%s)", http_status);
- add_soap_fault(thisObj, "Client", http_err, NULL, err TSRMLS_CC);
- efree(http_err);
- return;
- }*/
-
- /* Try and get headers again */
- if (!strcmp(http_status, "100")) {
- efree(http_headers);
- if (!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC)) {
- php_stream_close(stream);
- zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
- add_soap_fault(this_ptr, "Client", "Error Fetching http headers", NULL, NULL TSRMLS_CC);
- return FALSE;
- }
- }
-
- if (strncmp(http_version,"1.1", 3)) {
- http_1_1 = 1;
- }
- efree(http_version);
- }
-
- if (!get_http_body(stream, http_headers, &http_body, &http_body_size TSRMLS_CC)) {
- php_stream_close(stream);
- zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
- add_soap_fault(this_ptr, "Client", "Error Fetching http body", NULL, NULL TSRMLS_CC);
- return FALSE;
- }
-
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
- Z_LVAL_PP(trace) > 0) {
- add_property_stringl(this_ptr, "__last_response", http_body, http_body_size, 1);
- }
-
- /* See if the server requested a close */
- http_close = TRUE;
- connection = get_http_header_value(http_headers,"Connection: ");
- if (connection) {
- if (strncasecmp(connection, "Keep-Alive", sizeof("Keep-Alive")-1) == 0) {
- http_close = FALSE;
- }
- efree(connection);
- } else if (http_1_1) {
- http_close = FALSE;
- }
-
- if (http_close) {
- php_stream_close(stream);
- zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
- }
-
- /* Check and see if the server even sent a xml document */
- content_type = get_http_header_value(http_headers,"Content-Type: ");
- if (content_type) {
- char *pos = NULL;
- int cmplen;
- pos = strstr(content_type,";");
- if (pos != NULL) {
- cmplen = pos - content_type;
- } else {
- cmplen = strlen(content_type);
- }
- if (strncmp(content_type, "text/xml", cmplen) == 0 ||
- strncmp(content_type, "application/soap+xml", cmplen == 0)) {
-/*
- if (strncmp(http_body, "<?xml", 5)) {
- zval *err;
- MAKE_STD_ZVAL(err);
- ZVAL_STRINGL(err, http_body, http_body_size, 1);
- add_soap_fault(this_ptr, "Client", "Didn't recieve an xml document", NULL, err TSRMLS_CC);
- efree(content_type);
- efree(http_headers);
- efree(http_body);
- return FALSE;
- }
-*/
- }
- efree(content_type);
- }
-
- /* Grab and send back every cookie */
-
- /* Not going to worry about Path: because
- we shouldn't be changing urls so path dont
- matter too much
- */
- cookie_itt = strstr(http_headers,"Set-Cookie: ");
- while (cookie_itt) {
- char *end_pos, *cookie;
- char *eqpos, *sempos;
- smart_str name = {0}, value = {0};
- zval **cookies, *z_cookie;
-
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == FAILURE) {
- zval *tmp_cookies;
- MAKE_STD_ZVAL(tmp_cookies);
- array_init(tmp_cookies);
- zend_hash_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), &tmp_cookies, sizeof(zval *), (void **)&cookies);
- }
-
- end_pos = strstr(cookie_itt,"\r\n");
- cookie = get_http_header_value(cookie_itt,"Set-Cookie: ");
-
- eqpos = strstr(cookie, "=");
- sempos = strstr(cookie, ";");
- if (eqpos != NULL && (sempos == NULL || sempos > eqpos)) {
- int cookie_len;
-
- if (sempos != NULL) {
- cookie_len = sempos-(eqpos+1);
- } else {
- cookie_len = strlen(cookie)-(eqpos-cookie)-1;
- }
-
- smart_str_appendl(&name, cookie, eqpos - cookie);
- smart_str_0(&name);
-
- smart_str_appendl(&value, eqpos + 1, cookie_len);
- smart_str_0(&value);
-
- MAKE_STD_ZVAL(z_cookie);
- ZVAL_STRINGL(z_cookie, value.c, value.len, 1);
-
- zend_hash_update(Z_ARRVAL_PP(cookies), name.c, name.len + 1, &z_cookie, sizeof(zval *), NULL);
- }
-
- cookie_itt = strstr(cookie_itt + sizeof("Set-Cookie: "), "Set-Cookie: ");
-
- smart_str_free(&value);
- smart_str_free(&name);
- efree(cookie);
- }
-
- *buffer = http_body;
- *buffer_len = http_body_size;
- efree(http_headers);
- return TRUE;
-}
-
-static char *get_http_header_value(char *headers, char *type)
-{
- char *pos, *tmp = NULL;
- int typelen, headerslen;
-
- typelen = strlen(type);
- headerslen = strlen(headers);
-
- /* header `titles' can be lower case, or any case combination, according
- * to the various RFC's. */
- pos = headers;
- do {
- /* start of buffer or start of line */
- if (strncasecmp(pos, type, typelen) == 0) {
- char *eol;
-
- /* match */
- tmp = pos + typelen;
- eol = strstr(tmp, "\r\n");
- if (eol == NULL) {
- eol = headers + headerslen;
- }
- return estrndup(tmp, eol - tmp);
- }
-
- /* find next line */
- pos = strstr(pos, "\r\n");
- if (pos) {
- pos += 2;
- }
-
- } while (pos);
-
- return NULL;
-}
-
-static int get_http_body(php_stream *stream, char *headers, char **response, int *out_size TSRMLS_DC)
-{
- char *trans_enc, *content_length, *http_buf = NULL;
- int http_buf_size = 0;
-
- trans_enc = get_http_header_value(headers, "Transfer-Encoding: ");
- content_length = get_http_header_value(headers, "Content-Length: ");
-
- if (trans_enc && !strcmp(trans_enc, "chunked")) {
- int buf_size = 0, len_size;
- char done, chunk_size[10];
-
- done = FALSE;
- http_buf = NULL;
-
- while (!done) {
- php_stream_gets(stream, chunk_size, sizeof(chunk_size));
-
- if (sscanf(chunk_size, "%x", &buf_size) != -1) {
- http_buf = erealloc(http_buf, http_buf_size + buf_size + 1);
- len_size = 0;
-
- while (http_buf_size < buf_size) {
- len_size += php_stream_read(stream, http_buf + http_buf_size, buf_size - len_size);
- http_buf_size += len_size;
- }
-
- /* Eat up '\r' '\n' */
- php_stream_getc(stream);php_stream_getc(stream);
- }
- if (buf_size == 0) {
- done = TRUE;
- }
- }
- efree(trans_enc);
-
- if (http_buf == NULL) {
- http_buf = estrndup("", 1);
- http_buf_size = 1;
- } else {
- http_buf[http_buf_size] = '\0';
- }
-
- } else if (content_length) {
- int size;
- size = atoi(content_length);
- http_buf = emalloc(size + 1);
-
- while (http_buf_size < size) {
- http_buf_size += php_stream_read(stream, http_buf + http_buf_size, size - http_buf_size);
- }
- http_buf[size] = '\0';
- efree(content_length);
- } else {
- php_error(E_ERROR, "Don't know how to read http body, No Content-Length or chunked data");
- return FALSE;
- }
-
- (*response) = http_buf;
- (*out_size) = http_buf_size;
- return TRUE;
-}
-
-static int get_http_headers(php_stream *stream, char **response, int *out_size TSRMLS_DC)
-{
- int done = FALSE;
- smart_str tmp_response = {0};
- char headerbuf[8192];
-
- while (!done) {
- if (!php_stream_gets(stream, headerbuf, sizeof(headerbuf))) {
- break;
- }
-
- if (strcmp(headerbuf, "\r\n") == 0) {
- /* empty line marks end of headers */
- done = TRUE;
- break;
- }
-
- /* add header to collection */
- smart_str_appends(&tmp_response, headerbuf);
- }
- smart_str_0(&tmp_response);
- (*response) = tmp_response.c;
- (*out_size) = tmp_response.len;
- return done;
-}
diff --git a/ext/soap/php_http.h b/ext/soap/php_http.h
deleted file mode 100644
index 4faa0510aa..0000000000
--- a/ext/soap/php_http.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef PHP_HTTP_H
-#define PHP_HTTP_H
-
-int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *location, char *soapaction, int soap_version TSRMLS_DC);
-int get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS_DC);
-
-#endif
diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c
deleted file mode 100644
index fb37a2b080..0000000000
--- a/ext/soap/php_packet_soap.c
+++ /dev/null
@@ -1,233 +0,0 @@
-#include "php_soap.h"
-
-/* SOAP client calls this function to parse response from SOAP server */
-int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value TSRMLS_DC)
-{
- char* envelope_ns = NULL;
- xmlDocPtr response;
- xmlNodePtr trav, env, head, body, resp, cur, fault;
- int param_count = 0;
- int old_error_reporting;
-
- ZVAL_NULL(return_value);
-
- old_error_reporting = EG(error_reporting);
- EG(error_reporting) &= ~(E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
-
- /* Parse XML packet */
- response = xmlParseMemory(buffer, buffer_size);
- xmlCleanupParser();
-
- EG(error_reporting) = old_error_reporting;
-
- if (!response) {
- add_soap_fault(this_ptr, "Client", "looks like we got no XML document", NULL, NULL TSRMLS_CC);
- return FALSE;
- }
- if (xmlGetIntSubset(response) != NULL) {
- add_soap_fault(this_ptr, "Client", "DTD are not supported by SOAP", NULL, NULL TSRMLS_CC);
- return FALSE;
- }
-
- /* Get <Envelope> element */
- env = NULL;
- trav = response->children;
- while (trav != NULL) {
- if (trav->type == XML_ELEMENT_NODE) {
- if (env == NULL && node_is_equal_ex(trav,"Envelope",SOAP_1_1_ENV_NAMESPACE)) {
- env = trav;
- envelope_ns = SOAP_1_1_ENV_NAMESPACE;
- } else if (env == NULL && node_is_equal_ex(trav,"Envelope",SOAP_1_2_ENV_NAMESPACE)) {
- env = trav;
- envelope_ns = SOAP_1_2_ENV_NAMESPACE;
- } else {
- add_soap_fault(this_ptr, "Client", "looks like we got bad SOAP response\n", NULL, NULL TSRMLS_CC);
- xmlFreeDoc(response);
- return FALSE;
- }
- }
- trav = trav->next;
- }
- if (env == NULL) {
- add_soap_fault(this_ptr, "Client", "looks like we got XML without \"Envelope\" element\n", NULL, NULL TSRMLS_CC);
- xmlFreeDoc(response);
- return FALSE;
- }
-
- /* Get <Header> element */
- head = NULL;
- trav = env->children;
- while (trav != NULL && trav->type != XML_ELEMENT_NODE) {
- trav = trav->next;
- }
- if (trav != NULL && node_is_equal_ex(trav,"Header",envelope_ns)) {
- head = trav;
- trav = trav->next;
- }
-
- /* Get <Body> element */
- body = NULL;
- while (trav != NULL) {
- if (trav->type == XML_ELEMENT_NODE) {
- if (body == NULL && node_is_equal_ex(trav,"Body",envelope_ns)) {
- body = trav;
- } else {
- add_soap_fault(this_ptr, "Client", "looks like we got bad SOAP response\n", NULL, NULL TSRMLS_CC);
- xmlFreeDoc(response);
- return FALSE;
- }
- }
- trav = trav->next;
- }
- if (body == NULL) {
- add_soap_fault(this_ptr, "Client", "looks like we got \"Envelope\" without \"Body\" element\n", NULL, NULL TSRMLS_CC);
- xmlFreeDoc(response);
- return FALSE;
- }
-
- /* Check if <Body> contains <Fault> element */
- fault = get_node_ex(body->children,"Fault",envelope_ns);
- if (fault != NULL) {
- char *faultcode = NULL, *faultstring = NULL, *faultactor = NULL;
- zval *details = NULL;
- xmlNodePtr tmp;
-
- tmp = get_node(fault->children,"faultcode");
- if (tmp != NULL && tmp->children != NULL) {
- faultcode = tmp->children->content;
- }
-
- tmp = get_node(fault->children,"faultstring");
- if (tmp != NULL && tmp->children != NULL) {
- faultstring = tmp->children->content;
- }
-
- tmp = get_node(fault->children,"faultactor");
- if (tmp != NULL && tmp->children != NULL) {
- faultactor = tmp->children->content;
- }
-
- tmp = get_node(fault->children,"detail");
- if (tmp != NULL) {
- encodePtr enc;
- enc = get_conversion(UNKNOWN_TYPE);
- details = master_to_zval(enc, tmp);
- }
-
- add_soap_fault(this_ptr, faultcode, faultstring, faultactor, details TSRMLS_CC);
- xmlFreeDoc(response);
- return FALSE;
- }
-
- /* Parse content of <Body> element */
- array_init(return_value);
- resp = body->children;
- while (resp != NULL && resp->type != XML_ELEMENT_NODE) {
- resp = resp->next;
- }
- if (resp != NULL) {
- if (fn != NULL && fn->binding && fn->binding->bindingType == BINDING_SOAP) {
- /* Function has WSDL description */
- sdlParamPtr *h_param, param = NULL;
- xmlNodePtr val = NULL;
- char *name, *ns = NULL;
- zval* tmp;
- sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes;
- int res_count = zend_hash_num_elements(fn->responseParameters);
-
- zend_hash_internal_pointer_reset(fn->responseParameters);
- while (zend_hash_get_current_data(fn->responseParameters, (void **)&h_param) == SUCCESS) {
- param = (*h_param);
- if (fnb->style == SOAP_DOCUMENT) {
- name = param->encode->details.type_str;
- ns = param->encode->details.ns;
- } else {
- name = fn->responseName;
- /* ns = ? */
- }
-
- /* Get value of parameter */
- cur = get_node_ex(resp, name, ns);
- if (!cur) {
- cur = get_node(resp, name);
- /* TODO: produce warning invalid ns */
- }
- if (cur) {
- if (fnb->style == SOAP_DOCUMENT) {
- val = cur;
- } else {
- val = get_node(cur->children, param->paramName);
- if (val == NULL && res_count == 1) {
- val = get_node(cur->children, "return");
- }
- if (val == NULL && res_count == 1) {
- val = get_node(cur->children, "result");
- }
- }
- }
-
- if (!val) {
- /* TODO: may be "nil" is not OK? */
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
-/*
- add_soap_fault(this_ptr, "Client", "Can't find response data", NULL, NULL TSRMLS_CC);
- xmlFreeDoc(response);
- return FALSE;
-*/
- } else {
- /* Decoding value of parameter */
- if (param != NULL) {
- tmp = master_to_zval(param->encode, val);
- } else {
- tmp = master_to_zval(get_conversion(UNKNOWN_TYPE), val);
- }
- }
- add_assoc_zval(return_value, param->paramName, tmp);
- /*add_assoc_zval(return_value, (char*)val->name, tmp);*/
-
- param_count++;
-
- zend_hash_move_forward(fn->responseParameters);
- }
- } else {
- /* Function hasn't WSDL description */
- xmlNodePtr val;
- val = resp->children;
- while (val != NULL) {
- while (val && val->type != XML_ELEMENT_NODE) {
- val = val->next;
- }
- if (val != NULL) {
- encodePtr enc;
- zval *tmp;
- enc = get_conversion(UNKNOWN_TYPE);
- tmp = master_to_zval(enc, val);
- if (val->name) {
- add_assoc_zval(return_value, (char*)val->name, tmp);
- } else {
- add_next_index_zval(return_value, tmp);
- }
- ++param_count;
- val = val->next;
- }
- }
- }
- }
-
- if (Z_TYPE_P(return_value) == IS_ARRAY) {
- if (param_count == 0) {
- zval_dtor(return_value);
- ZVAL_NULL(return_value);
- } else if (param_count == 1) {
- zval *tmp = *(zval**)Z_ARRVAL_P(return_value)->pListHead->pData;
- tmp->refcount++;
- zval_dtor(return_value);
- *return_value = *tmp;
- FREE_ZVAL(tmp);
- }
- }
-
- xmlFreeDoc(response);
- return TRUE;
-}
diff --git a/ext/soap/php_packet_soap.h b/ext/soap/php_packet_soap.h
deleted file mode 100644
index f82f3f5364..0000000000
--- a/ext/soap/php_packet_soap.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef PHP_PACKET_SOAP_H
-#define PHP_PACKET_SOAP_H
-
-int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value TSRMLS_DC);
-
-#endif
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
deleted file mode 100644
index 192afa658d..0000000000
--- a/ext/soap/php_schema.c
+++ /dev/null
@@ -1,2122 +0,0 @@
-#include "php_soap.h"
-
-static int schema_simpleType(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr simpleType, sdlTypePtr cur_type);
-static int schema_complexType(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr compType, sdlTypePtr cur_type);
-static int schema_list(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr listType, sdlTypePtr cur_type);
-static int schema_union(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr unionType, sdlTypePtr cur_type);
-static int schema_simpleContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr simpCompType, sdlTypePtr cur_type);
-static int schema_restriction_simpleContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type, int simpleType);
-static int schema_restriction_complexContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
-static int schema_extension_simpleContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
-static int schema_extension_complexContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
-static int schema_sequence(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr seqType, sdlTypePtr cur_type, sdlContentModelPtr model);
-static int schema_all(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type, sdlContentModelPtr model);
-static int schema_choice(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr cur_type, sdlContentModelPtr model);
-static int schema_group(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr cur_type, sdlContentModelPtr model);
-static int schema_any(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type, sdlContentModelPtr model);
-static int schema_element(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr cur_type, sdlContentModelPtr model);
-static int schema_attribute(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type);
-static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type);
-
-static int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr);
-
-static int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr);
-
-static void schema_type_fixup(sdlPtr sdl, sdlTypePtr type);
-
-static void delete_model(void *handle);
-
-static int is_blank(const char* str)
-{
- while (*str != '\0') {
- if (*str != ' ' && *str != 0x9 && *str != 0xa && *str != 0xd) {
- return 0;
- }
- str++;
- }
- return 1;
-}
-
-/* removes all empty text, comments and other insignoficant nodes */
-static void schema_cleanup(xmlNodePtr schema)
-{
- xmlNodePtr trav;
- xmlNodePtr del = NULL;
-
- trav = schema->children;
- while (trav != NULL) {
- if (del != NULL) {
- xmlUnlinkNode(del);
- xmlFreeNode(del);
- del = NULL;
- }
- if (trav->type == XML_TEXT_NODE) {
- if (is_blank(trav->content)) {
- del = trav;
- }
- } else if ((trav->type != XML_ELEMENT_NODE) &&
- (trav->type != XML_CDATA_SECTION_NODE)) {
- del = trav;
- } else if (trav->children != NULL) {
- schema_cleanup(trav);
- }
- trav = trav->next;
- }
- if (del != NULL) {
- xmlUnlinkNode(del);
- xmlFreeNode(del);
- }
-}
-
-static void schema_load_file(sdlPtr sdl, xmlAttrPtr ns, xmlAttrPtr location, xmlAttrPtr tns, int import) {
- if (location != NULL &&
- !zend_hash_exists(&sdl->docs, location->children->content, strlen(location->children->content)+1)) {
- xmlDocPtr doc;
- xmlNodePtr schema;
- xmlAttrPtr new_tns;
-
- doc = xmlParseFile(location->children->content);
- xmlCleanupParser();
- if (doc == NULL) {
- php_error(E_ERROR, "Error parsing schema (can't import schema from '%s')",location->children->content);
- }
- schema = get_node(doc->children, "schema");
- if (schema == NULL) {
- xmlFreeDoc(doc);
- php_error(E_ERROR, "Error parsing schema (can't import schema from '%s')",location->children->content);
- }
- new_tns = get_attribute(schema->properties, "targetNamespace");
- if (import) {
- if (ns != NULL && (new_tns == NULL || strcmp(ns->children->content,new_tns->children->content) != 0)) {
- xmlFreeDoc(doc);
- php_error(E_ERROR, "Error parsing schema (can't import schema from '%s', unexpected 'targetNamespace'='%s')",location->children->content,new_tns->children->content);
- }
- if (ns == NULL && new_tns != NULL) {
- xmlFreeDoc(doc);
- php_error(E_ERROR, "Error parsing schema (can't import schema from '%s', unexpected 'targetNamespace'='%s')",location->children->content,new_tns->children->content);
- }
- } else {
- new_tns = get_attribute(schema->properties, "targetNamespace");
- if (new_tns == NULL) {
- if (tns != NULL) {
- xmlFreeDoc(doc);
- xmlSetProp(schema, "targetNamespace", tns->children->content);
- }
- } else if (tns != NULL && strcmp(tns->children->content,new_tns->children->content) != 0) {
- xmlFreeDoc(doc);
- php_error(E_ERROR, "Error parsing schema (can't include schema from '%s', different 'targetNamespace')",location->children->content);
- }
- }
- zend_hash_add(&sdl->docs, location->children->content, strlen(location->children->content)+1, (void**)&doc, sizeof(xmlDocPtr), NULL);
- load_schema(sdl, schema);
- }
-}
-
-/*
-2.6.1 xsi:type
-2.6.2 xsi:nil
-2.6.3 xsi:schemaLocation, xsi:noNamespaceSchemaLocation
-*/
-
-/*
-<schema
- attributeFormDefault = (qualified | unqualified) : unqualified
- blockDefault = (#all | List of (extension | restriction | substitution)) : ''
- elementFormDefault = (qualified | unqualified) : unqualified
- finalDefault = (#all | List of (extension | restriction)) : ''
- id = ID
- targetNamespace = anyURI
- version = token
- xml:lang = language
- {any attributes with non-schema namespace . . .}>
- Content: ((include | import | redefine | annotation)*, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*)
-</schema>
-*/
-int load_schema(sdlPtr sdl,xmlNodePtr schema)
-{
- xmlNodePtr trav;
- xmlAttrPtr tns;
-
- schema_cleanup(schema);
- if (!sdl->types) {
- sdl->types = malloc(sizeof(HashTable));
- zend_hash_init(sdl->types, 0, NULL, delete_type, 1);
- }
- if (!sdl->elements) {
- sdl->elements = malloc(sizeof(HashTable));
- zend_hash_init(sdl->elements, 0, NULL, delete_type, 1);
- }
-
- tns = get_attribute(schema->properties, "targetNamespace");
-
- trav = schema->children;
- while (trav != NULL) {
- if (node_is_equal(trav,"include")) {
- xmlAttrPtr location;
-
- location = get_attribute(trav->properties, "schemaLocation");
- if (location == NULL) {
- php_error(E_ERROR, "Error parsing schema (include has no 'schemaLocation' attribute)");
- } else {
- schema_load_file(sdl,NULL,location,tns,0);
- }
-
- } else if (node_is_equal(trav,"redefine")) {
- xmlAttrPtr location;
-
- location = get_attribute(trav->properties, "schemaLocation");
- if (location == NULL) {
- php_error(E_ERROR, "Error parsing schema (redefine has no 'schemaLocation' attribute)");
- } else {
- schema_load_file(sdl,NULL,location,tns,0);
- /* TODO: <redefine> support */
- }
-
- } else if (node_is_equal(trav,"import")) {
- xmlAttrPtr ns, location;
-
- ns = get_attribute(trav->properties, "namespace");
- location = get_attribute(trav->properties, "schemaLocation");
-
- if (ns != NULL && tns != NULL && strcmp(ns->children->content,tns->children->content) == 0) {
- php_error(E_ERROR, "Error parsing schema (can't import schema from '%s', namespace must not match the enclosing schema 'targetNamespace')",location->children->content);
- }
- schema_load_file(sdl,ns,location,tns,1);
- } else if (node_is_equal(trav,"annotation")) {
- /* TODO: <annotation> support */
-/* annotation cleanup
- xmlNodePtr tmp = trav;
- trav = trav->next;
- xmlUnlinkNode(tmp);
- xmlFreeNode(tmp);
- continue;
-*/
- } else {
- break;
- }
- trav = trav->next;
- }
-
- while (trav != NULL) {
- if (node_is_equal(trav,"simpleType")) {
- schema_simpleType(sdl, tns, trav, NULL);
- } else if (node_is_equal(trav,"complexType")) {
- schema_complexType(sdl, tns, trav, NULL);
- } else if (node_is_equal(trav,"group")) {
- schema_group(sdl, tns, trav, NULL, NULL);
- } else if (node_is_equal(trav,"attributeGroup")) {
- schema_attributeGroup(sdl, tns, trav, NULL);
- } else if (node_is_equal(trav,"element")) {
- schema_element(sdl, tns, trav, NULL, NULL);
- } else if (node_is_equal(trav,"attribute")) {
- schema_attribute(sdl, tns, trav, NULL);
- } else if (node_is_equal(trav,"notation")) {
- /* TODO: <notation> support */
- } else if (node_is_equal(trav,"annotation")) {
- /* TODO: <annotation> support */
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in schema)",trav->name);
- }
- trav = trav->next;
- }
- return TRUE;
-}
-
-/*
-<simpleType
- final = (#all | (list | union | restriction))
- id = ID
- name = NCName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (restriction | list | union))
-</simpleType>
-*/
-static int schema_simpleType(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr simpleType, sdlTypePtr cur_type)
-{
- xmlNodePtr trav;
- xmlAttrPtr name, ns;
-
- ns = get_attribute(simpleType->properties, "targetNamespace");
- if (ns == NULL) {
- ns = tsn;
- }
-
- name = get_attribute(simpleType->properties, "name");
- if (cur_type != NULL) {
- /* Anonymous type inside <element> or <restriction> */
- sdlTypePtr newType, *ptr;
-
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
- newType->kind = XSD_TYPEKIND_SIMPLE;
- if (name != NULL) {
- newType->name = strdup(name->children->content);
- newType->namens = strdup(ns->children->content);
- } else {
- newType->name = strdup(cur_type->name);
- newType->namens = strdup(cur_type->namens);
- }
-
- zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr);
-
- if (sdl->encoders == NULL) {
- sdl->encoders = malloc(sizeof(HashTable));
- zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, 1);
- }
- cur_type->encode = malloc(sizeof(encode));
- memset(cur_type->encode, 0, sizeof(encode));
- cur_type->encode->details.ns = strdup(newType->namens);
- cur_type->encode->details.type_str = strdup(newType->name);
- cur_type->encode->details.sdl_type = *ptr;
- cur_type->encode->to_xml = sdl_guess_convert_xml;
- cur_type->encode->to_zval = sdl_guess_convert_zval;
- zend_hash_next_index_insert(sdl->encoders, &cur_type->encode, sizeof(encodePtr), NULL);
-
- cur_type =*ptr;
-
- } else if (name != NULL) {
- sdlTypePtr newType, *ptr;
-
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
- newType->kind = XSD_TYPEKIND_SIMPLE;
- newType->name = strdup(name->children->content);
- newType->namens = strdup(ns->children->content);
-
- if (cur_type == NULL) {
- zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr);
- } else {
- if (cur_type->elements == NULL) {
- cur_type->elements = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
- }
- zend_hash_update(cur_type->elements, newType->name, strlen(newType->name)+1, &newType, sizeof(sdlTypePtr), (void **)&ptr);
- }
- cur_type = (*ptr);
-
- create_encoder(sdl, cur_type, ns->children->content, name->children->content);
- } else {
- php_error(E_ERROR, "Error parsing schema (simpleType has no 'name' attribute)");
- }
-
- trav = simpleType->children;
- if (trav != NULL && node_is_equal(trav,"annotation")) {
- /* TODO: <annotation> support */
- trav = trav->next;
- }
- if (trav != NULL) {
- if (node_is_equal(trav,"restriction")) {
- schema_restriction_simpleContent(sdl, tsn, trav, cur_type, 1);
- trav = trav->next;
- } else if (node_is_equal(trav,"list")) {
- cur_type->kind = XSD_TYPEKIND_LIST;
- schema_list(sdl, tsn, trav, cur_type);
- trav = trav->next;
- } else if (node_is_equal(trav,"union")) {
- cur_type->kind = XSD_TYPEKIND_UNION;
- schema_union(sdl, tsn, trav, cur_type);
- trav = trav->next;
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in simpleType)",trav->name);
- }
- } else {
- php_error(E_ERROR, "Error parsing schema (expected <restriction>, <list> or <union> in simpleType)");
- }
- if (trav != NULL) {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in simpleType)",trav->name);
- }
-
- return TRUE;
-}
-
-/*
-<list
- id = ID
- itemType = QName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleType?))
-</list>
-*/
-static int schema_list(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr listType, sdlTypePtr cur_type)
-{
- xmlNodePtr trav;
- xmlAttrPtr itemType;
-
- itemType = get_attribute(listType->properties, "itemType");
- if (itemType != NULL) {
- char *type, *ns;
- xmlNsPtr nsptr;
-
- parse_namespace(itemType->children->content, &type, &ns);
- nsptr = xmlSearchNs(listType->doc, listType, ns);
- if (nsptr != NULL) {
- sdlTypePtr newType, *tmp;
-
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
-
- newType->name = strdup(type);
- newType->namens = strdup(nsptr->href);
-
- newType->encode = get_create_encoder(sdl, newType, (char *)nsptr->href, type);
-
- if (cur_type->elements == NULL) {
- cur_type->elements = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
- }
- zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp);
- }
- if (type) {efree(type);}
- if (ns) {efree(ns);}
- }
-
- trav = listType->children;
- if (trav != NULL && node_is_equal(trav,"annotation")) {
- /* TODO: <annotation> support */
- trav = trav->next;
- }
- if (trav != NULL && node_is_equal(trav,"simpleType")) {
- sdlTypePtr newType, *tmp;
-
- if (itemType != NULL) {
- php_error(E_ERROR, "Error parsing schema (element have both 'itemType' attribute and subtype)");
- }
-
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
-
- newType->name = strdup("anonymous");
- newType->namens = strdup(tsn->children->content);
-
- if (cur_type->elements == NULL) {
- cur_type->elements = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
- }
- zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp);
-
- schema_simpleType(sdl, tsn, trav, newType);
- trav = trav->next;
- }
- if (trav != NULL) {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in list)",trav->name);
- }
- return TRUE;
-}
-
-/*
-<union
- id = ID
- memberTypes = List of QName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleType*))
-</union>
-*/
-static int schema_union(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr unionType, sdlTypePtr cur_type)
-{
- xmlNodePtr trav;
- xmlAttrPtr memberTypes;
-
- memberTypes = get_attribute(unionType->properties, "memberTypes");
- if (memberTypes != NULL) {
- char *str, *start, *end, *next;
- char *type, *ns;
- xmlNsPtr nsptr;
-
- str = estrdup(memberTypes->children->content);
- whiteSpace_collapse(str);
- start = str;
- while (start != NULL && *start != '\0') {
- end = strchr(start,' ');
- if (end == NULL) {
- next = NULL;
- } else {
- *end = '\0';
- next = end+1;
- }
-
- parse_namespace(start, &type, &ns);
- nsptr = xmlSearchNs(unionType->doc, unionType, ns);
- if (nsptr != NULL) {
- sdlTypePtr newType, *tmp;
-
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
-
- newType->name = strdup(type);
- newType->namens = strdup(nsptr->href);
-
- newType->encode = get_create_encoder(sdl, newType, (char *)nsptr->href, type);
-
- if (cur_type->elements == NULL) {
- cur_type->elements = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
- }
- zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp);
- }
- if (type) {efree(type);}
- if (ns) {efree(ns);}
-
- start = next;
- }
- efree(str);
- }
-
- trav = unionType->children;
- if (trav != NULL && node_is_equal(trav,"annotation")) {
- /* TODO: <annotation> support */
- trav = trav->next;
- }
- while (trav != NULL) {
- if (node_is_equal(trav,"simpleType")) {
- sdlTypePtr newType, *tmp;
-
- if (memberTypes != NULL) {
- php_error(E_ERROR, "Error parsing schema (union have both 'memberTypes' attribute and subtypes)");
- }
-
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
-
- newType->name = strdup("anonymous");
- newType->namens = strdup(tsn->children->content);
-
- if (cur_type->elements == NULL) {
- cur_type->elements = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
- }
- zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp);
-
- schema_simpleType(sdl, tsn, trav, newType);
-
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in union)",trav->name);
- }
- trav = trav->next;
- }
- if (trav != NULL) {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in union)",trav->name);
- }
- return TRUE;
-}
-
-/*
-<simpleContent
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (restriction | extension))
-</simpleContent>
-*/
-static int schema_simpleContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr simpCompType, sdlTypePtr cur_type)
-{
- xmlNodePtr trav;
-
- trav = simpCompType->children;
- if (trav != NULL && node_is_equal(trav,"annotation")) {
- /* TODO: <annotation> support */
- trav = trav->next;
- }
- if (trav != NULL) {
- if (node_is_equal(trav, "restriction")) {
- cur_type->kind = XSD_TYPEKIND_RESTRICTION;
- schema_restriction_simpleContent(sdl, tsn, trav, cur_type, 0);
- trav = trav->next;
- } else if (node_is_equal(trav, "extension")) {
- cur_type->kind = XSD_TYPEKIND_EXTENSION;
- schema_extension_simpleContent(sdl, tsn, trav, cur_type);
- trav = trav->next;
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in simpleContent)",trav->name);
- }
- } else {
- php_error(E_ERROR, "Error parsing schema (expected <restriction> or <extension> in simpleContent)");
- }
- if (trav != NULL) {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in simpleContent)",trav->name);
- }
-
- return TRUE;
-}
-
-/*
-simpleType:<restriction
- base = QName
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*)?)
-</restriction>
-simpleContent:<restriction
- base = QName
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*)?, ((attribute | attributeGroup)*, anyAttribute?))
-</restriction>
-*/
-static int schema_restriction_simpleContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type, int simpleType)
-{
- xmlNodePtr trav;
- xmlAttrPtr base;
-
- base = get_attribute(restType->properties, "base");
- if (base != NULL) {
- char *type, *ns;
- xmlNsPtr nsptr;
-
- parse_namespace(base->children->content, &type, &ns);
- nsptr = xmlSearchNs(restType->doc, restType, ns);
- if (nsptr != NULL) {
- cur_type->encode = get_create_encoder(sdl, cur_type, (char *)nsptr->href, type);
- }
- if (type) {efree(type);}
- if (ns) {efree(ns);}
- } else if (!simpleType) {
- php_error(E_ERROR, "Error parsing schema (restriction has no 'base' attribute)");
- }
-
- if (cur_type->restrictions == NULL) {
- cur_type->restrictions = malloc(sizeof(sdlRestrictions));
- memset(cur_type->restrictions, 0, sizeof(sdlRestrictions));
- }
-
- trav = restType->children;
- if (trav != NULL && node_is_equal(trav, "annotaion")) {
- /* TODO: <annotation> support */
- trav = trav->next;
- }
- if (trav != NULL && node_is_equal(trav, "simpleType")) {
- schema_simpleType(sdl, tsn, trav, cur_type);
- trav = trav->next;
- }
- while (trav != NULL) {
- if (!strcmp(trav->name, "minExclusive")) {
- schema_restriction_var_int(trav, &cur_type->restrictions->minExclusive);
- } else if (!strcmp(trav->name, "minInclusive")) {
- schema_restriction_var_int(trav, &cur_type->restrictions->minInclusive);
- } else if (!strcmp(trav->name, "maxExclusive")) {
- schema_restriction_var_int(trav, &cur_type->restrictions->maxExclusive);
- } else if (!strcmp(trav->name, "maxInclusive")) {
- schema_restriction_var_int(trav, &cur_type->restrictions->maxInclusive);
- } else if (!strcmp(trav->name, "totalDigits")) {
- schema_restriction_var_int(trav, &cur_type->restrictions->totalDigits);
- } else if (!strcmp(trav->name, "fractionDigits")) {
- schema_restriction_var_int(trav, &cur_type->restrictions->fractionDigits);
- } else if (!strcmp(trav->name, "length")) {
- schema_restriction_var_int(trav, &cur_type->restrictions->length);
- } else if (!strcmp(trav->name, "minLength")) {
- schema_restriction_var_int(trav, &cur_type->restrictions->minLength);
- } else if (!strcmp(trav->name, "maxLength")) {
- schema_restriction_var_int(trav, &cur_type->restrictions->maxLength);
- } else if (!strcmp(trav->name, "whiteSpace")) {
- schema_restriction_var_char(trav, &cur_type->restrictions->whiteSpace);
- } else if (!strcmp(trav->name, "pattern")) {
- schema_restriction_var_char(trav, &cur_type->restrictions->pattern);
- } else if (!strcmp(trav->name, "enumeration")) {
- sdlRestrictionCharPtr enumval = NULL;
-
- schema_restriction_var_char(trav, &enumval);
- if (cur_type->restrictions->enumeration == NULL) {
- cur_type->restrictions->enumeration = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->restrictions->enumeration, 0, NULL, delete_schema_restriction_var_char, 1);
- }
- zend_hash_add(cur_type->restrictions->enumeration, enumval->value, strlen(enumval->value)+1, &enumval, sizeof(sdlRestrictionCharPtr), NULL);
- } else {
- break;
- }
- trav = trav->next;
- }
- if (!simpleType) {
- while (trav != NULL) {
- if (node_is_equal(trav,"attribute")) {
- schema_attribute(sdl, tsn, trav, cur_type);
- } else if (node_is_equal(trav,"attributeGroup")) {
- schema_attributeGroup(sdl, tsn, trav, cur_type);
- } else if (node_is_equal(trav,"anyAttribute")) {
- /* TODO: <anyAttribute> support */
- trav = trav->next;
- break;
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in restriction)",trav->name);
- }
- trav = trav->next;
- }
- }
- if (trav != NULL) {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in restriction)",trav->name);
- }
-
- return TRUE;
-}
-
-/*
-<restriction
- base = QName
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))
-</restriction>
-*/
-static int schema_restriction_complexContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type)
-{
- xmlAttrPtr base;
- xmlNodePtr trav;
-
- base = get_attribute(restType->properties, "base");
- if (base != NULL) {
- char *type, *ns;
- xmlNsPtr nsptr;
-
- parse_namespace(base->children->content, &type, &ns);
- nsptr = xmlSearchNs(restType->doc, restType, ns);
- if (nsptr != NULL) {
- cur_type->encode = get_create_encoder(sdl, cur_type, (char *)nsptr->href, type);
- }
- if (type) {efree(type);}
- if (ns) {efree(ns);}
- } else {
- php_error(E_ERROR, "Error parsing schema (restriction has no 'base' attribute)");
- }
-
- trav = restType->children;
- if (trav != NULL && node_is_equal(trav,"annotation")) {
- /* TODO: <annotaion> support */
- trav = trav->next;
- }
- if (trav != NULL) {
- if (node_is_equal(trav,"group")) {
- schema_group(sdl, tsn, trav, cur_type, NULL);
- trav = trav->next;
- } else if (node_is_equal(trav,"all")) {
- schema_all(sdl, tsn, trav, cur_type, NULL);
- trav = trav->next;
- } else if (node_is_equal(trav,"choice")) {
- schema_choice(sdl, tsn, trav, cur_type, NULL);
- trav = trav->next;
- } else if (node_is_equal(trav,"sequence")) {
- schema_sequence(sdl, tsn, trav, cur_type, NULL);
- trav = trav->next;
- }
- }
- while (trav != NULL) {
- if (node_is_equal(trav,"attribute")) {
- schema_attribute(sdl, tsn, trav, cur_type);
- } else if (node_is_equal(trav,"attributeGroup")) {
- schema_attributeGroup(sdl, tsn, trav, cur_type);
- } else if (node_is_equal(trav,"anyAttribute")) {
- /* TODO: <anyAttribute> support */
- trav = trav->next;
- break;
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in restriction)",trav->name);
- }
- trav = trav->next;
- }
- if (trav != NULL) {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in restriction)",trav->name);
- }
-
- return TRUE;
-}
-
-static int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr)
-{
- xmlAttrPtr fixed, value, id;
-
- if ((*valptr) == NULL) {
- (*valptr) = malloc(sizeof(sdlRestrictionInt));
- }
- memset((*valptr), 0, sizeof(sdlRestrictionInt));
-
- fixed = get_attribute(val->properties, "fixed");
- (*valptr)->fixed = FALSE;
- if (fixed != NULL) {
- if (!strcmp(fixed->children->content, "true") ||
- !strcmp(fixed->children->content, "1"))
- (*valptr)->fixed = TRUE;
- }
-
- id = get_attribute(val->properties, "id");
- if (id != NULL) {
- (*valptr)->id = strdup(id->children->content);
- }
-
- value = get_attribute(val->properties, "value");
- if (value == NULL) {
- php_error(E_ERROR, "Error parsing wsdl (missing restriction value)");
- }
-
- (*valptr)->value = atoi(value->children->content);
-
- return TRUE;
-}
-
-static int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr)
-{
- xmlAttrPtr fixed, value, id;
-
- if ((*valptr) == NULL) {
- (*valptr) = malloc(sizeof(sdlRestrictionChar));
- }
- memset((*valptr), 0, sizeof(sdlRestrictionChar));
-
- fixed = get_attribute(val->properties, "fixed");
- (*valptr)->fixed = FALSE;
- if (fixed != NULL) {
- if (!strcmp(fixed->children->content, "true") ||
- !strcmp(fixed->children->content, "1")) {
- (*valptr)->fixed = TRUE;
- }
- }
-
- id = get_attribute(val->properties, "id");
- if (id != NULL) {
- (*valptr)->id = strdup(id->children->content);
- }
-
- value = get_attribute(val->properties, "value");
- if (value == NULL) {
- php_error(E_ERROR, "Error parsing wsdl (missing restriction value)");
- }
-
- (*valptr)->value = strdup(value->children->content);
- return TRUE;
-}
-
-/*
-From simpleContent (not supported):
-<extension
- base = QName
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?))
-</extension>
-*/
-static int schema_extension_simpleContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type)
-{
- xmlNodePtr trav;
- xmlAttrPtr base;
-
- base = get_attribute(extType->properties, "base");
- if (base != NULL) {
- char *type, *ns;
- xmlNsPtr nsptr;
-
- parse_namespace(base->children->content, &type, &ns);
- nsptr = xmlSearchNs(extType->doc, extType, ns);
- if (nsptr != NULL) {
- cur_type->encode = get_create_encoder(sdl, cur_type, (char *)nsptr->href, type);
- }
- if (type) {efree(type);}
- if (ns) {efree(ns);}
- } else {
- php_error(E_ERROR, "Error parsing schema (extension has no 'base' attribute)");
- }
-
- trav = extType->children;
- if (trav != NULL && node_is_equal(trav,"annotation")) {
- /* TODO: <annotaion> support */
- trav = trav->next;
- }
- while (trav != NULL) {
- if (node_is_equal(trav,"attribute")) {
- schema_attribute(sdl, tsn, trav, cur_type);
- } else if (node_is_equal(trav,"attributeGroup")) {
- schema_attributeGroup(sdl, tsn, trav, cur_type);
- } else if (node_is_equal(trav,"anyAttribute")) {
- /* TODO: <anyAttribute> support */
- trav = trav->next;
- break;
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in extension)",trav->name);
- }
- trav = trav->next;
- }
- if (trav != NULL) {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in extension)",trav->name);
- }
- return TRUE;
-}
-
-/*
-From complexContent:
-<extension
- base = QName
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))
-</extension>
-*/
-static int schema_extension_complexContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type)
-{
- xmlNodePtr trav;
- xmlAttrPtr base;
-
- base = get_attribute(extType->properties, "base");
- if (base != NULL) {
- char *type, *ns;
- xmlNsPtr nsptr;
-
- parse_namespace(base->children->content, &type, &ns);
- nsptr = xmlSearchNs(extType->doc, extType, ns);
- if (nsptr != NULL) {
- cur_type->encode = get_create_encoder(sdl, cur_type, (char *)nsptr->href, type);
- }
- if (type) {efree(type);}
- if (ns) {efree(ns);}
- } else {
- php_error(E_ERROR, "Error parsing schema (extension has no 'base' attribute)");
- }
-
- trav = extType->children;
- if (trav != NULL && node_is_equal(trav,"annotation")) {
- /* TODO: <annotaion> support */
- trav = trav->next;
- }
- if (trav != NULL) {
- if (node_is_equal(trav,"group")) {
- schema_group(sdl, tsn, trav, cur_type, NULL);
- trav = trav->next;
- } else if (node_is_equal(trav,"all")) {
- schema_all(sdl, tsn, trav, cur_type, NULL);
- trav = trav->next;
- } else if (node_is_equal(trav,"choice")) {
- schema_choice(sdl, tsn, trav, cur_type, NULL);
- trav = trav->next;
- } else if (node_is_equal(trav,"sequence")) {
- schema_sequence(sdl, tsn, trav, cur_type, NULL);
- trav = trav->next;
- }
- }
- while (trav != NULL) {
- if (node_is_equal(trav,"attribute")) {
- schema_attribute(sdl, tsn, trav, cur_type);
- } else if (node_is_equal(trav,"attributeGroup")) {
- schema_attributeGroup(sdl, tsn, trav, cur_type);
- } else if (node_is_equal(trav,"anyAttribute")) {
- /* TODO: <anyAttribute> support */
- trav = trav->next;
- break;
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in extension)",trav->name);
- }
- trav = trav->next;
- }
- if (trav != NULL) {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in extension)",trav->name);
- }
- return TRUE;
-}
-
-/*
-<all
- id = ID
- maxOccurs = 1 : 1
- minOccurs = (0 | 1) : 1
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, element*)
-</all>
-*/
-static int schema_all(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr all, sdlTypePtr cur_type, sdlContentModelPtr model)
-{
- xmlNodePtr trav;
- xmlAttrPtr attr;
- sdlContentModelPtr newModel;
-
- newModel = malloc(sizeof(sdlContentModel));
- newModel->kind = XSD_CONTENT_ALL;
- newModel->u.content = malloc(sizeof(HashTable));
- zend_hash_init(newModel->u.content, 0, NULL, delete_model, 1);
- if (model == NULL) {
- cur_type->model = newModel;
- } else {
- zend_hash_next_index_insert(model->u.content,&newModel,sizeof(sdlContentModelPtr), NULL);
- }
-
- newModel->min_occurs = 1;
- newModel->max_occurs = 1;
-
- attr = get_attribute(all->properties, "minOccurs");
- if (attr) {
- newModel->min_occurs = atoi(attr->children->content);
- }
-
- attr = get_attribute(all->properties, "maxOccurs");
- if (attr) {
- if (!strcmp(attr->children->content, "unbounded")) {
- newModel->max_occurs = -1;
- } else {
- newModel->max_occurs = atoi(attr->children->content);
- }
- }
-
- trav = all->children;
- if (trav != NULL && node_is_equal(trav,"annotation")) {
- /* TODO: <annotaion> support */
- trav = trav->next;
- }
- while (trav != NULL) {
- if (node_is_equal(trav,"element")) {
- schema_element(sdl, tsn, trav, cur_type, newModel);
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in all)",trav->name);
- }
- trav = trav->next;
- }
- return TRUE;
-}
-
-/*
-<group
- name = NCName
- Content: (annotation?, (all | choice | sequence))
-</group>
-<group
- name = NCName
- ref = QName>
- Content: (annotation?)
-</group>
-*/
-static int schema_group(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr cur_type, sdlContentModelPtr model)
-{
- xmlNodePtr trav;
- xmlAttrPtr attr;
- xmlAttrPtr ns, name, ref = NULL;
- sdlContentModelPtr newModel;
-
- ns = get_attribute(groupType->properties, "targetNamespace");
- if (ns == NULL) {
- ns = tsn;
- }
-
- name = get_attribute(groupType->properties, "name");
- if (name == NULL) {
- name = ref = get_attribute(groupType->properties, "ref");
- }
-
- if (name) {
- smart_str key = {0};
-
- if (ref) {
- char *type, *ns;
- xmlNsPtr nsptr;
-
- parse_namespace(ref->children->content, &type, &ns);
- nsptr = xmlSearchNs(groupType->doc, groupType, ns);
- if (nsptr != NULL) {
- smart_str_appends(&key, nsptr->href);
- smart_str_appendc(&key, ':');
- }
- smart_str_appends(&key, type);
- smart_str_0(&key);
-
- newModel = malloc(sizeof(sdlContentModel));
- newModel->kind = XSD_CONTENT_GROUP_REF;
- newModel->u.group_ref = estrdup(key.c);
-
- if (type) {efree(type);}
- if (ns) {efree(ns);}
- } else {
- newModel = malloc(sizeof(sdlContentModel));
- newModel->kind = XSD_CONTENT_SEQUENCE; /* will be redefined */
- newModel->u.content = malloc(sizeof(HashTable));
- zend_hash_init(newModel->u.content, 0, NULL, delete_model, 1);
-
- smart_str_appends(&key, ns->children->content);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, name->children->content);
- smart_str_0(&key);
- }
-
- if (cur_type == NULL) {
- sdlTypePtr newType;
-
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
-
- if (sdl->groups == NULL) {
- sdl->groups = malloc(sizeof(HashTable));
- zend_hash_init(sdl->groups, 0, NULL, delete_type, 1);
- }
- if (zend_hash_add(sdl->groups, key.c, key.len+1, (void**)&newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
- php_error(E_ERROR, "Error parsing schema (group '%s' already defined)",key.c);
- }
-
- cur_type = newType;
- }
- smart_str_free(&key);
-
- if (model == NULL) {
- cur_type->model = newModel;
- } else {
- zend_hash_next_index_insert(model->u.content, &newModel, sizeof(sdlContentModelPtr), NULL);
- }
- } else {
- php_error(E_ERROR, "Error parsing schema (group has no 'name' nor 'ref' attributes)");
- }
-
- newModel->min_occurs = 1;
- newModel->max_occurs = 1;
-
- attr = get_attribute(groupType->properties, "minOccurs");
- if (attr) {
- newModel->min_occurs = atoi(attr->children->content);
- }
-
- attr = get_attribute(groupType->properties, "maxOccurs");
- if (attr) {
- if (!strcmp(attr->children->content, "unbounded")) {
- newModel->max_occurs = -1;
- } else {
- newModel->max_occurs = atoi(attr->children->content);
- }
- }
-
- trav = groupType->children;
- if (trav != NULL && node_is_equal(trav,"annotation")) {
- /* TODO: <annotaion> support */
- trav = trav->next;
- }
- if (trav != NULL) {
- if (node_is_equal(trav,"choice")) {
- if (ref != NULL) {
- php_error(E_ERROR, "Error parsing schema (group have both 'ref' attribute and subcontent)");
- }
- newModel->kind = XSD_CONTENT_CHOICE;
- schema_choice(sdl, tsn, trav, cur_type, newModel);
- trav = trav->next;
- } else if (node_is_equal(trav,"sequence")) {
- if (ref != NULL) {
- php_error(E_ERROR, "Error parsing schema (group have both 'ref' attribute and subcontent)");
- }
- newModel->kind = XSD_CONTENT_SEQUENCE;
- schema_sequence(sdl, tsn, trav, cur_type, newModel);
- trav = trav->next;
- } else if (node_is_equal(trav,"all")) {
- if (ref != NULL) {
- php_error(E_ERROR, "Error parsing schema (group have both 'ref' attribute and subcontent)");
- }
- newModel->kind = XSD_CONTENT_ALL;
- schema_all(sdl, tsn, trav, cur_type, newModel);
- trav = trav->next;
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in group)",trav->name);
- }
- }
- if (trav != NULL) {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in group)",trav->name);
- }
- return TRUE;
-}
-/*
-<choice
- id = ID
- maxOccurs = (nonNegativeInteger | unbounded) : 1
- minOccurs = nonNegativeInteger : 1
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (element | group | choice | sequence | any)*)
-</choice>
-*/
-static int schema_choice(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr cur_type, sdlContentModelPtr model)
-{
- xmlNodePtr trav;
- xmlAttrPtr attr;
- sdlContentModelPtr newModel;
-
- newModel = malloc(sizeof(sdlContentModel));
- newModel->kind = XSD_CONTENT_CHOICE;
- newModel->u.content = malloc(sizeof(HashTable));
- zend_hash_init(newModel->u.content, 0, NULL, delete_model, 1);
- if (model == NULL) {
- cur_type->model = newModel;
- } else {
- zend_hash_next_index_insert(model->u.content,&newModel,sizeof(sdlContentModelPtr), NULL);
- }
-
- newModel->min_occurs = 1;
- newModel->max_occurs = 1;
-
- attr = get_attribute(choiceType->properties, "minOccurs");
- if (attr) {
- newModel->min_occurs = atoi(attr->children->content);
- }
-
- attr = get_attribute(choiceType->properties, "maxOccurs");
- if (attr) {
- if (!strcmp(attr->children->content, "unbounded")) {
- newModel->max_occurs = -1;
- } else {
- newModel->max_occurs = atoi(attr->children->content);
- }
- }
-
- trav = choiceType->children;
- if (trav != NULL && node_is_equal(trav,"annotation")) {
- /* TODO: <annotaion> support */
- trav = trav->next;
- }
- while (trav != NULL) {
- if (node_is_equal(trav,"element")) {
- schema_element(sdl, tsn, trav, cur_type, newModel);
- } else if (node_is_equal(trav,"group")) {
- schema_group(sdl, tsn, trav, cur_type, newModel);
- } else if (node_is_equal(trav,"choice")) {
- schema_choice(sdl, tsn, trav, cur_type, newModel);
- } else if (node_is_equal(trav,"sequence")) {
- schema_sequence(sdl, tsn, trav, cur_type, newModel);
- } else if (node_is_equal(trav,"any")) {
- schema_any(sdl, tsn, trav, cur_type, newModel);
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in choice)",trav->name);
- }
- trav = trav->next;
- }
- return TRUE;
-}
-
-/*
-<sequence
- id = ID
- maxOccurs = (nonNegativeInteger | unbounded) : 1
- minOccurs = nonNegativeInteger : 1
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (element | group | choice | sequence | any)*)
-</sequence>
-*/
-static int schema_sequence(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr seqType, sdlTypePtr cur_type, sdlContentModelPtr model)
-{
- xmlNodePtr trav;
- xmlAttrPtr attr;
- sdlContentModelPtr newModel;
-
- newModel = malloc(sizeof(sdlContentModel));
- newModel->kind = XSD_CONTENT_SEQUENCE;
- newModel->u.content = malloc(sizeof(HashTable));
- zend_hash_init(newModel->u.content, 0, NULL, delete_model, 1);
- if (model == NULL) {
- cur_type->model = newModel;
- } else {
- zend_hash_next_index_insert(model->u.content,&newModel,sizeof(sdlContentModelPtr), NULL);
- }
-
- newModel->min_occurs = 1;
- newModel->max_occurs = 1;
-
- attr = get_attribute(seqType->properties, "minOccurs");
- if (attr) {
- newModel->min_occurs = atoi(attr->children->content);
- }
-
- attr = get_attribute(seqType->properties, "maxOccurs");
- if (attr) {
- if (!strcmp(attr->children->content, "unbounded")) {
- newModel->max_occurs = -1;
- } else {
- newModel->max_occurs = atoi(attr->children->content);
- }
- }
-
- trav = seqType->children;
- if (trav != NULL && node_is_equal(trav,"annotation")) {
- /* TODO: <annotaion> support */
- trav = trav->next;
- }
- while (trav != NULL) {
- if (node_is_equal(trav,"element")) {
- schema_element(sdl, tsn, trav, cur_type, newModel);
- } else if (node_is_equal(trav,"group")) {
- schema_group(sdl, tsn, trav, cur_type, newModel);
- } else if (node_is_equal(trav,"choice")) {
- schema_choice(sdl, tsn, trav, cur_type, newModel);
- } else if (node_is_equal(trav,"sequence")) {
- schema_sequence(sdl, tsn, trav, cur_type, newModel);
- } else if (node_is_equal(trav,"any")) {
- schema_any(sdl, tsn, trav, cur_type, newModel);
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in sequence)",trav->name);
- }
- trav = trav->next;
- }
- return TRUE;
-}
-
-static int schema_any(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type, sdlContentModelPtr model)
-{
- /* TODO: <any> support */
- return TRUE;
-}
-
-/*
-<complexContent
- id = ID
- mixed = boolean
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (restriction | extension))
-</complexContent>
-*/
-static int schema_complexContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr compCont, sdlTypePtr cur_type)
-{
- xmlNodePtr trav;
-
- trav = compCont->children;
- if (trav != NULL && node_is_equal(trav,"annotation")) {
- /* TODO: <annotation> support */
- trav = trav->next;
- }
- if (trav != NULL) {
- if (node_is_equal(trav, "restriction")) {
- cur_type->kind = XSD_TYPEKIND_RESTRICTION;
- schema_restriction_complexContent(sdl, tsn, trav, cur_type);
- trav = trav->next;
- } else if (node_is_equal(trav, "extension")) {
- cur_type->kind = XSD_TYPEKIND_EXTENSION;
- schema_extension_complexContent(sdl, tsn, trav, cur_type);
- trav = trav->next;
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in complexContent)",trav->name);
- }
- } else {
- php_error(E_ERROR, "Error parsing schema (<restriction> or <extension> expected in complexContent)");
- }
- if (trav != NULL) {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in complexContent)", trav->name);
- }
-
- return TRUE;
-}
-
-/*
-<complexType
- abstract = boolean : false
- block = (#all | List of (extension | restriction))
- final = (#all | List of (extension | restriction))
- id = ID
- mixed = boolean : false
- name = NCName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))))
-</complexType>
-*/
-static int schema_complexType(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr compType, sdlTypePtr cur_type)
-{
- xmlNodePtr trav;
- xmlAttrPtr attrs, name, ns;
- TSRMLS_FETCH();
-
- attrs = compType->properties;
- ns = get_attribute(attrs, "targetNamespace");
- if (ns == NULL) {
- ns = tsn;
- }
-
- name = get_attribute(attrs, "name");
- if (cur_type != NULL) {
- /* Anonymous type inside <element> */
- sdlTypePtr newType, *ptr;
-
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
- newType->kind = XSD_TYPEKIND_COMPLEX;
- if (name != NULL) {
- newType->name = strdup(name->children->content);
- newType->namens = strdup(ns->children->content);
- } else {
- newType->name = strdup(cur_type->name);
- newType->namens = strdup(cur_type->namens);
- }
-
- zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr);
-
- if (sdl->encoders == NULL) {
- sdl->encoders = malloc(sizeof(HashTable));
- zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, 1);
- }
- cur_type->encode = malloc(sizeof(encode));
- memset(cur_type->encode, 0, sizeof(encode));
- cur_type->encode->details.ns = strdup(newType->namens);
- cur_type->encode->details.type_str = strdup(newType->name);
- cur_type->encode->details.sdl_type = *ptr;
- cur_type->encode->to_xml = sdl_guess_convert_xml;
- cur_type->encode->to_zval = sdl_guess_convert_zval;
- zend_hash_next_index_insert(sdl->encoders, &cur_type->encode, sizeof(encodePtr), NULL);
-
- cur_type =*ptr;
-
- } else if (name) {
- sdlTypePtr newType, *ptr;
-
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
- newType->kind = XSD_TYPEKIND_COMPLEX;
- newType->name = strdup(name->children->content);
- newType->namens = strdup(ns->children->content);
-
- zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr);
-
- cur_type = (*ptr);
- create_encoder(sdl, cur_type, ns->children->content, name->children->content);
- } else {
- php_error(E_ERROR, "Error parsing schema (complexType has no 'name' attribute)");
- return FALSE;
- }
-
- trav = compType->children;
- if (trav != NULL && node_is_equal(trav, "annotation")) {
- /* TODO: <annotation> support */
- trav = trav->next;
- }
- if (trav != NULL) {
- if (node_is_equal(trav,"simpleContent")) {
- schema_simpleContent(sdl, tsn, trav, cur_type);
- trav = trav->next;
- } else if (node_is_equal(trav,"complexContent")) {
- schema_complexContent(sdl, tsn, trav, cur_type);
- trav = trav->next;
- } else {
- if (node_is_equal(trav,"group")) {
- schema_group(sdl, tsn, trav, cur_type, NULL);
- trav = trav->next;
- } else if (node_is_equal(trav,"all")) {
- schema_all(sdl, tsn, trav, cur_type, NULL);
- trav = trav->next;
- } else if (node_is_equal(trav,"choice")) {
- schema_choice(sdl, tsn, trav, cur_type, NULL);
- trav = trav->next;
- } else if (node_is_equal(trav,"sequence")) {
- schema_sequence(sdl, tsn, trav, cur_type, NULL);
- trav = trav->next;
- }
- while (trav != NULL) {
- if (node_is_equal(trav,"attribute")) {
- schema_attribute(sdl, tsn, trav, cur_type);
- } else if (node_is_equal(trav,"attributeGroup")) {
- schema_attributeGroup(sdl, tsn, trav, cur_type);
- } else if (node_is_equal(trav,"anyAttribute")) {
- /* TODO: <anyAttribute> support */
- trav = trav->next;
- break;
- } else {
- php_error(E_ERROR, "Error parsing schema ---(unexpected <%s> in complexType)",trav->name);
- }
- trav = trav->next;
- }
- }
- }
- if (trav != NULL) {
- php_error(E_ERROR, "Error parsing schema +++(unexpected <%s> in complexType)",trav->name);
- }
- return TRUE;
-}
-/*
-<element
- abstract = boolean : false
- block = (#all | List of (extension | restriction | substitution))
- default = string
- final = (#all | List of (extension | restriction))
- fixed = string
- form = (qualified | unqualified)
- id = ID
- maxOccurs = (nonNegativeInteger | unbounded) : 1
- minOccurs = nonNegativeInteger : 1
- name = NCName
- nillable = boolean : false
- ref = QName
- substitutionGroup = QName
- type = QName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*))
-</element>
-*/
-static int schema_element(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr cur_type, sdlContentModelPtr model)
-{
- xmlNodePtr trav;
- xmlAttrPtr attrs, attr, ns, name, type, ref = NULL;
-
- attrs = element->properties;
- ns = get_attribute(attrs, "targetNamespace");
- if (ns == NULL) {
- ns = tsn;
- }
-
- name = get_attribute(attrs, "name");
- if (name == NULL) {
- name = ref = get_attribute(attrs, "ref");
- }
-
- if (name) {
- HashTable *addHash;
- sdlTypePtr newType;
- smart_str key = {0};
-
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
-
- if (ref) {
- smart_str nscat = {0};
- char *type, *ns;
- xmlNsPtr nsptr;
-
- parse_namespace(ref->children->content, &type, &ns);
- nsptr = xmlSearchNs(element->doc, element, ns);
- if (nsptr != NULL) {
- smart_str_appends(&nscat, nsptr->href);
- smart_str_appendc(&nscat, ':');
- newType->namens = strdup(nsptr->href);
- }
- smart_str_appends(&nscat, type);
- newType->name = strdup(type);
- smart_str_0(&nscat);
- if (type) {efree(type);}
- if (ns) {efree(ns);}
- newType->ref = estrdup(nscat.c);
- smart_str_free(&nscat);
- } else {
- newType->name = strdup(name->children->content);
- newType->namens = strdup(ns->children->content);
- }
-
- newType->nillable = FALSE;
-
- if (cur_type == NULL) {
- addHash = sdl->elements;
- smart_str_appends(&key, newType->namens);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, newType->name);
- } else {
- if (cur_type->elements == NULL) {
- cur_type->elements = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
- }
- addHash = cur_type->elements;
- smart_str_appends(&key, newType->name);
- }
-
- smart_str_0(&key);
- if (zend_hash_add(addHash, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
- php_error(E_ERROR, "Error parsing schema (element '%s' already defined)",key.c);
- }
- smart_str_free(&key);
-
- if (model != NULL) {
- sdlContentModelPtr newModel = malloc(sizeof(sdlContentModel));
-
- newModel->kind = XSD_CONTENT_ELEMENT;
- newModel->u.element = newType;
- newModel->min_occurs = 1;
- newModel->max_occurs = 1;
-
- attr = get_attribute(attrs, "maxOccurs");
- if (attr) {
- if (!strcmp(attr->children->content, "unbounded")) {
- newModel->max_occurs = -1;
- } else {
- newModel->max_occurs = atoi(attr->children->content);
- }
- }
-
- attr = get_attribute(attrs, "minOccurs");
- if (attr) {
- newModel->min_occurs = atoi(attr->children->content);
- }
-
- zend_hash_next_index_insert(model->u.content, &newModel, sizeof(sdlContentModelPtr), NULL);
- }
- cur_type = newType;
- } else {
- php_error(E_ERROR, "Error parsing schema (element has no 'name' nor 'ref' attributes)");
- }
-
- /* nillable = boolean : false */
- attrs = element->properties;
- attr = get_attribute(attrs, "nillable");
- if (attr) {
- if (!stricmp(attr->children->content, "true") ||
- !stricmp(attr->children->content, "1")) {
- cur_type->nillable = TRUE;
- } else {
- cur_type->nillable = FALSE;
- }
- } else {
- cur_type->nillable = FALSE;
- }
-
- /* type = QName */
- type = get_attribute(attrs, "type");
- if (type) {
- char *cptype, *str_ns;
- xmlNsPtr nsptr;
-
- if (ref != NULL) {
- php_error(E_ERROR, "Error parsing schema (element have both 'ref' and 'type' attributes)");
- }
- parse_namespace(type->children->content, &cptype, &str_ns);
- nsptr = xmlSearchNs(element->doc, element, str_ns);
- if (nsptr != NULL) {
- cur_type->encode = get_create_encoder(sdl, cur_type, (char *)nsptr->href, (char *)cptype);
- }
- if (str_ns) {efree(str_ns);}
- if (cptype) {efree(cptype);}
- }
-
- trav = element->children;
- if (trav != NULL && node_is_equal(trav, "annotation")) {
- /* TODO: <annotation> support */
- trav = trav->next;
- }
- if (trav != NULL) {
- if (node_is_equal(trav,"simpleType")) {
- if (ref != NULL) {
- php_error(E_ERROR, "Error parsing schema (element have both 'ref' attribute and subtype)");
- } else if (type != NULL) {
- php_error(E_ERROR, "Error parsing schema (element have both 'type' attribute and subtype)");
- }
- schema_simpleType(sdl, tsn, trav, cur_type);
- trav = trav->next;
- } else if (node_is_equal(trav,"complexType")) {
- if (ref != NULL) {
- php_error(E_ERROR, "Error parsing schema (element have both 'ref' attribute and subtype)");
- } else if (type != NULL) {
- php_error(E_ERROR, "Error parsing schema (element have both 'type' attribute and subtype)");
- }
- schema_complexType(sdl, tsn, trav, cur_type);
- trav = trav->next;
- }
- }
- while (trav != NULL) {
- if (node_is_equal(trav,"unique")) {
- /* TODO: <unique> support */
- } else if (node_is_equal(trav,"key")) {
- /* TODO: <key> support */
- } else if (node_is_equal(trav,"key")) {
- /* TODO: <keyref> support */
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in element)",trav->name);
- }
- trav = trav->next;
- }
-
- return TRUE;
-}
-
-/*
-<attribute
- default = string
- fixed = string
- form = (qualified | unqualified)
- id = ID
- name = NCName
- ref = QName
- type = QName
- use = (optional | prohibited | required) : optional
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleType?))
-</attribute>
-*/
-static int schema_attribute(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type)
-{
- sdlAttributePtr newAttr;
- xmlAttrPtr attr, name, ref = NULL, type = NULL;
- xmlNodePtr trav;
-
- name = get_attribute(attrType->properties, "name");
- if (name == NULL) {
- name = ref = get_attribute(attrType->properties, "ref");
- }
- if (name) {
- HashTable *addHash;
- smart_str key = {0};
-
- newAttr = malloc(sizeof(sdlAttribute));
- memset(newAttr, 0, sizeof(sdlAttribute));
-
- if (ref) {
- char *attr_name, *ns;
- xmlNsPtr nsptr;
-
- parse_namespace(ref->children->content, &attr_name, &ns);
- nsptr = xmlSearchNs(attrType->doc, attrType, ns);
- if (nsptr != NULL) {
- smart_str_appends(&key, nsptr->href);
- smart_str_appendc(&key, ':');
- }
- smart_str_appends(&key, attr_name);
- smart_str_0(&key);
- newAttr->ref = estrdup(key.c);
- if (attr_name) {efree(attr_name);}
- if (ns) {efree(ns);}
- } else {
- xmlAttrPtr ns;
-
- ns = get_attribute(attrType->properties, "targetNamespace");
- if (ns == NULL) {
- ns = tsn;
- }
- if (ns != NULL) {
- smart_str_appends(&key, ns->children->content);
- smart_str_appendc(&key, ':');
- }
- smart_str_appends(&key, name->children->content);
- smart_str_0(&key);
- }
-
- if (cur_type == NULL) {
- if (sdl->attributes == NULL) {
- sdl->attributes = malloc(sizeof(HashTable));
- zend_hash_init(sdl->attributes, 0, NULL, delete_attribute, 1);
- }
- addHash = sdl->attributes;
- } else {
- if (cur_type->attributes == NULL) {
- cur_type->attributes = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->attributes, 0, NULL, delete_attribute, 1);
- }
- addHash = cur_type->attributes;
- }
-
- if (zend_hash_add(addHash, key.c, key.len + 1, &newAttr, sizeof(sdlAttributePtr), NULL) != SUCCESS) {
- php_error(E_ERROR, "Error parsing schema (attribute '%s' already defined)", key.c);
- }
- smart_str_free(&key);
- } else{
- php_error(E_ERROR, "Error parsing schema (attribute has no 'name' nor 'ref' attributes)");
- }
-
- /* type = QName */
- type = get_attribute(attrType->properties, "type");
- if (type) {
- char *cptype, *str_ns;
- xmlNsPtr nsptr;
-
- if (ref != NULL) {
- php_error(E_ERROR, "Error parsing schema (attribute have both 'ref' and 'type' attributes)");
- }
- parse_namespace(type->children->content, &cptype, &str_ns);
- nsptr = xmlSearchNs(attrType->doc, attrType, str_ns);
- if (nsptr != NULL) {
- newAttr->encode = get_create_encoder(sdl, cur_type, (char *)nsptr->href, (char *)cptype);
- }
- if (str_ns) {efree(str_ns);}
- if (cptype) {efree(cptype);}
- }
-
- attr = attrType->properties;
- while (attr != NULL) {
- if (attr_is_equal_ex(attr, "default", SCHEMA_NAMESPACE)) {
- newAttr->def = strdup(attr->children->content);
- } else if (attr_is_equal_ex(attr, "fixed", SCHEMA_NAMESPACE)) {
- newAttr->fixed = strdup(attr->children->content);
- } else if (attr_is_equal_ex(attr, "form", SCHEMA_NAMESPACE)) {
- newAttr->form = strdup(attr->children->content);
- } else if (attr_is_equal_ex(attr, "id", SCHEMA_NAMESPACE)) {
- newAttr->id = strdup(attr->children->content);
- } else if (attr_is_equal_ex(attr, "name", SCHEMA_NAMESPACE)) {
- newAttr->name = strdup(attr->children->content);
- } else if (attr_is_equal_ex(attr, "ref", SCHEMA_NAMESPACE)) {
- /* already processed */
- } else if (attr_is_equal_ex(attr, "type", SCHEMA_NAMESPACE)) {
- /* already processed */
- } else if (attr_is_equal_ex(attr, "use", SCHEMA_NAMESPACE)) {
- newAttr->use = strdup(attr->children->content);
- } else {
- xmlNsPtr nsPtr = attr_find_ns(attr);
-
- if (strcmp(nsPtr->href, SCHEMA_NAMESPACE)) {
- smart_str key2 = {0};
-
- if (!newAttr->extraAttributes) {
- newAttr->extraAttributes = malloc(sizeof(HashTable));
- zend_hash_init(newAttr->extraAttributes, 0, NULL, NULL, 1);
- }
-
- smart_str_appends(&key2, nsPtr->href);
- smart_str_appendc(&key2, ':');
- smart_str_appends(&key2, attr->name);
- smart_str_0(&key2);
- zend_hash_add(newAttr->extraAttributes, key2.c, key2.len + 1, &attr, sizeof(xmlAttrPtr), NULL);
- smart_str_free(&key2);
- }
- }
- attr = attr->next;
- }
-
- trav = attrType->children;
- if (trav != NULL && node_is_equal(trav, "annotation")) {
- /* TODO: <annotation> support */
- trav = trav->next;
- }
- if (trav != NULL) {
- if (node_is_equal(trav,"simpleType")) {
- sdlTypePtr dummy_type;
- if (ref != NULL) {
- php_error(E_ERROR, "Error parsing schema (attribute have both 'ref' attribute and subtype)");
- } else if (type != NULL) {
- php_error(E_ERROR, "Error parsing schema (attribute have both 'type' attribute and subtype)");
- }
- dummy_type = malloc(sizeof(sdlType));
- memset(dummy_type, 0, sizeof(sdlType));
- dummy_type->name = strdup("anonymous");
- dummy_type->namens = strdup(tsn->children->content);
- schema_simpleType(sdl, tsn, trav, dummy_type);
- newAttr->encode = dummy_type->encode;
- delete_type(&dummy_type);
- trav = trav->next;
- }
- }
- if (trav != NULL) {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in attribute)",trav->name);
- }
- return TRUE;
-}
-
-static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrGroup, sdlTypePtr cur_type)
-{
- xmlNodePtr trav;
- xmlAttrPtr name, ref = NULL;
-
-
- name = get_attribute(attrGroup->properties, "name");
- if (name == NULL) {
- name = ref = get_attribute(attrGroup->properties, "ref");
- }
- if (name) {
- if (cur_type == NULL) {
- xmlAttrPtr ns;
- sdlTypePtr newType;
- smart_str key = {0};
-
- if (sdl->attributeGroups == NULL) {
- sdl->attributeGroups = malloc(sizeof(HashTable));
- zend_hash_init(sdl->attributeGroups, 0, NULL, delete_type, 1);
- }
-
- ns = get_attribute(attrGroup->properties, "targetNamespace");
- if (ns == NULL) {
- ns = tsn;
- }
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
- newType->name = strdup(name->children->content);
- newType->namens = strdup(ns->children->content);
-
- smart_str_appends(&key, newType->namens);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, newType->name);
- smart_str_0(&key);
-
- if (zend_hash_add(sdl->attributeGroups, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
- php_error(E_ERROR, "Error parsing schema (attributeGroup '%s' already defined)", key.c);
- }
- cur_type = newType;
- smart_str_free(&key);
- } else if (ref) {
- sdlAttributePtr newAttr;
- char *group_name, *ns;
- smart_str key = {0};
- xmlNsPtr nsptr;
-
- if (cur_type->attributes == NULL) {
- cur_type->attributes = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->attributes, 0, NULL, delete_attribute, 1);
- }
- newAttr = malloc(sizeof(sdlAttribute));
- memset(newAttr, 0, sizeof(sdlAttribute));
-
- parse_namespace(ref->children->content, &group_name, &ns);
- nsptr = xmlSearchNs(attrGroup->doc, attrGroup, ns);
- if (nsptr != NULL) {
- smart_str_appends(&key, nsptr->href);
- smart_str_appendc(&key, ':');
- }
- smart_str_appends(&key, group_name);
- smart_str_0(&key);
- newAttr->ref = estrdup(key.c);
- if (group_name) {efree(group_name);}
- if (ns) {efree(ns);}
- smart_str_free(&key);
-
- zend_hash_next_index_insert(cur_type->attributes, &newAttr, sizeof(sdlAttributePtr), NULL);
- cur_type = NULL;
- }
- } else{
- php_error(E_ERROR, "Error parsing schema (attributeGroup has no 'name' nor 'ref' attributes)");
- }
-
- trav = attrGroup->children;
- while (trav != NULL) {
- if (node_is_equal(trav,"attribute")) {
- if (ref != NULL) {
- php_error(E_ERROR, "Error parsing schema (attributeGroup have both 'ref' attribute and subattribute)");
- }
- schema_attribute(sdl, tsn, trav, cur_type);
- } else if (node_is_equal(trav,"attributeGroup")) {
- if (ref != NULL) {
- php_error(E_ERROR, "Error parsing schema (attributeGroup have both 'ref' attribute and subattribute)");
- }
- schema_attributeGroup(sdl, tsn, trav, cur_type);
- } else if (node_is_equal(trav,"anyAttribute")) {
- if (ref != NULL) {
- php_error(E_ERROR, "Error parsing schema (attributeGroup have both 'ref' attribute and subattribute)");
- }
- /* TODO: <anyAttribute> support */
- trav = trav->next;
- break;
- } else {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in attributeGroup)",trav->name);
- }
- trav = trav->next;
- }
- if (trav != NULL) {
- php_error(E_ERROR, "Error parsing schema (unexpected <%s> in attributeGroup)",trav->name);
- }
- return TRUE;
-}
-
-static void schema_attribute_fixup(sdlPtr sdl, sdlAttributePtr attr)
-{
- sdlAttributePtr *tmp;
-
- if (attr->ref != NULL) {
- if (sdl->attributes != NULL) {
- if (zend_hash_find(sdl->attributes, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) {
- schema_attribute_fixup(sdl, *tmp);
- if ((*tmp)->name != NULL && attr->name == NULL) {
- attr->name = strdup((*tmp)->name);
- }
- if ((*tmp)->def != NULL && attr->def == NULL) {
- attr->def = strdup((*tmp)->def);
- }
- if ((*tmp)->fixed != NULL && attr->fixed == NULL) {
- attr->fixed = strdup((*tmp)->fixed);
- }
- if ((*tmp)->form != NULL && attr->form == NULL) {
- attr->form = strdup((*tmp)->form);
- }
- if ((*tmp)->use != NULL && attr->use == NULL) {
- attr->use = strdup((*tmp)->use);
- }
- if ((*tmp)->extraAttributes != NULL) {
- xmlNodePtr node;
-
- attr->extraAttributes = malloc(sizeof(HashTable));
-
- zend_hash_init(attr->extraAttributes, 0, NULL, NULL, 1);
- zend_hash_copy(attr->extraAttributes, (*tmp)->extraAttributes, NULL, &node, sizeof(xmlNodePtr));
- }
- attr->encode = (*tmp)->encode;
- }
- }
- efree(attr->ref);
- attr->ref = NULL;
- }
-}
-
-static void schema_attributegroup_fixup(sdlPtr sdl, sdlAttributePtr attr, HashTable *ht)
-{
- sdlTypePtr *tmp;
- sdlAttributePtr *tmp_attr;
-
- if (attr->ref != NULL) {
- if (sdl->attributeGroups != NULL) {
- if (zend_hash_find(sdl->attributeGroups, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) {
- if ((*tmp)->attributes) {
- zend_hash_internal_pointer_reset((*tmp)->attributes);
- while (zend_hash_get_current_data((*tmp)->attributes,(void**)&tmp_attr) == SUCCESS) {
- if (zend_hash_get_current_key_type((*tmp)->attributes) == HASH_KEY_IS_STRING) {
- char* key;
- uint key_len;
- sdlAttributePtr newAttr;
-
- schema_attribute_fixup(sdl,*tmp_attr);
-
- newAttr = malloc(sizeof(sdlAttribute));
- memcpy(newAttr, *tmp_attr, sizeof(sdlAttribute));
- if (newAttr->def) {newAttr->def = strdup(newAttr->def);}
- if (newAttr->fixed) {newAttr->fixed = strdup(newAttr->fixed);}
- if (newAttr->form) {newAttr->form = strdup(newAttr->form);}
- if (newAttr->name) {newAttr->name = strdup(newAttr->name);}
- if (newAttr->use) {newAttr->use = strdup(newAttr->use);}
- if (newAttr->extraAttributes) {
- xmlNodePtr node;
- HashTable *ht = malloc(sizeof(HashTable));
-
- zend_hash_init(ht, 0, NULL, NULL, 1);
- zend_hash_copy(ht, newAttr->extraAttributes, NULL, &node, sizeof(xmlNodePtr));
- newAttr->extraAttributes = ht;
- }
-
- zend_hash_get_current_key_ex((*tmp)->attributes, &key, &key_len, NULL, 0, NULL);
- zend_hash_add(ht, key, key_len, &newAttr, sizeof(sdlAttributePtr), NULL);
-
- zend_hash_move_forward((*tmp)->attributes);
- } else {
- ulong index;
-
- schema_attributegroup_fixup(sdl,*tmp_attr, ht);
- zend_hash_get_current_key((*tmp)->attributes, NULL, &index, 0);
- zend_hash_index_del((*tmp)->attributes, index);
- }
- }
- }
- }
- }
- efree(attr->ref);
- attr->ref = NULL;
- }
-}
-
-static void schema_content_model_fixup(sdlPtr sdl, sdlContentModelPtr model)
-{
- switch (model->kind) {
- case XSD_CONTENT_GROUP_REF: {
- sdlTypePtr *tmp;
-
- if (sdl->groups && zend_hash_find(sdl->groups, model->u.group_ref, strlen(model->u.group_ref)+1, (void**)&tmp) == SUCCESS) {
- schema_type_fixup(sdl,*tmp);
- efree(model->u.group_ref);
- model->kind = XSD_CONTENT_GROUP;
- model->u.group = (*tmp)->model;
- } else {
- php_error(E_ERROR, "Error parsing schema (unresolved group 'ref' attribute)");
- }
- break;
- }
- case XSD_CONTENT_SEQUENCE:
- case XSD_CONTENT_ALL:
- case XSD_CONTENT_CHOICE: {
- sdlContentModelPtr *tmp;
-
- zend_hash_internal_pointer_reset(model->u.content);
- while (zend_hash_get_current_data(model->u.content, (void**)&tmp) == SUCCESS) {
- schema_content_model_fixup(sdl, *tmp);
- zend_hash_move_forward(model->u.content);
- }
- break;
- }
- default:
- break;
- }
-}
-
-static void schema_type_fixup(sdlPtr sdl, sdlTypePtr type)
-{
- sdlTypePtr *tmp;
- sdlAttributePtr *attr;
-
- if (type->ref != NULL) {
- if (sdl->elements != NULL) {
- if (zend_hash_find(sdl->elements, type->ref, strlen(type->ref)+1, (void**)&tmp) == SUCCESS) {
- type->encode = (*tmp)->encode;
- /* TODO: nillable */
- } else {
- php_error(E_ERROR, "Error parsing schema (unresolved element 'ref' attribute)");
- }
- }
- efree(type->ref);
- type->ref = NULL;
- }
- if (type->elements) {
- zend_hash_internal_pointer_reset(type->elements);
- while (zend_hash_get_current_data(type->elements,(void**)&tmp) == SUCCESS) {
- schema_type_fixup(sdl,*tmp);
- zend_hash_move_forward(type->elements);
- }
- }
- if (type->model) {
- schema_content_model_fixup(sdl, type->model);
- }
- if (type->attributes) {
- zend_hash_internal_pointer_reset(type->attributes);
- while (zend_hash_get_current_data(type->attributes,(void**)&attr) == SUCCESS) {
- if (zend_hash_get_current_key_type(type->attributes) == HASH_KEY_IS_STRING) {
- schema_attribute_fixup(sdl,*attr);
- zend_hash_move_forward(type->attributes);
- } else {
- ulong index;
-
- schema_attributegroup_fixup(sdl,*attr,type->attributes);
- zend_hash_get_current_key(type->attributes, NULL, &index, 0);
- zend_hash_index_del(type->attributes, index);
- }
- }
- }
-}
-
-int schema_pass2(sdlPtr sdl)
-{
- sdlAttributePtr *attr;
- sdlTypePtr *type;
-
- if (sdl->attributes) {
- zend_hash_internal_pointer_reset(sdl->attributes);
- while (zend_hash_get_current_data(sdl->attributes,(void**)&attr) == SUCCESS) {
- schema_attribute_fixup(sdl,*attr);
- zend_hash_move_forward(sdl->attributes);
- }
- }
- if (sdl->attributeGroups) {
- zend_hash_internal_pointer_reset(sdl->attributeGroups);
- while (zend_hash_get_current_data(sdl->attributeGroups,(void**)&type) == SUCCESS) {
- schema_type_fixup(sdl,*type);
- zend_hash_move_forward(sdl->attributeGroups);
- }
- }
- if (sdl->elements) {
- zend_hash_internal_pointer_reset(sdl->elements);
- while (zend_hash_get_current_data(sdl->elements,(void**)&type) == SUCCESS) {
- schema_type_fixup(sdl,*type);
- zend_hash_move_forward(sdl->elements);
- }
- }
- if (sdl->groups) {
- zend_hash_internal_pointer_reset(sdl->groups);
- while (zend_hash_get_current_data(sdl->groups,(void**)&type) == SUCCESS) {
- schema_type_fixup(sdl,*type);
- zend_hash_move_forward(sdl->groups);
- }
- }
- if (sdl->types) {
- zend_hash_internal_pointer_reset(sdl->types);
- while (zend_hash_get_current_data(sdl->types,(void**)&type) == SUCCESS) {
- schema_type_fixup(sdl,*type);
- zend_hash_move_forward(sdl->types);
- }
- }
- return TRUE;
-}
-
-int schema_pass3(sdlPtr sdl)
-{
- if (sdl->elements) {
- zend_hash_destroy(sdl->elements);
- free(sdl->elements);
- sdl->elements = NULL;
- }
- if (sdl->attributes) {
- zend_hash_destroy(sdl->attributes);
- free(sdl->attributes);
- sdl->attributes = NULL;
- }
- if (sdl->attributeGroups) {
- zend_hash_destroy(sdl->attributeGroups);
- free(sdl->attributeGroups);
- sdl->attributeGroups = NULL;
- }
- return TRUE;
-}
-
-static void delete_model(void *handle)
-{
- sdlContentModelPtr tmp = *((sdlContentModelPtr*)handle);
- switch (tmp->kind) {
- case XSD_CONTENT_ELEMENT:
- case XSD_CONTENT_GROUP:
- break;
- case XSD_CONTENT_SEQUENCE:
- case XSD_CONTENT_ALL:
- case XSD_CONTENT_CHOICE:
- zend_hash_destroy(tmp->u.content);
- free(tmp->u.content);
- break;
- case XSD_CONTENT_GROUP_REF:
- efree(tmp->u.group_ref);
- break;
- }
- free(tmp);
-}
diff --git a/ext/soap/php_schema.h b/ext/soap/php_schema.h
deleted file mode 100644
index c34b2e06f9..0000000000
--- a/ext/soap/php_schema.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef PHP_SCHEMA_H
-#define PHP_SCHEMA_H
-
-int load_schema(sdlPtr sdl, xmlNodePtr schema);
-int schema_pass2(sdlPtr sdl);
-int schema_pass3(sdlPtr sdl);
-
-#endif
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
deleted file mode 100644
index 30ca6383b5..0000000000
--- a/ext/soap/php_sdl.c
+++ /dev/null
@@ -1,1222 +0,0 @@
-#include "php_soap.h"
-
-typedef struct sdlCtx {
- sdlPtr root;
- HashTable messages;
- HashTable bindings;
- HashTable portTypes;
- HashTable services;
-} sdlCtx;
-
-static void delete_binding(void *binding);
-static void delete_function(void *function);
-static void delete_paramater(void *paramater);
-static void delete_document(void *doc_ptr);
-
-encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, const char *type)
-{
- encodePtr enc = NULL;
- TSRMLS_FETCH();
-
- enc = get_conversion_from_type(data, type);
- if (enc == NULL && sdl) {
- enc = get_conversion_from_type_ex(sdl->encoders, data, type);
- }
- if (enc == NULL) {
- enc = get_conversion(UNKNOWN_TYPE);
- }
- return enc;
-}
-
-static encodePtr get_encoder_from_element(sdlPtr sdl, xmlNodePtr node, const char *type)
-{
- encodePtr enc = NULL;
- TSRMLS_FETCH();
-
- if (sdl && sdl->elements) {
- xmlNsPtr nsptr;
- char *ns, *cptype;
- sdlTypePtr *sdl_type;
-
- parse_namespace(type, &cptype, &ns);
- nsptr = xmlSearchNs(node->doc, node, ns);
- if (nsptr != NULL) {
- smart_str nscat = {0};
-
- smart_str_appends(&nscat, nsptr->href);
- smart_str_appendc(&nscat, ':');
- smart_str_appends(&nscat, cptype);
- smart_str_0(&nscat);
-
- if (zend_hash_find(sdl->elements, nscat.c, nscat.len + 1, (void **)&sdl_type) == SUCCESS) {
- enc = (*sdl_type)->encode;
- } else if (zend_hash_find(sdl->elements, (char*)type, strlen(type) + 1, (void **)&sdl_type) == SUCCESS) {
- enc = (*sdl_type)->encode;
- }
- smart_str_free(&nscat);
- } else {
- if (zend_hash_find(sdl->elements, (char*)type, strlen(type) + 1, (void **)&sdl_type) == SUCCESS) {
- enc = (*sdl_type)->encode;
- }
- }
-
- if (cptype) {efree(cptype);}
- if (ns) {efree(ns);}
- }
- if (enc == NULL) {
- enc = get_conversion(UNKNOWN_TYPE);
- }
- return enc;
-}
-
-encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type)
-{
- encodePtr enc = NULL;
- char *nscat;
-
- nscat = emalloc(strlen(ns) + strlen(type) + 2);
- sprintf(nscat, "%s:%s", ns, type);
-
- enc = get_encoder_ex(sdl, nscat);
-
- efree(nscat);
- return enc;
-}
-
-encodePtr get_encoder_ex(sdlPtr sdl, const char *nscat)
-{
- encodePtr enc = NULL;
- TSRMLS_FETCH();
-
- enc = get_conversion_from_href_type(nscat);
- if (enc == NULL && sdl) {
- enc = get_conversion_from_href_type_ex(sdl->encoders, nscat, strlen(nscat));
- }
- if (enc == NULL) {
- enc = get_conversion(UNKNOWN_TYPE);
- }
- return enc;
-}
-
-encodePtr get_create_encoder(sdlPtr sdl, sdlTypePtr cur_type, const char *ns, const char *type)
-{
- encodePtr enc = NULL;
- smart_str nscat = {0};
- TSRMLS_FETCH();
-
- smart_str_appends(&nscat, ns);
- smart_str_appendc(&nscat, ':');
- smart_str_appends(&nscat, type);
- smart_str_0(&nscat);
-
- enc = get_conversion_from_href_type(nscat.c);
- if (enc == NULL) {
- enc = get_conversion_from_href_type_ex(sdl->encoders, nscat.c, nscat.len);
- }
- if (enc == NULL) {
- enc = create_encoder(sdl, cur_type, ns, type);
- }
-
- smart_str_free(&nscat);
- return enc;
-}
-
-encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, const char *ns, const char *type)
-{
- smart_str nscat = {0};
- encodePtr enc, *enc_ptr;
-
- if (sdl->encoders == NULL) {
- sdl->encoders = malloc(sizeof(HashTable));
- zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, 1);
- }
- smart_str_appends(&nscat, ns);
- smart_str_appendc(&nscat, ':');
- smart_str_appends(&nscat, type);
- smart_str_0(&nscat);
- if (zend_hash_find(sdl->encoders, nscat.c, nscat.len + 1, (void**)&enc_ptr) == SUCCESS) {
- enc = *enc_ptr;
- if (enc->details.ns) {
- free(enc->details.ns);
- }
- if (enc->details.type_str) {
- free(enc->details.type_str);
- }
- } else {
- enc_ptr = NULL;
- enc = malloc(sizeof(encode));
- }
- memset(enc, 0, sizeof(encode));
-
- enc->details.ns = strdup(ns);
- enc->details.type_str = strdup(type);
- enc->details.sdl_type = cur_type;
- enc->to_xml = sdl_guess_convert_xml;
- enc->to_zval = sdl_guess_convert_zval;
-
- if (enc_ptr == NULL) {
- zend_hash_update(sdl->encoders, nscat.c, nscat.len + 1, &enc, sizeof(encodePtr), NULL);
- }
- smart_str_free(&nscat);
- return enc;
-}
-
-static zval* to_zval_list(encodeTypePtr enc, xmlNodePtr data) {
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
- if (data && data->children) {
- if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
- whiteSpace_collapse(data->children->content);
- ZVAL_STRING(ret, data->children->content, 1);
- } else {
- php_error(E_ERROR,"Violation of encoding rules");
- }
- } else {
- ZVAL_EMPTY_STRING(ret);
- }
- return ret;
-}
-
-static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style) {
- xmlNodePtr ret;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret, style);
- if (Z_TYPE_P(data) == IS_ARRAY) {
- zval **tmp;
- smart_str list = {0};
- HashTable *ht = Z_ARRVAL_P(data);
-
- zend_hash_internal_pointer_reset(ht);
- while (zend_hash_get_current_data(ht, (void**)&tmp) == SUCCESS) {
- if (list.len != 0) {
- smart_str_appendc(&list, ' ');
- }
- if (Z_TYPE_PP(tmp) == IS_STRING) {
- smart_str_appendl(&list, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
- } else {
- zval copy = **tmp;
- zval_copy_ctor(&copy);
- convert_to_string(&copy);
- smart_str_appendl(&list, Z_STRVAL(copy), Z_STRLEN(copy));
- zval_dtor(&copy);
- }
- zend_hash_move_forward(ht);
- }
- smart_str_0(&list);
- xmlNodeSetContentLen(ret, list.c, list.len);
- smart_str_free(&list);
- } else if (Z_TYPE_P(data) == IS_STRING) {
- xmlNodeSetContentLen(ret, Z_STRVAL_P(data), Z_STRLEN_P(data));
- } else {
- zval tmp = *data;
-
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- xmlNodeSetContentLen(ret, Z_STRVAL(tmp), Z_STRLEN(tmp));
- zval_dtor(&tmp);
- }
- return ret;
-}
-
-static zval* to_zval_union(encodeTypePtr enc, xmlNodePtr data) {
- /*FIXME*/
- return to_zval_list(enc, data);
-}
-
-static xmlNodePtr to_xml_union(encodeTypePtr enc, zval *data, int style) {
- /*FIXME*/
- return to_xml_list(enc,data,style);
-}
-
-zval *sdl_guess_convert_zval(encodeTypePtr enc, xmlNodePtr data)
-{
- sdlTypePtr type;
-
- type = enc->sdl_type;
-
- if (type && type->restrictions &&
- data && data->children && data->children->content) {
- if (type->restrictions->whiteSpace && type->restrictions->whiteSpace->value) {
- if (strcmp(type->restrictions->whiteSpace->value,"replace") == 0) {
- whiteSpace_replace(data->children->content);
- } else if (strcmp(type->restrictions->whiteSpace->value,"collapse") == 0) {
- whiteSpace_collapse(data->children->content);
- }
- }
- if (type->restrictions->enumeration) {
- if (!zend_hash_exists(type->restrictions->enumeration,data->children->content,strlen(data->children->content)+1)) {
- php_error(E_WARNING,"Restriction: invalid enumeration value \"%s\"",data->children->content);
- }
- }
- if (type->restrictions->minLength &&
- strlen(data->children->content) < type->restrictions->minLength->value) {
- php_error(E_WARNING,"Restriction: length less then 'minLength'");
- }
- if (type->restrictions->maxLength &&
- strlen(data->children->content) > type->restrictions->maxLength->value) {
- php_error(E_WARNING,"Restriction: length greater then 'maxLength'");
- }
- if (type->restrictions->length &&
- strlen(data->children->content) != type->restrictions->length->value) {
- php_error(E_WARNING,"Restriction: length is not equal to 'length'");
- }
- }
- switch (type->kind) {
- case XSD_TYPEKIND_SIMPLE:
- if (type->encode && enc != &type->encode->details) {
- return master_to_zval(type->encode, data);
- }
- break;
- case XSD_TYPEKIND_LIST:
- return to_zval_list(enc, data);
- case XSD_TYPEKIND_UNION:
- return to_zval_union(enc, data);
- case XSD_TYPEKIND_COMPLEX:
- case XSD_TYPEKIND_RESTRICTION:
- case XSD_TYPEKIND_EXTENSION:
- if (type->encode &&
- (type->encode->details.type == IS_ARRAY ||
- type->encode->details.type == SOAP_ENC_ARRAY)) {
- return to_zval_array(enc, data);
- }
- return to_zval_object(enc, data);
- default:
- break;
- }
- return guess_zval_convert(enc, data);
-}
-
-xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval *data, int style)
-{
- sdlTypePtr type;
- xmlNodePtr ret = NULL;
-
- type = enc->sdl_type;
-
- if (type) {
- if (type->restrictions && Z_TYPE_P(data) == IS_STRING) {
- if (type->restrictions->enumeration) {
- if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRLEN_P(data)+1)) {
- php_error(E_WARNING,"Restriction: invalid enumeration value \"%s\".",Z_STRVAL_P(data));
- }
- }
- if (type->restrictions->minLength &&
- Z_STRLEN_P(data) < type->restrictions->minLength->value) {
- php_error(E_WARNING,"Restriction: length less then 'minLength'");
- }
- if (type->restrictions->maxLength &&
- Z_STRLEN_P(data) > type->restrictions->maxLength->value) {
- php_error(E_WARNING,"Restriction: length greater then 'maxLength'");
- }
- if (type->restrictions->length &&
- Z_STRLEN_P(data) != type->restrictions->length->value) {
- php_error(E_WARNING,"Restriction: length is not equal to 'length'");
- }
- }
- }
- switch(type->kind) {
- case XSD_TYPEKIND_SIMPLE:
- if (type->encode && enc != &type->encode->details) {
- ret = master_to_xml(type->encode, data, style);
- }
- break;
- case XSD_TYPEKIND_LIST:
- ret = to_xml_list(enc, data, style);
- break;
- case XSD_TYPEKIND_UNION:
- ret = to_xml_union(enc, data, style);
- break;
- case XSD_TYPEKIND_COMPLEX:
- case XSD_TYPEKIND_RESTRICTION:
- case XSD_TYPEKIND_EXTENSION:
- if (type->encode &&
- (type->encode->details.type == IS_ARRAY ||
- type->encode->details.type == SOAP_ENC_ARRAY)) {
- ret = to_xml_array(enc, data, style);
- } else {
- ret = to_xml_object(enc, data, style);
- }
- break;
- default:
- break;
- }
- if (ret == NULL) {
- ret = guess_xml_convert(enc, data, style);
- }
- if (style == SOAP_ENCODED) {
- set_ns_and_type(ret, enc);
- }
- return ret;
-}
-
-sdlBindingPtr get_binding_from_type(sdlPtr sdl, int type)
-{
- sdlBindingPtr *binding;
-
- if (sdl == NULL) {
- return NULL;
- }
-
- for (zend_hash_internal_pointer_reset(sdl->bindings);
- zend_hash_get_current_data(sdl->bindings, (void **) &binding) == SUCCESS;
- zend_hash_move_forward(sdl->bindings)) {
- if ((*binding)->bindingType == type) {
- return *binding;
- }
- }
- return NULL;
-}
-
-sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns)
-{
- sdlBindingPtr binding = NULL;
- smart_str key = {0};
-
- smart_str_appends(&key, ns);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, name);
- smart_str_0(&key);
-
- zend_hash_find(sdl->bindings, key.c, key.len, (void **)&binding);
-
- smart_str_free(&key);
- return binding;
-}
-
-static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include)
-{
- sdlPtr tmpsdl = ctx->root;
- xmlDocPtr wsdl;
- xmlNodePtr root, definitions, trav;
- xmlAttrPtr targetNamespace;
- int old_error_reporting;
- TSRMLS_FETCH();
-
- if (zend_hash_exists(&tmpsdl->docs, struri, strlen(struri)+1)) {
- return;
- }
-
- /* TODO: WSDL Caching */
-
- old_error_reporting = EG(error_reporting);
- EG(error_reporting) &= ~(E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
-
- wsdl = xmlParseFile(struri);
- xmlCleanupParser();
-
- EG(error_reporting) = old_error_reporting;
-
-
- if (!wsdl) {
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't load from %s", struri);
- }
-
- zend_hash_add(&tmpsdl->docs, struri, strlen(struri)+1, (void**)&wsdl, sizeof(xmlDocPtr), NULL);
-
- root = wsdl->children;
- definitions = get_node(root, "definitions");
- if (!definitions) {
- if (include) {
- xmlNodePtr schema = get_node(root, "schema");
- if (schema) {
- load_schema(tmpsdl, schema);
- return;
- }
- }
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't find \"definitions\" in %s", struri);
- }
-
- if (!include) {
- targetNamespace = get_attribute(definitions->properties, "targetNamespace");
- if (targetNamespace) {
- tmpsdl->target_ns = strdup(targetNamespace->children->content);
- }
- }
-
- trav = definitions->children;
- while (trav != NULL) {
- if (trav->type == XML_ELEMENT_NODE) {
- if (strcmp(trav->name,"types") == 0) {
- /* TODO: Only one "types" is allowed */
- xmlNodePtr trav2 = trav->children;
- xmlNodePtr schema;
- FOREACHNODE(trav2, "schema", schema) {
- load_schema(tmpsdl, schema);
- }
- ENDFOREACH(trav2);
-
- } else if (strcmp(trav->name,"import") == 0) {
- /* TODO: namespace ??? */
- xmlAttrPtr tmp = get_attribute(trav->properties, "location");
- if (tmp) {
- load_wsdl_ex(tmp->children->content, ctx, 1);
- }
-
- } else if (strcmp(trav->name,"message") == 0) {
- xmlAttrPtr name = get_attribute(trav->properties, "name");
- if (name && name->children && name->children->content) {
- if (zend_hash_add(&ctx->messages, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
- php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL (message '%s' already defined)",name->children->content);
- }
- } else {
- php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <message> hasn't name attribute");
- }
-
- } else if (strcmp(trav->name,"portType") == 0) {
- xmlAttrPtr name = get_attribute(trav->properties, "name");
- if (name && name->children && name->children->content) {
- if (zend_hash_add(&ctx->portTypes, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
- php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL (portType '%s' already defined)",name->children->content);
- }
- } else {
- php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <portType> hasn't name attribute");
- }
-
- } else if (strcmp(trav->name,"binding") == 0) {
- xmlAttrPtr name = get_attribute(trav->properties, "name");
- if (name && name->children && name->children->content) {
- if (zend_hash_add(&ctx->bindings, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
- php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL (binding '%s' already defined)",name->children->content);
- }
- } else {
- php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <binding> hasn't name attribute");
- }
-
- } else if (strcmp(trav->name,"service") == 0) {
- xmlAttrPtr name = get_attribute(trav->properties, "name");
- if (name && name->children && name->children->content) {
- if (zend_hash_add(&ctx->services, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
- php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL (service '%s' already defined)",name->children->content);
- }
- } else {
- php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <service> hasn't name attribute");
- }
-
- } else {
- /* TODO: extensibility elements */
- }
- }
- trav = trav->next;
- }
-}
-
-static sdlPtr load_wsdl(char *struri)
-{
- sdlCtx ctx;
- int i,n;
-
- ctx.root = malloc(sizeof(sdl));
- memset(ctx.root, 0, sizeof(sdl));
- ctx.root->source = strdup(struri);
- zend_hash_init(&ctx.root->docs, 0, NULL, delete_document, 1);
- zend_hash_init(&ctx.root->functions, 0, NULL, delete_function, 1);
-
- zend_hash_init(&ctx.messages, 0, NULL, NULL, 0);
- zend_hash_init(&ctx.bindings, 0, NULL, NULL, 0);
- zend_hash_init(&ctx.portTypes, 0, NULL, NULL, 0);
- zend_hash_init(&ctx.services, 0, NULL, NULL, 0);
-
- load_wsdl_ex(struri,&ctx, 0);
-
- schema_pass2(ctx.root);
-
- n = zend_hash_num_elements(&ctx.services);
- if (n > 0) {
- zend_hash_internal_pointer_reset(&ctx.services);
- for (i = 0; i < n; i++) {
- xmlNodePtr *tmp, service;
- xmlNodePtr trav, port;
-
- zend_hash_get_current_data(&ctx.services, (void **)&tmp);
- service = *tmp;
-
- trav = service->children;
- FOREACHNODE(trav, "port", port) {
- xmlAttrPtr type, name, bindingAttr, location;
- xmlNodePtr portType, operation;
- xmlNodePtr address, binding, trav2;
- char *ns, *ctype;
- sdlBindingPtr tmpbinding;
- char *wsdl_soap_namespace = NULL;
-
- tmpbinding = malloc(sizeof(sdlBinding));
- memset(tmpbinding, 0, sizeof(sdlBinding));
-
- bindingAttr = get_attribute(port->properties, "binding");
- if (bindingAttr == NULL) {
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No binding associated with port");
- }
-
- /* find address and figure out binding type */
- address = get_node(port->children, "address");
- if (!address) {
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No address associated with port");
- }
-
- location = get_attribute(address->properties, "location");
- if (!location) {
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No location associated with port");
- }
-
- tmpbinding->location = strdup(location->children->content);
-
- if (address->ns && !strcmp(address->ns->href, WSDL_SOAP11_NAMESPACE)) {
- wsdl_soap_namespace = WSDL_SOAP11_NAMESPACE;
- tmpbinding->bindingType = BINDING_SOAP;
- } else if (address->ns && !strcmp(address->ns->href, WSDL_SOAP12OLD_NAMESPACE)) {
- wsdl_soap_namespace = WSDL_SOAP12OLD_NAMESPACE;
- tmpbinding->bindingType = BINDING_SOAP;
- } else if (address->ns && !strcmp(address->ns->href, WSDL_SOAP12_NAMESPACE)) {
- wsdl_soap_namespace = WSDL_SOAP12_NAMESPACE;
- tmpbinding->bindingType = BINDING_SOAP;
- } else if (address->ns && !strcmp(address->ns->href, WSDL_HTTP11_NAMESPACE)) {
- tmpbinding->bindingType = BINDING_HTTP;
- } else if (address->ns && !strcmp(address->ns->href, WSDL_HTTP12_NAMESPACE)) {
- tmpbinding->bindingType = BINDING_HTTP;
- } else {
- if (address->ns) {
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: PHP-SOAP doesn't support binding '%s'",address->ns->href);
- } else {
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Unknown binding type");
- }
- }
-
- parse_namespace(bindingAttr->children->content, &ctype, &ns);
- if (zend_hash_find(&ctx.bindings, ctype, strlen(ctype)+1, (void*)&tmp) != SUCCESS) {
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No binding element with name \"%s\"", ctype);
- }
- binding = *tmp;
-
- if (ns) {efree(ns);}
- if (ctype) {efree(ctype);}
-
- if (tmpbinding->bindingType == BINDING_SOAP) {
- sdlSoapBindingPtr soapBinding;
- xmlNodePtr soapBindingNode;
- xmlAttrPtr tmp;
-
- soapBinding = malloc(sizeof(sdlSoapBinding));
- memset(soapBinding, 0, sizeof(sdlSoapBinding));
- soapBinding->style = SOAP_DOCUMENT;
-
- soapBindingNode = get_node_ex(binding->children, "binding", wsdl_soap_namespace);
- if (soapBindingNode) {
- tmp = get_attribute(soapBindingNode->properties, "style");
- if (tmp && !strcmp(tmp->children->content, "rpc")) {
- soapBinding->style = SOAP_RPC;
- }
-
- tmp = get_attribute(soapBindingNode->properties, "transport");
- if (tmp) {
- if (strcmp(tmp->children->content, WSDL_HTTP_TRANSPORT)) {
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: PHP-SOAP doesn't support transport '%s'", tmp->children->content);
- }
- soapBinding->transport = strdup(tmp->children->content);
- }
- }
- tmpbinding->bindingAttributes = (void *)soapBinding;
- }
-
- name = get_attribute(binding->properties, "name");
- if (name == NULL) {
- php_error(E_ERROR, "Error parsing wsdl (Missing \"name\" attribute for \"binding\")");
- }
- tmpbinding->name = strdup(name->children->content);
-
- type = get_attribute(binding->properties, "type");
- if (type == NULL) {
- php_error(E_ERROR, "Error parsing wsdl (Missing \"type\" attribute for \"binding\")");
- }
- parse_namespace(type->children->content, &ctype, &ns);
-
- if (zend_hash_find(&ctx.portTypes, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) {
- php_error(E_ERROR, "Error parsing wsdl (Missing \"portType\" with name \"%s\")", name->children->content);
- }
- portType = *tmp;
-
- if (ctype) {efree(ctype);}
- if (ns) {efree(ns);}
-
- trav2 = binding->children;
- FOREACHNODE(trav2, "operation", operation) {
- sdlFunctionPtr function;
- xmlNodePtr input, output, fault, portTypeOperation, portTypeInput, portTypeOutput, msgInput, msgOutput;
- xmlAttrPtr op_name, paramOrder;
-
- op_name = get_attribute(operation->properties, "name");
- if (op_name == NULL) {
- php_error(E_ERROR, "Error parsing wsdl (Missing \"name\" attribute for \"operation\")");
- }
-
- portTypeOperation = get_node_with_attribute(portType->children, "operation", "name", op_name->children->content);
- if (portTypeOperation == NULL) {
- php_error(E_ERROR, "Error parsing wsdl (Missing \"portType/operation\" with name \"%s\")", op_name->children->content);
- }
-
- function = malloc(sizeof(sdlFunction));
- function->functionName = strdup(op_name->children->content);
- function->requestParameters = NULL;
- function->responseParameters = NULL;
- function->responseName = NULL;
- function->requestName = NULL;
- function->bindingAttributes = NULL;
-
- if (tmpbinding->bindingType == BINDING_SOAP) {
- sdlSoapBindingFunctionPtr soapFunctionBinding;
- sdlSoapBindingPtr soapBinding;
- xmlNodePtr soapOperation;
- xmlAttrPtr tmp;
-
- soapFunctionBinding = malloc(sizeof(sdlSoapBindingFunction));
- memset(soapFunctionBinding, 0, sizeof(sdlSoapBindingFunction));
- soapBinding = (sdlSoapBindingPtr)tmpbinding->bindingAttributes;
- soapFunctionBinding->style = soapBinding->style;
-
- soapOperation = get_node_ex(operation->children, "operation", wsdl_soap_namespace);
- if (soapOperation) {
- tmp = get_attribute(soapOperation->properties, "soapAction");
- if (tmp) {
- soapFunctionBinding->soapAction = strdup(tmp->children->content);
- }
-
- tmp = get_attribute(soapOperation->properties, "style");
- if (tmp) {
- if (!strcmp(tmp->children->content, "rpc")) {
- soapFunctionBinding->style = SOAP_RPC;
- } else {
- soapFunctionBinding->style = SOAP_DOCUMENT;
- }
- } else {
- soapFunctionBinding->style = soapBinding->style;
- }
- }
-
- function->bindingAttributes = (void *)soapFunctionBinding;
- }
-
- input = get_node(operation->children, "input");
- portTypeInput = get_node(portTypeOperation->children, "input");
-
- output = get_node(operation->children, "output");
- portTypeOutput = get_node(portTypeOperation->children, "output");
-
- if (input != NULL) {
- xmlAttrPtr message, name;
- xmlNodePtr part, trav3;
- char *ns, *ctype;
-
- if (portTypeInput) {
- message = get_attribute(portTypeInput->properties, "message");
- if (message == NULL) {
- php_error(E_ERROR, "Error parsing wsdl (Missing name for \"input\" of \"%s\")", op_name->children->content);
- }
-
- name = get_attribute(portTypeInput->properties, "name");
- if (name != NULL) {
- function->requestName = strdup(name->children->content);
- } else {
- function->requestName = strdup(function->functionName);
- }
- function->requestParameters = malloc(sizeof(HashTable));
- zend_hash_init(function->requestParameters, 0, NULL, delete_paramater, 1);
-
- parse_namespace(message->children->content, &ctype, &ns);
-
- if (zend_hash_find(&ctx.messages, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) {
- php_error(E_ERROR, "Error parsing wsdl (Missing \"message\" with name \"%s\")", message->children->content);
- }
- msgInput = *tmp;
-
- if (ctype) {efree(ctype);}
- if (ns) {efree(ns);}
-
- if (tmpbinding->bindingType == BINDING_SOAP) {
- sdlSoapBindingFunctionPtr soapFunctionBinding = function->bindingAttributes;
- xmlNodePtr body;
- xmlAttrPtr tmp;
-
- body = get_node_ex(input->children, "body", wsdl_soap_namespace);
- if (body) {
- tmp = get_attribute(body->properties, "use");
- if (tmp && !strcmp(tmp->children->content, "literal")) {
- soapFunctionBinding->input.use = SOAP_LITERAL;
- } else {
- soapFunctionBinding->input.use = SOAP_ENCODED;
- }
-
- tmp = get_attribute(body->properties, "namespace");
- if (tmp) {
- soapFunctionBinding->input.ns = strdup(tmp->children->content);
- }
-
- tmp = get_attribute(body->properties, "parts");
- if (tmp) {
- soapFunctionBinding->input.parts = strdup(tmp->children->content);
- }
-
- tmp = get_attribute(body->properties, "encodingStyle");
- if (tmp) {
- soapFunctionBinding->input.encodingStyle = strdup(tmp->children->content);
- }
- }
- }
-
- trav3 = msgInput->children;
- FOREACHNODE(trav3, "part", part) {
- xmlAttrPtr element, type, name;
- sdlParamPtr param;
-
- param = malloc(sizeof(sdlParam));
- memset(param,0,sizeof(sdlParam));
- param->order = 0;
-
- name = get_attribute(part->properties, "name");
- if (name == NULL) {
- php_error(E_ERROR, "Error parsing wsdl (No name associated with part \"%s\")", msgInput->name);
- }
-
- param->paramName = strdup(name->children->content);
-
- type = get_attribute(part->properties, "type");
- if (type != NULL) {
- param->encode = get_encoder_from_prefix(ctx.root, part, type->children->content);
- } else {
- element = get_attribute(part->properties, "element");
- if (element != NULL) {
- param->encode = get_encoder_from_element(ctx.root, part, element->children->content);
- }
- }
-
- zend_hash_next_index_insert(function->requestParameters, &param, sizeof(sdlParamPtr), NULL);
- }
- ENDFOREACH(trav3);
- }
-
- }
-
- if (output != NULL) {
- xmlAttrPtr message, name;
- xmlNodePtr part, trav3;
- char *ns, *ctype;
-
- if (portTypeOutput) {
- name = get_attribute(portTypeOutput->properties, "name");
- if (name != NULL) {
- function->responseName = strdup(name->children->content);
- } else if (input == NULL) {
- function->responseName = strdup(function->functionName);
- } else {
- function->responseName = malloc(strlen(function->functionName) + strlen("Response") + 1);
- sprintf(function->responseName, "%sResponse", function->functionName);
- }
- function->responseParameters = malloc(sizeof(HashTable));
- zend_hash_init(function->responseParameters, 0, NULL, delete_paramater, 1);
-
- message = get_attribute(portTypeOutput->properties, "message");
- if (message == NULL) {
- php_error(E_ERROR, "Error parsing wsdl (Missing name for \"output\" of \"%s\")", op_name->children->content);
- }
-
- parse_namespace(message->children->content, &ctype, &ns);
- if (zend_hash_find(&ctx.messages, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) {
- php_error(E_ERROR, "Error parsing wsdl (Missing \"message\" with name \"%s\")", message->children->content);
- }
- msgOutput = *tmp;
-
- if (ctype) {efree(ctype);}
- if (ns) {efree(ns);}
-
- if (tmpbinding->bindingType == BINDING_SOAP) {
- sdlSoapBindingFunctionPtr soapFunctionBinding = function->bindingAttributes;
- xmlNodePtr body;
- xmlAttrPtr tmp;
-
- body = get_node_ex(output->children, "body", wsdl_soap_namespace);
- if (body) {
- tmp = get_attribute(body->properties, "use");
- if (tmp && !strcmp(tmp->children->content, "literal")) {
- soapFunctionBinding->output.use = SOAP_LITERAL;
- } else {
- soapFunctionBinding->output.use = SOAP_ENCODED;
- }
-
- tmp = get_attribute(body->properties, "namespace");
- if (tmp) {
- soapFunctionBinding->output.ns = strdup(tmp->children->content);
- }
-
- tmp = get_attribute(body->properties, "parts");
- if (tmp) {
- soapFunctionBinding->output.parts = strdup(tmp->children->content);
- }
-
- tmp = get_attribute(body->properties, "encodingStyle");
- if (tmp) {
- soapFunctionBinding->output.encodingStyle = strdup(tmp->children->content);
- }
- }
- }
-
- trav3 = msgOutput->children;
- FOREACHNODE(trav3, "part", part) {
- sdlParamPtr param;
- xmlAttrPtr element, type, name;
-
- param = malloc(sizeof(sdlParam));
- memset(param, 0, sizeof(sdlParam));
- param->order = 0;
-
- name = get_attribute(part->properties, "name");
- if (name == NULL) {
- php_error(E_ERROR, "Error parsing wsdl (No name associated with part \"%s\")", msgOutput->name);
- }
-
- param->paramName = strdup(name->children->content);
-
-
- type = get_attribute(part->properties, "type");
- if (type) {
- param->encode = get_encoder_from_prefix(ctx.root, part, type->children->content);
- } else {
- element = get_attribute(part->properties, "element");
- if (element) {
- param->encode = get_encoder_from_element(ctx.root, part, element->children->content);
- }
- }
-
- zend_hash_next_index_insert(function->responseParameters, &param, sizeof(sdlParamPtr), NULL);
- }
- ENDFOREACH(trav3);
- }
- }
-
- paramOrder = get_attribute(portTypeOperation->properties, "parameterOrder");
- if (paramOrder) {
- /* FIXME: */
- }
-
- fault = get_node(operation->children, "fault");
- if (!fault) {
- }
-
- function->binding = tmpbinding;
-
- {
- char *tmp = estrdup(function->functionName);
- int len = strlen(tmp);
-
- zend_hash_add(&ctx.root->functions, php_strtolower(tmp, len), len+1, &function, sizeof(sdlFunctionPtr), NULL);
- efree(tmp);
- if (function->requestName != NULL && strcmp(function->requestName,function->functionName) != 0) {
- if (ctx.root->requests == NULL) {
- ctx.root->requests = malloc(sizeof(HashTable));
- zend_hash_init(ctx.root->requests, 0, NULL, NULL, 1);
- }
- tmp = estrdup(function->requestName);
- len = strlen(tmp);
- zend_hash_add(ctx.root->requests, php_strtolower(tmp, len), len+1, &function, sizeof(sdlFunctionPtr), NULL);
- efree(tmp);
- }
- }
- }
- ENDFOREACH(trav2);
-
- if (!ctx.root->bindings) {
- ctx.root->bindings = malloc(sizeof(HashTable));
- zend_hash_init(ctx.root->bindings, 0, NULL, delete_binding, 1);
- }
-
- zend_hash_add(ctx.root->bindings, tmpbinding->name, strlen(tmpbinding->name), &tmpbinding, sizeof(sdlBindingPtr), NULL);
- }
- ENDFOREACH(trav);
-
- zend_hash_move_forward(&ctx.services);
- }
- } else {
- php_error(E_ERROR, "Error parsing wsdl (\"Couldn't bind to service\")");
- }
-
- schema_pass3(ctx.root);
- zend_hash_destroy(&ctx.messages);
- zend_hash_destroy(&ctx.bindings);
- zend_hash_destroy(&ctx.portTypes);
- zend_hash_destroy(&ctx.services);
-
- return ctx.root;
-}
-
-sdlPtr get_sdl(char *uri)
-{
- sdlPtr tmp, *hndl;
- TSRMLS_FETCH();
-
- tmp = NULL;
- hndl = NULL;
- if (zend_hash_find(SOAP_GLOBAL(sdls), uri, strlen(uri), (void **)&hndl) == FAILURE) {
- tmp = load_wsdl(uri);
- zend_hash_add(SOAP_GLOBAL(sdls), uri, strlen(uri), &tmp, sizeof(sdlPtr), NULL);
- } else {
- tmp = *hndl;
- }
-
- return tmp;
-}
-
-/* Deletes */
-void delete_sdl(void *handle)
-{
- sdlPtr tmp = *((sdlPtr*)handle);
-
- zend_hash_destroy(&tmp->docs);
- zend_hash_destroy(&tmp->functions);
- if (tmp->source) {
- free(tmp->source);
- }
- if (tmp->target_ns) {
- free(tmp->target_ns);
- }
- if (tmp->encoders) {
- zend_hash_destroy(tmp->encoders);
- free(tmp->encoders);
- }
- if (tmp->types) {
- zend_hash_destroy(tmp->types);
- free(tmp->types);
- }
- if (tmp->elements) {
- zend_hash_destroy(tmp->elements);
- free(tmp->elements);
- }
- if (tmp->attributes) {
- zend_hash_destroy(tmp->attributes);
- free(tmp->attributes);
- }
- if (tmp->attributeGroups) {
- zend_hash_destroy(tmp->attributeGroups);
- free(tmp->attributeGroups);
- }
- if (tmp->groups) {
- zend_hash_destroy(tmp->groups);
- free(tmp->groups);
- }
- if (tmp->bindings) {
- zend_hash_destroy(tmp->bindings);
- free(tmp->bindings);
- }
- if (tmp->requests) {
- zend_hash_destroy(tmp->requests);
- free(tmp->requests);
- }
- free(tmp);
-}
-
-static void delete_binding(void *data)
-{
- sdlBindingPtr binding = *((sdlBindingPtr*)data);
-
- if (binding->location) {
- free(binding->location);
- }
- if (binding->name) {
- free(binding->name);
- }
-
- if (binding->bindingType == BINDING_SOAP) {
- sdlSoapBindingPtr soapBind = binding->bindingAttributes;
- if (soapBind && soapBind->transport) {
- free(soapBind->transport);
- }
- }
-}
-
-static void delete_sdl_soap_binding_function_body(sdlSoapBindingFunctionBody body)
-{
- if (body.ns) {
- free(body.ns);
- }
- if (body.parts) {
- free(body.parts);
- }
- if (body.encodingStyle) {
- free(body.encodingStyle);
- }
-}
-
-static void delete_function(void *data)
-{
- sdlFunctionPtr function = *((sdlFunctionPtr*)data);
-
- if (function->functionName) {
- free(function->functionName);
- }
- if (function->requestName) {
- free(function->requestName);
- }
- if (function->responseName) {
- free(function->responseName);
- }
- if (function->requestParameters) {
- zend_hash_destroy(function->requestParameters);
- free(function->requestParameters);
- }
- if (function->responseParameters) {
- zend_hash_destroy(function->responseParameters);
- free(function->responseParameters);
- }
-
- if (function->bindingAttributes &&
- function->binding && function->binding->bindingType == BINDING_SOAP) {
- sdlSoapBindingFunctionPtr soapFunction = function->bindingAttributes;
- if (soapFunction->soapAction) {
- free(soapFunction->soapAction);
- }
- delete_sdl_soap_binding_function_body(soapFunction->input);
- delete_sdl_soap_binding_function_body(soapFunction->output);
- delete_sdl_soap_binding_function_body(soapFunction->falut);
- }
-}
-
-static void delete_paramater(void *data)
-{
- sdlParamPtr param = *((sdlParamPtr*)data);
- if (param->paramName) {
- free(param->paramName);
- }
- free(param);
-}
-
-void delete_mapping(void *data)
-{
- soapMappingPtr map = (soapMappingPtr)data;
-
- if (map->ns) {
- efree(map->ns);
- }
- if (map->ctype) {
- efree(map->ctype);
- }
-
- if (map->type == SOAP_MAP_FUNCTION) {
- if (map->map_functions.to_xml_before) {
- zval_ptr_dtor(&map->map_functions.to_xml_before);
- }
- if (map->map_functions.to_xml) {
- zval_ptr_dtor(&map->map_functions.to_xml);
- }
- if (map->map_functions.to_xml_after) {
- zval_ptr_dtor(&map->map_functions.to_xml_after);
- }
- if (map->map_functions.to_zval_before) {
- zval_ptr_dtor(&map->map_functions.to_zval_before);
- }
- if (map->map_functions.to_zval) {
- zval_ptr_dtor(&map->map_functions.to_zval);
- }
- if (map->map_functions.to_zval_after) {
- zval_ptr_dtor(&map->map_functions.to_zval_after);
- }
- }
- efree(map);
-}
-
-void delete_type(void *data)
-{
- sdlTypePtr type = *((sdlTypePtr*)data);
- if (type->name) {
- free(type->name);
- }
- if (type->namens) {
- free(type->namens);
- }
- if (type->elements) {
- zend_hash_destroy(type->elements);
- free(type->elements);
- }
- if (type->attributes) {
- zend_hash_destroy(type->attributes);
- free(type->attributes);
- }
- if (type->restrictions) {
- delete_restriction_var_int(&type->restrictions->minExclusive);
- delete_restriction_var_int(&type->restrictions->minInclusive);
- delete_restriction_var_int(&type->restrictions->maxExclusive);
- delete_restriction_var_int(&type->restrictions->maxInclusive);
- delete_restriction_var_int(&type->restrictions->totalDigits);
- delete_restriction_var_int(&type->restrictions->fractionDigits);
- delete_restriction_var_int(&type->restrictions->length);
- delete_restriction_var_int(&type->restrictions->minLength);
- delete_restriction_var_int(&type->restrictions->maxLength);
- delete_schema_restriction_var_char(&type->restrictions->whiteSpace);
- delete_schema_restriction_var_char(&type->restrictions->pattern);
- if (type->restrictions->enumeration) {
- zend_hash_destroy(type->restrictions->enumeration);
- free(type->restrictions->enumeration);
- }
- free(type->restrictions);
- }
- free(type);
-}
-
-void delete_attribute(void *attribute)
-{
- sdlAttributePtr attr = *((sdlAttributePtr*)attribute);
-
- if (attr->def) {
- free(attr->def);
- }
- if (attr->fixed) {
- free(attr->fixed);
- }
- if (attr->form) {
- free(attr->form);
- }
- if (attr->id) {
- free(attr->id);
- }
- if (attr->name) {
- free(attr->name);
- }
- if (attr->ref) {
- free(attr->ref);
- }
- if (attr->use) {
- free(attr->use);
- }
- if (attr->extraAttributes) {
- zend_hash_destroy(attr->extraAttributes);
- free(attr->extraAttributes);
- }
-}
-
-void delete_restriction_var_int(void *rvi)
-{
- sdlRestrictionIntPtr ptr = *((sdlRestrictionIntPtr*)rvi);
- if (ptr) {
- if (ptr->id) {
- free(ptr->id);
- }
- free(ptr);
- }
-}
-
-void delete_schema_restriction_var_char(void *srvc)
-{
- sdlRestrictionCharPtr ptr = *((sdlRestrictionCharPtr*)srvc);
- if (ptr) {
- if (ptr->id) {
- free(ptr->id);
- }
- if (ptr->value) {
- free(ptr->value);
- }
- free(ptr);
- }
-}
-
-static void delete_document(void *doc_ptr)
-{
- xmlDocPtr doc = *((xmlDocPtr*)doc_ptr);
- xmlFreeDoc(doc);
-}
diff --git a/ext/soap/php_sdl.h b/ext/soap/php_sdl.h
deleted file mode 100644
index 796d25f1cb..0000000000
--- a/ext/soap/php_sdl.h
+++ /dev/null
@@ -1,183 +0,0 @@
-#ifndef PHP_SDL_H
-#define PHP_SDL_H
-
-#define XSD_WHITESPACE_COLLAPSE 1
-#define XSD_WHITESPACE_PRESERVE 1
-#define XSD_WHITESPACE_REPLACE 1
-
-#define BINDING_SOAP 1
-#define BINDING_HTTP 2
-
-#define SOAP_RPC 1
-#define SOAP_DOCUMENT 2
-
-#define SOAP_ENCODED 1
-#define SOAP_LITERAL 2
-
-struct _sdl {
- HashTable docs; /* pointer to the parsed xml file */
- HashTable functions; /* array of sdlFunction */
- HashTable *types; /* array of sdlTypesPtr */
- HashTable *elements; /* array of sdlTypesPtr */
- HashTable *encoders; /* array of encodePtr */
- HashTable *bindings; /* array of sdlBindings (key'd by name) */
- HashTable *requests; /* array of sdlFunction (references) */
- HashTable *attributes; /* array of sdlAttributePtr */
- HashTable *attributeGroups; /* array of sdlTypesPtr */
- HashTable *groups; /* array of sdlTypesPtr */
- char *target_ns;
- char *source;
-};
-
-struct _sdlBinding {
- char *name;
- char *location;
- int bindingType;
- void *bindingAttributes; /* sdlSoapBindingPtr */
-};
-
-/* Soap Binding Specfic stuff */
-struct _sdlSoapBinding {
- char *transport;
- int style;
-};
-
-struct _sdlSoapBindingFunctionBody {
- char *ns;
- int use;
- char *parts; /* not implemented yet */
- char *encodingStyle; /* not implemented yet */
-};
-
-struct _sdlSoapBindingFunction {
- char *soapAction;
- int style;
-
- sdlSoapBindingFunctionBody input;
- sdlSoapBindingFunctionBody output;
- sdlSoapBindingFunctionBody falut;
-};
-
-struct _sdlRestrictionInt {
- int value;
- char fixed;
- char *id;
-};
-
-struct _sdlRestrictionChar {
- char *value;
- char fixed;
- char *id;
-};
-
-struct _sdlRestrictions {
- HashTable *enumeration; /* array of sdlRestrictionCharPtr */
- sdlRestrictionIntPtr minExclusive;
- sdlRestrictionIntPtr minInclusive;
- sdlRestrictionIntPtr maxExclusive;
- sdlRestrictionIntPtr maxInclusive;
- sdlRestrictionIntPtr totalDigits;
- sdlRestrictionIntPtr fractionDigits;
- sdlRestrictionIntPtr length;
- sdlRestrictionIntPtr minLength;
- sdlRestrictionIntPtr maxLength;
- sdlRestrictionCharPtr whiteSpace;
- sdlRestrictionCharPtr pattern;
-};
-
-typedef enum _sdlContentKind {
- XSD_CONTENT_ELEMENT,
- XSD_CONTENT_SEQUENCE,
- XSD_CONTENT_ALL,
- XSD_CONTENT_CHOICE,
- XSD_CONTENT_GROUP_REF,
- XSD_CONTENT_GROUP
-} sdlContentKind;
-
-
-typedef struct _sdlContentModel sdlContentModel, *sdlContentModelPtr;
-
-struct _sdlContentModel {
- sdlContentKind kind;
- int min_occurs;
- int max_occurs;
- union {
- sdlTypePtr element; /* pointer to element */
- sdlContentModelPtr group; /* pointer to group */
- HashTable *content; /* array of sdlContentModel for sequnce,all,choice*/
- char *group_ref; /* reference to group */
- } u;
-};
-
-typedef enum _sdlTypeKind {
- XSD_TYPEKIND_SIMPLE,
- XSD_TYPEKIND_LIST,
- XSD_TYPEKIND_UNION,
- XSD_TYPEKIND_COMPLEX,
- XSD_TYPEKIND_RESTRICTION,
- XSD_TYPEKIND_EXTENSION
-} sdlTypeKind;
-
-struct _sdlType {
- sdlTypeKind kind;
- char *name;
- char *namens;
- int nillable;
- HashTable *elements; /* array of sdlTypePtr */
- HashTable *attributes; /* array of sdlAttributePtr */
- sdlRestrictionsPtr restrictions;
- encodePtr encode;
- char *ref;
- sdlContentModelPtr model;
-};
-
-struct _sdlParam {
- int order;
- encodePtr encode;
- char *paramName;
-};
-
-struct _sdlFunction {
- char *functionName;
- char *requestName;
- char *responseName;
- HashTable *requestParameters; /* array of sdlParamPtr */
- HashTable *responseParameters; /* array of sdlParamPtr (this should only be one) */
- struct _sdlBinding* binding;
- void* bindingAttributes; /* sdlSoapBindingFunctionPtr */
-};
-
-struct _sdlAttribute {
- char *def;
- char *fixed;
- char *form;
- char *id;
- char *name;
- char *ref;
- char *use;
- HashTable *extraAttributes; /* array of xmlNodePtr */
- encodePtr encode;
-};
-
-sdlPtr get_sdl(char *uri);
-
-encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, const char *type);
-encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type);
-encodePtr get_encoder_ex(sdlPtr sdl, const char *nscat);
-encodePtr get_create_encoder(sdlPtr sdl, sdlTypePtr cur_type, const char *ns, const char *type);
-encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, const char *ns, const char *type);
-
-sdlBindingPtr get_binding_from_type(sdlPtr sdl, int type);
-sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns);
-
-xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval* data, int style);
-zval *sdl_guess_convert_zval(encodeTypePtr enc, xmlNodePtr data);
-
-void delete_sdl(void *handle);
-void delete_type(void *type);
-void delete_attribute(void *attribute);
-void delete_mapping(void *data);
-void delete_restriction_var_int(void *rvi);
-void delete_schema_restriction_var_char(void *srvc);
-
-#endif
diff --git a/ext/soap/php_soap.dsp b/ext/soap/php_soap.dsp
deleted file mode 100644
index a80142d6c3..0000000000
--- a/ext/soap/php_soap.dsp
+++ /dev/null
@@ -1,148 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php_soap" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php_soap - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php_soap.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php_soap.mak" CFG="php_soap - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php_soap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php_soap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php_soap - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\libxml2-2.4.12\include" /I "..\..\bind" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTSWS" /D "PHP_SOAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "ZTS" /D ZEND_DEBUG=0 /D "COMPILE_DL_SOAP" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib libxml2.lib wsock32.lib resolv.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_soap.dll" /libpath:"..\..\\" /libpath:"..\..\..\libxml2-2.4.12\lib" /libpath:"..\..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php_soap - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\libxml2-2.4.12\include" /I "..\..\bind" /D "WS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "ZTS" /D ZEND_DEBUG=1 /D "COMPILE_DL_SOAP" /FR"Release_TS/" /Fp"Release_TS/gd.pch" /YX /Fo"Release_TS/" /Fd"Release_TS/" /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib libxml2.lib wsock32.lib resolv.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_soap.dll" /implib:"Release_TS/php_gd.lib" /pdbtype:sept /libpath:"..\..\\" /libpath:"..\..\..\libxml2-2.4.12\lib" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none /incremental:no
-
-!ENDIF
-
-# Begin Target
-
-# Name "php_soap - Win32 Release"
-# Name "php_soap - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_encoding.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_http.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_schema.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_sdl.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_xml.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\soap.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_encoding.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_http.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_schema.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_sdl.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_soap.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_xml.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h
deleted file mode 100644
index 821da970eb..0000000000
--- a/ext/soap/php_soap.h
+++ /dev/null
@@ -1,161 +0,0 @@
-#ifndef PHP_SOAP_H
-#define PHP_SOAP_H
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_standard.h"
-#include "ext/session/php_session.h"
-#include "ext/standard/php_smart_str.h"
-#include "php_ini.h"
-#include "SAPI.h"
-#include <libxml/parser.h>
-#include <libxml/xpath.h>
-
-#ifdef HAVE_PHP_DOMXML
-# include "ext/domxml/php_domxml.h"
-#endif
-
-#ifndef PHP_HAVE_STREAMS
-# error You lose - must be compiled against PHP 4.3.0 or later
-#endif
-
-#ifndef PHP_WIN32
-# define TRUE 1
-# define FALSE 0
-# define stricmp strcasecmp
-#endif
-
-typedef struct _encodeType encodeType, *encodeTypePtr;
-typedef struct _encode encode, *encodePtr;
-
-typedef struct _sdl sdl, *sdlPtr;
-typedef struct _sdlRestrictionInt sdlRestrictionInt, *sdlRestrictionIntPtr;
-typedef struct _sdlRestrictionChar sdlRestrictionChar, *sdlRestrictionCharPtr;
-typedef struct _sdlRestrictions sdlRestrictions, *sdlRestrictionsPtr;
-typedef struct _sdlType sdlType, *sdlTypePtr;
-typedef struct _sdlParam sdlParam, *sdlParamPtr;
-typedef struct _sdlFunction sdlFunction, *sdlFunctionPtr;
-typedef struct _sdlAttribute sdlAttribute, *sdlAttributePtr;
-typedef struct _sdlBinding sdlBinding, *sdlBindingPtr;
-typedef struct _sdlSoapBinding sdlSoapBinding, *sdlSoapBindingPtr;
-typedef struct _sdlSoapBindingFunction sdlSoapBindingFunction, *sdlSoapBindingFunctionPtr;
-typedef struct _sdlSoapBindingFunctionBody sdlSoapBindingFunctionBody, *sdlSoapBindingFunctionBodyPtr;
-
-typedef struct _soapMapping soapMapping, *soapMappingPtr;
-typedef struct _soapService soapService, *soapServicePtr;
-
-#include "php_xml.h"
-#include "php_encoding.h"
-#include "php_sdl.h"
-#include "php_schema.h"
-#include "php_http.h"
-#include "php_packet_soap.h"
-
-struct _soapHeaderHandler {
- char *ns;
- int type;
-
- struct _function_handler {
- char *functionName;
- char *type;
- } function_handler;
-
- struct _class_handler {
- zend_class_entry *ce;
- } class_handler;
-};
-
-struct _soapMapping {
- char *ns;
- char *ctype;
- int type;
-
- struct _map_functions {
- zval *to_xml_before;
- zval *to_xml;
- zval *to_xml_after;
- zval *to_zval_before;
- zval *to_zval;
- zval *to_zval_after;
- } map_functions;
-
- struct _map_class {
- int type;
- zend_class_entry *ce;
- } map_class;
-};
-
-struct _soapService {
- sdlPtr sdl;
-
- struct _soap_functions {
- HashTable *ft;
- int functions_all;
- } soap_functions;
-
- struct _soap_class {
- zend_class_entry *ce;
- zval **argv;
- int argc;
- int persistance;
- } soap_class;
-
- HashTable *mapping;
- int type;
- char *uri;
-};
-
-#define SOAP_CLASS 1
-#define SOAP_FUNCTIONS 2
-#define SOAP_FUNCTIONS_ALL 999
-
-#define SOAP_MAP_FUNCTION 1
-#define SOAP_MAP_CLASS 2
-
-#define SOAP_PERSISTENCE_SESSION 1
-#define SOAP_PERSISTENCE_REQUEST 2
-
-#define SOAP_1_1 1
-#define SOAP_1_2 2
-
-ZEND_BEGIN_MODULE_GLOBALS(soap)
- HashTable *defEncNs;
- HashTable *defEncPrefix;
- HashTable *defEnc;
- HashTable *defEncIndex;
- HashTable *sdls;
- HashTable *services;
- HashTable *overrides;
- int cur_uniq_ns;
- int soap_version;
- sdlPtr sdl;
- zend_bool use_soap_error_handler;
-ZEND_END_MODULE_GLOBALS(soap)
-
-#ifdef PHP_WIN32
-#define PHP_SOAP_API __declspec(dllexport)
-#else
-#define PHP_SOAP_API
-#endif
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-extern zend_module_entry soap_module_entry;
-#define soap_module_ptr &soap_module_entry
-#define phpext_soap_ptr soap_module_ptr
-
-ZEND_EXTERN_MODULE_GLOBALS(soap);
-
-#ifdef ZTS
-# define SOAP_GLOBAL(v) TSRMG(soap_globals_id, zend_soap_globals *, v)
-#else
-# define SOAP_GLOBAL(v) (soap_globals.v)
-#endif
-
-extern zend_class_entry* soap_var_class_entry;
-
-zval* add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC);
-
-#endif
diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c
deleted file mode 100644
index 5e55e467b6..0000000000
--- a/ext/soap/php_xml.c
+++ /dev/null
@@ -1,205 +0,0 @@
-#include "php_soap.h"
-
-/* Channel libxml file io layer through the PHP streams subsystem.
- * This allows use of ftps:// and https:// urls */
-
-int php_stream_xmlIO_match_wrapper(const char *filename)
-{
- TSRMLS_FETCH();
- return php_stream_locate_url_wrapper(filename, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ? 1 : 0;
-}
-
-void *php_stream_xmlIO_open_wrapper(const char *filename)
-{
- TSRMLS_FETCH();
- return php_stream_open_wrapper((char*)filename, "rb", ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
-}
-
-int php_stream_xmlIO_read(void *context, char *buffer, int len)
-{
- TSRMLS_FETCH();
- return php_stream_read((php_stream*)context, buffer, len);
-}
-
-int php_stream_xmlIO_close(void *context)
-{
- TSRMLS_FETCH();
- return php_stream_close((php_stream*)context);
-}
-
-xmlNsPtr attr_find_ns(xmlAttrPtr node)
-{
- if (node->ns) {
- return node->ns;
- } else if (node->parent->ns) {
- return node->parent->ns;
- } else {
- return xmlSearchNs(node->doc, node->parent, NULL);
- }
-}
-
-xmlNsPtr node_find_ns(xmlNodePtr node)
-{
- if (node->ns) {
- return node->ns;
- } else {
- return xmlSearchNs(node->doc, node, NULL);
- }
-}
-
-int attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns)
-{
- if (name == NULL || strcmp(node->name, name) == 0) {
- if (ns) {
- xmlNsPtr nsPtr = attr_find_ns(node);
- return (strcmp(nsPtr->href, ns) == 0);
- }
- return TRUE;
- }
- return FALSE;
-}
-
-int node_is_equal_ex(xmlNodePtr node, char *name, char *ns)
-{
- if (name == NULL || strcmp(node->name, name) == 0) {
- if (ns) {
- xmlNsPtr nsPtr = node_find_ns(node);
- return (strcmp(nsPtr->href, ns) == 0);
- }
- return TRUE;
- }
- return FALSE;
-}
-
-
-xmlAttrPtr get_attribute_ex(xmlAttrPtr node, char *name, char *ns)
-{
- while (node!=NULL) {
- if (attr_is_equal_ex(node, name, ns)) {
- return node;
- }
- node = node->next;
- }
- return NULL;
-}
-
-xmlNodePtr get_node_ex(xmlNodePtr node, char *name, char *ns)
-{
- while (node!=NULL) {
- if (node_is_equal_ex(node, name, ns)) {
- return node;
- }
- node = node->next;
- }
- return NULL;
-}
-
-xmlNodePtr get_node_recurisve_ex(xmlNodePtr node, char *name, char *ns)
-{
- while (node != NULL) {
- if (node_is_equal_ex(node, name, ns)) {
- return node;
- } else if (node->children != NULL) {
- xmlNodePtr tmp = get_node_recurisve_ex(node->children, name, ns);
- if (tmp) {
- return tmp;
- }
- }
- node = node->next;
- }
- return NULL;
-}
-
-xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns)
-{
- xmlAttrPtr attr;
-
- while (node != NULL) {
- if (name != NULL) {
- node = get_node_ex(node, name, name_ns);
- if (node==NULL) {
- return NULL;
- }
- }
-
- attr = get_attribute_ex(node->properties, attribute, attr_ns);
- if (attr != NULL && strcmp(attr->children->content, value) == 0) {
- return node;
- }
- node = node->next;
- }
- return NULL;
-}
-
-xmlNodePtr get_node_with_attribute_recursive_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns)
-{
- while (node != NULL) {
- if (node_is_equal_ex(node, name, name_ns)) {
- xmlAttrPtr attr = get_attribute_ex(node->properties, attribute, attr_ns);
- if (attr != NULL && strcmp(attr->children->content, value) == 0) {
- return node;
- }
- }
- if (node->children != NULL) {
- xmlNodePtr tmp = get_node_with_attribute_recursive_ex(node->children, name, name_ns, attribute, value, attr_ns);
- if (tmp) {
- return tmp;
- }
- }
- node = node->next;
- }
- return NULL;
-}
-
-xmlNodePtr check_and_resolve_href(xmlNodePtr data)
-{
- if (data && data->properties) {
- xmlAttrPtr href = get_attribute(data->properties, "href");
- if (href) {
- /* Internal href try and find node */
- if (href->children->content[0] == '#') {
- xmlNodePtr ret = get_node_with_attribute_recursive(data->doc->children, NULL, "id", &href->children->content[1]);
- if (!ret) {
- php_error(E_ERROR,"Unresolved reference '%s'",href->children->content);
- }
- return ret;
- } else {
- /* TODO: External href....? */
- php_error(E_ERROR,"External reference '%s'",href->children->content);
- }
- }
- /* SOAP 1.2 enc:id enc:ref */
- href = get_attribute_ex(data->properties, "ref", SOAP_1_2_ENC_NAMESPACE);
- if (href) {
- /* Internal href try and find node */
- if (href->children->content[0] == '#') {
- xmlNodePtr ret = get_node_with_attribute_recursive_ex(data->doc->children, NULL, NULL, "id", &href->children->content[1], SOAP_1_2_ENC_NAMESPACE);
- if (!ret) {
- php_error(E_ERROR,"Unresolved reference '%s'",href->children->content);
- } else if (ret == data) {
- php_error(E_ERROR,"Violation of id and ref information items '%s'",href->children->content);
- }
- return ret;
- } else {
- /* TODO: External href....? */
- php_error(E_ERROR,"External reference '%s'",href->children->content);
- }
- }
- }
- return data;
-}
-
-int parse_namespace(const char *inval, char **value, char **namespace)
-{
- char *found = strchr(inval, ':');
-
- if (found != NULL && found != inval) {
- (*namespace) = estrndup(inval, found - inval);
- (*value) = estrdup(++found);
- } else {
- (*value) = estrdup(inval);
- (*namespace) = NULL;
- }
-
- return FALSE;
-}
diff --git a/ext/soap/php_xml.h b/ext/soap/php_xml.h
deleted file mode 100644
index dd08cde220..0000000000
--- a/ext/soap/php_xml.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef PHP_SOAP_XML_H
-#define PHP_SOAP_XML_H
-
-#define get_attribute(node, name) get_attribute_ex(node, name, NULL)
-#define get_node(node, name) get_node_ex(node, name, NULL)
-#define get_node_recursive(node, name) get_node_recursive_ex(node, name, NULL)
-#define get_node_with_attribute(node, name, attr, val) get_node_with_attribute_ex(node, name, NULL, attr, val, NULL)
-#define get_node_with_attribute_recursive(node, name, attr, val) get_node_with_attribute_recursive_ex(node, name, NULL, attr, val, NULL)
-#define node_is_equal(node, name) node_is_equal_ex(node, name, NULL)
-#define attr_is_equal(node, name) attr_is_equal_ex(node, name, NULL)
-
-xmlNsPtr attr_find_ns(xmlAttrPtr node);
-xmlNsPtr node_find_ns(xmlNodePtr node);
-int attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns);
-int node_is_equal_ex(xmlNodePtr node, char *name, char *ns);
-xmlAttrPtr get_attribute_ex(xmlAttrPtr node,char *name, char *ns);
-xmlNodePtr get_node_ex(xmlNodePtr node,char *name, char *ns);
-xmlNodePtr get_node_recursive_ex(xmlNodePtr node,char *name, char *ns);
-xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns);
-xmlNodePtr get_node_with_attribute_recursive_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns);
-int parse_namespace(const char *inval,char **value,char **namespace);
-xmlNodePtr check_and_resolve_href(xmlNodePtr data);
-
-int php_stream_xmlIO_match_wrapper(const char *filename);
-void *php_stream_xmlIO_open_wrapper(const char *filename);
-int php_stream_xmlIO_read(void *context, char *buffer, int len);
-int php_stream_xmlIO_close(void *context);
-
-#define FOREACHATTRNODE(n,c,i) \
- do { \
- if (n == NULL) { \
- break; \
- } \
- if (c) { \
- i = get_attribute(n,c); \
- } else { \
- i = n; \
- } \
- if (i != NULL) { \
- n = i;
-
-#define FOREACHNODE(n,c,i) \
- do { \
- if (n == NULL) { \
- break; \
- } \
- if (c) { \
- i = get_node(n,c); \
- } else { \
- i = n; \
- } \
- if(i != NULL) { \
- n = i;
-
-#define ENDFOREACH(n) \
- } \
- } while ((n = n->next));
-
-#endif
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
deleted file mode 100644
index f69c131b77..0000000000
--- a/ext/soap/soap.c
+++ /dev/null
@@ -1,2395 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "php_soap.h"
-#include "ext/session/php_session.h"
-
-static int le_sdl = 0;
-static int le_url = 0;
-static int le_service = 0;
-
-/* Local functions */
-static void function_to_string(sdlFunctionPtr function, smart_str *buf);
-static void type_to_string(sdlTypePtr type, smart_str *buf, int level);
-
-static void clear_soap_fault(zval *obj TSRMLS_DC);
-static void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC);
-
-static sdlParamPtr get_param(sdlFunctionPtr function, char *param_name, int index, int);
-static sdlFunctionPtr get_function(sdlPtr sdl, const char *function_name);
-
-static void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *function_name, int *num_params, zval **parameters[], int *version TSRMLS_DC);
-static xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_name,char *uri,zval *ret, int version TSRMLS_DC);
-static xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function, char *function_name, char *uri, zval **arguments, int arg_count, int version TSRMLS_DC);
-static xmlNodePtr seralize_parameter(sdlParamPtr param,zval *param_val,int index,char *name, int style TSRMLS_DC);
-static xmlNodePtr seralize_zval(zval *val, sdlParamPtr param, char *paramName, int style TSRMLS_DC);
-
-static void delete_service(void *service);
-static void delete_url(void *handle);
-
-#ifndef ZEND_ENGINE_2
-static void soap_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
-#endif
-
-static void soap_error_handler(int error_num, const char *error_filename, const uint error_lineno, const char *format, va_list args);
-
-#define SOAP_SERVER_BEGIN_CODE() \
- zend_bool old_handler = SOAP_GLOBAL(use_soap_error_handler);\
- SOAP_GLOBAL(use_soap_error_handler) = 1;
-
-#define SOAP_SERVER_END_CODE() \
- SOAP_GLOBAL(use_soap_error_handler) = old_handler
-
-#define HTTP_RAW_POST_DATA "HTTP_RAW_POST_DATA"
-
-#define ZERO_PARAM() \
- if (ZEND_NUM_ARGS() != 0) \
- WRONG_PARAM_COUNT;
-
-#define GET_THIS_OBJECT(o) \
- o = getThis(); \
- if (!o) { \
- php_error(E_WARNING, "Cannot Get Class Info"); \
- return; \
- }
-
-#define FETCH_THIS_SDL(ss) \
- { \
- zval *__thisObj,**__tmp; \
- GET_THIS_OBJECT(__thisObj) \
- if(FIND_SDL_PROPERTY(__thisObj,__tmp) != FAILURE) { \
- FETCH_SDL_RES(ss,__tmp); \
- } else { \
- ss = NULL; \
- } \
- }
-
-#define FIND_SDL_PROPERTY(ss,tmp) zend_hash_find(Z_OBJPROP_P(ss), "sdl", sizeof("sdl"), (void **)&tmp)
-#define FETCH_SDL_RES(ss,tmp) ss = (sdlPtr) zend_fetch_resource(tmp TSRMLS_CC, -1, "sdl", NULL, 1, le_sdl)
-
-#define FETCH_THIS_SERVICE(ss) \
- { \
- zval *__thisObj,**__tmp; \
- GET_THIS_OBJECT(__thisObj) \
- if(FIND_SERVICE_PROPERTY(__thisObj,__tmp) != FAILURE) { \
- FETCH_SERVICE_RES(ss,__tmp); \
- } else { \
- ss = NULL; \
- } \
- }
-
-#define FIND_SERVICE_PROPERTY(ss,tmp) zend_hash_find(Z_OBJPROP_P(ss), "service", sizeof("service"), (void **)&tmp)
-#define FETCH_SERVICE_RES(ss,tmp) ss = (soapServicePtr) zend_fetch_resource(tmp TSRMLS_CC, -1, "service", NULL, 1, le_service)
-
-static zend_class_entry* soap_class_entry;
-static zend_class_entry* soap_server_class_entry;
-static zend_class_entry* soap_fault_class_entry;
-zend_class_entry* soap_var_class_entry;
-zend_class_entry* soap_param_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_VAR_CLASSNAME "soapvar"
-#define PHP_SOAP_FAULT_CLASSNAME "soapfault"
-#define PHP_SOAP_PARAM_CLASSNAME "soapparam"
-
-PHP_MINIT_FUNCTION(soap);
-PHP_MSHUTDOWN_FUNCTION(soap);
-PHP_MINFO_FUNCTION(soap);
-
-#ifndef ZEND_ENGINE_2
-# ifndef PHP_METHOD
-# define PHP_METHOD(classname, name) ZEND_NAMED_FUNCTION(ZEND_FN(classname##_##name))
-# define PHP_ME(classname, name, arg_info, flags) ZEND_NAMED_FE(name, ZEND_FN(classname##_##name), arg_info)
-# endif
-
-static char *zend_str_tolower_copy(char *dest, const char *source, unsigned int length)
-{
- register unsigned char *str = (unsigned char*)source;
- register unsigned char *result = (unsigned char*)dest;
- register unsigned char *end = str + length;
-
- while (str < end) {
- *result++ = tolower((int)*str++);
- }
- *result = *end;
-
- return dest;
-}
-#endif
-
-/*
- Registry Functions
- TODO: this!
-*/
-PHP_FUNCTION(soap_encode_to_xml);
-PHP_FUNCTION(soap_encode_to_zval);
-PHP_FUNCTION(use_soap_error_handler);
-
-
-/* Server Functions */
-PHP_METHOD(soapserver,soapserver);
-PHP_METHOD(soapserver,setclass);
-PHP_METHOD(soapserver,addfunction);
-PHP_METHOD(soapserver,getfunctions);
-PHP_METHOD(soapserver,handle);
-PHP_METHOD(soapserver,setpersistence);
-PHP_METHOD(soapserver,bind);
-#ifdef HAVE_PHP_DOMXML
-PHP_METHOD(soapserver,map);
-#endif
-
-/* Client Functions */
-PHP_METHOD(soapobject, soapobject);
-PHP_METHOD(soapobject, __login);
-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);
-
-/* SoapVar Functions */
-PHP_METHOD(soapvar, soapvar);
-
-/* SoapFault Functions */
-PHP_METHOD(soapfault, soapfault);
-
-/* SoapParam Functions */
-PHP_METHOD(soapparam, soapparam);
-
-static zend_function_entry soap_functions[] = {
-#ifdef HAVE_PHP_DOMXML
- PHP_FE(soap_encode_to_xml, NULL)
- PHP_FE(soap_encode_to_zval, NULL)
-#endif
- PHP_FE(use_soap_error_handler, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_fault_functions[] = {
- PHP_ME(soapfault, soapfault, NULL, 0)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_server_functions[] = {
- PHP_ME(soapserver, soapserver, NULL, 0)
- PHP_ME(soapserver, setpersistence, NULL, 0)
- PHP_ME(soapserver, setclass, NULL, 0)
- PHP_ME(soapserver, addfunction, NULL, 0)
- PHP_ME(soapserver, getfunctions, NULL, 0)
- PHP_ME(soapserver, handle, NULL, 0)
- PHP_ME(soapserver, bind, NULL, 0)
-#ifdef HAVE_PHP_DOMXML
- PHP_ME(soapserver, map, NULL, 0)
-#endif
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_client_functions[] = {
- PHP_ME(soapobject, soapobject, NULL, 0)
- PHP_ME(soapobject, __login, NULL, 0)
- PHP_ME(soapobject, __isfault, NULL, 0)
- PHP_ME(soapobject, __getfault, NULL, 0)
- PHP_ME(soapobject, __call, NULL, 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)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_var_functions[] = {
- PHP_ME(soapvar, soapvar, NULL, 0)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_param_functions[] = {
- PHP_ME(soapparam, soapparam, NULL, 0)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry soap_module_entry = {
-#ifdef STANDARD_MODULE_HEADER
- STANDARD_MODULE_HEADER,
-#endif
- "soap",
- soap_functions,
- PHP_MINIT(soap),
- PHP_MSHUTDOWN(soap),
- NULL,
- NULL,
- PHP_MINFO(soap),
-#ifdef STANDARD_MODULE_HEADER
- NO_VERSION_YET,
-#endif
- STANDARD_MODULE_PROPERTIES,
-};
-
-#ifdef COMPILE_DL_SOAP
-ZEND_GET_MODULE(soap)
-#endif
-
-static void php_soap_init_globals(zend_soap_globals *soap_globals)
-{
- int i;
- long enc;
-
- soap_globals->sdls = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->sdls, 0, NULL, delete_sdl, 1);
-
- soap_globals->services = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->services, 0, NULL, delete_service, 1);
-
- soap_globals->defEnc = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEnc, 0, NULL, NULL, 1);
-
- soap_globals->defEncIndex = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEncIndex, 0, NULL, NULL, 1);
-
- soap_globals->defEncNs = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEncNs, 0, NULL, NULL, 1);
-
- soap_globals->defEncPrefix = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEncPrefix, 0, NULL, NULL, 1);
-
- soap_globals->overrides = NULL;
-
- i = 0;
- do {
- enc = (long)&defaultEncoding[i];
-
- /* If has a ns and a str_type then index it */
- if (defaultEncoding[i].details.type_str) {
- if (defaultEncoding[i].details.ns != NULL) {
- char *ns_type;
- ns_type = emalloc(strlen(defaultEncoding[i].details.ns) + strlen(defaultEncoding[i].details.type_str) + 2);
- sprintf(ns_type, "%s:%s", defaultEncoding[i].details.ns, defaultEncoding[i].details.type_str);
- zend_hash_add(soap_globals->defEnc, ns_type, strlen(ns_type) + 1, &enc, sizeof(encodePtr), NULL);
- efree(ns_type);
- } else {
- zend_hash_add(soap_globals->defEnc, defaultEncoding[i].details.type_str, strlen(defaultEncoding[i].details.type_str) + 1, &enc, sizeof(encodePtr), NULL);
- }
- }
- /* Index everything by number */
- if (!zend_hash_index_exists(soap_globals->defEncIndex, defaultEncoding[i].details.type)) {
- zend_hash_index_update(soap_globals->defEncIndex, defaultEncoding[i].details.type, &enc, sizeof(encodePtr), NULL);
- }
- i++;
- } while (defaultEncoding[i].details.type != END_KNOWN_TYPES);
-
- /* hash by namespace */
- zend_hash_add(soap_globals->defEncNs, XSD_1999_NAMESPACE, sizeof(XSD_1999_NAMESPACE), XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX), NULL);
- zend_hash_add(soap_globals->defEncNs, XSD_NAMESPACE, sizeof(XSD_NAMESPACE), XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX), NULL);
- zend_hash_add(soap_globals->defEncNs, APACHE_NAMESPACE, sizeof(APACHE_NAMESPACE), APACHE_NS_PREFIX, sizeof(APACHE_NS_PREFIX), NULL);
- zend_hash_add(soap_globals->defEncNs, SOAP_1_1_ENC_NAMESPACE, sizeof(SOAP_1_1_ENC_NAMESPACE), SOAP_1_1_ENC_NS_PREFIX, sizeof(SOAP_1_1_ENC_NS_PREFIX), NULL);
- zend_hash_add(soap_globals->defEncNs, SOAP_1_2_ENC_NAMESPACE, sizeof(SOAP_1_2_ENC_NAMESPACE), SOAP_1_2_ENC_NS_PREFIX, sizeof(SOAP_1_2_ENC_NS_PREFIX), NULL);
-
- /* and by prefix */
- zend_hash_add(soap_globals->defEncPrefix, XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX), XSD_NAMESPACE, sizeof(XSD_NAMESPACE), NULL);
- zend_hash_add(soap_globals->defEncPrefix, APACHE_NS_PREFIX, sizeof(APACHE_NS_PREFIX), APACHE_NAMESPACE, sizeof(APACHE_NAMESPACE), NULL);
- zend_hash_add(soap_globals->defEncPrefix, SOAP_1_1_ENC_NS_PREFIX, sizeof(SOAP_1_1_ENC_NS_PREFIX), SOAP_1_1_ENC_NAMESPACE, sizeof(SOAP_1_1_ENC_NAMESPACE), NULL);
- zend_hash_add(soap_globals->defEncPrefix, SOAP_1_2_ENC_NS_PREFIX, sizeof(SOAP_1_2_ENC_NS_PREFIX), SOAP_1_2_ENC_NAMESPACE, sizeof(SOAP_1_2_ENC_NAMESPACE), NULL);
-
- soap_globals->use_soap_error_handler = 0;
- soap_globals->sdl = NULL;
- soap_globals->soap_version = SOAP_1_1;
-}
-
-static void php_soap_del_globals(zend_soap_globals *soap_globals)
-{
-/* zend_hash_destroy(soap_globals->sdls);
- zend_hash_destroy(soap_globals->services);
- zend_hash_destroy(soap_globals->defEnc);
- zend_hash_destroy(soap_globals->defEncIndex);
- zend_hash_destroy(soap_globals->defEncNs);*/
-}
-
-PHP_MSHUTDOWN_FUNCTION(soap)
-{
- zend_error_cb = old_error_handler;
- zend_hash_destroy(SOAP_GLOBAL(sdls));
- zend_hash_destroy(SOAP_GLOBAL(services));
- zend_hash_destroy(SOAP_GLOBAL(defEnc));
- zend_hash_destroy(SOAP_GLOBAL(defEncIndex));
- zend_hash_destroy(SOAP_GLOBAL(defEncNs));
- zend_hash_destroy(SOAP_GLOBAL(defEncPrefix));
- return SUCCESS;
-}
-
-PHP_MINIT_FUNCTION(soap)
-{
- zend_class_entry ce;
-
- /* TODO: add ini entry for always use soap errors */
- ZEND_INIT_MODULE_GLOBALS(soap, php_soap_init_globals, php_soap_del_globals);
-
- /* Enable php stream/wrapper support for libxml */
- xmlRegisterDefaultInputCallbacks();
- xmlRegisterInputCallbacks(php_stream_xmlIO_match_wrapper, php_stream_xmlIO_open_wrapper,
- php_stream_xmlIO_read, php_stream_xmlIO_close);
-
- /* Register SoapObject 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).
- */
-#ifdef ZEND_ENGINE_2
- {
- zend_internal_function fe;
-
- fe.type = ZEND_INTERNAL_FUNCTION;
- fe.handler = zif_soapobject___call;
- fe.function_name = NULL;
- fe.scope = NULL;
- fe.fn_flags = 0;
- fe.prototype = NULL;
- fe.num_args = 2;
- fe.arg_info = NULL;
- fe.pass_rest_by_reference = 0;
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, PHP_SOAP_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);
- soap_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
-#endif
-
- /* Register SoapVar class */
- INIT_CLASS_ENTRY(ce, PHP_SOAP_VAR_CLASSNAME, soap_var_functions);
- soap_var_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
-
- /* Register SoapServer class */
- INIT_CLASS_ENTRY(ce, PHP_SOAP_SERVER_CLASSNAME, soap_server_functions);
- soap_server_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
-
- /* Register SoapFault class */
- INIT_CLASS_ENTRY(ce, PHP_SOAP_FAULT_CLASSNAME, soap_fault_functions);
- soap_fault_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
-
- /* Register SoapParam class */
- INIT_CLASS_ENTRY(ce, PHP_SOAP_PARAM_CLASSNAME, soap_param_functions);
- soap_param_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
-
- le_sdl = register_list_destructors(NULL, NULL);
- le_url = register_list_destructors(delete_url, NULL);
- le_service = register_list_destructors(delete_service, NULL);
-
- REGISTER_LONG_CONSTANT("SOAP_1_1", SOAP_1_1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_1_2", SOAP_1_2, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("SOAP_PERSISTENCE_SESSION", SOAP_PERSISTENCE_SESSION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_PERSISTENCE_REQUEST", SOAP_PERSISTENCE_REQUEST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_FUNCTIONS_ALL", SOAP_FUNCTIONS_ALL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("SOAP_ENCODED", SOAP_ENCODED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_LITERAL", SOAP_LITERAL, CONST_CS | CONST_PERSISTENT);
-
- 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("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_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);
- REGISTER_LONG_CONSTANT("XSD_FLOAT", XSD_FLOAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_DOUBLE", XSD_DOUBLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_DURATION", XSD_DURATION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_DATETIME", XSD_DATETIME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_TIME", XSD_TIME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_DATE", XSD_DATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GYEARMONTH", XSD_GYEARMONTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GYEAR", XSD_GYEAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GMONTHDAY", XSD_GMONTHDAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GDAY", XSD_GDAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GMONTH", XSD_GMONTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_HEXBINARY", XSD_HEXBINARY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_BASE64BINARY", XSD_BASE64BINARY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_ANYURI", XSD_ANYURI, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_QNAME", XSD_QNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NOTATION", XSD_NOTATION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NORMALIZEDSTRING", XSD_NORMALIZEDSTRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_TOKEN", XSD_TOKEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_LANGUAGE", XSD_LANGUAGE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NMTOKEN", XSD_NMTOKEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NAME", XSD_NAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NCNAME", XSD_NCNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_ID", XSD_ID, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_IDREF", XSD_IDREF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_IDREFS", XSD_IDREFS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_ENTITY", XSD_ENTITY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_ENTITIES", XSD_ENTITIES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_INTEGER", XSD_INTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NONPOSITIVEINTEGER", XSD_NONPOSITIVEINTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NEGATIVEINTEGER", XSD_NEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_LONG", XSD_LONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_INT", XSD_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_SHORT", XSD_SHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_BYTE", XSD_BYTE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NONNEGATIVEINTEGER", XSD_NONNEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_UNSIGNEDLONG", XSD_UNSIGNEDLONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_UNSIGNEDINT", XSD_UNSIGNEDINT, CONST_CS | CONST_PERSISTENT);
- 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);
-
- old_error_handler = zend_error_cb;
- zend_error_cb = soap_error_handler;
-
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(soap)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Soap Client", "enabled");
- php_info_print_table_row(2, "Soap Server", "enabled");
-#if HAVE_PHP_SESSION
- php_info_print_table_row(2, "Soap Serializer", "enabled");
-#endif
- php_info_print_table_end();
-}
-
-#ifdef HAVE_PHP_DOMXML
-PHP_FUNCTION(soap_encode_to_xml)
-{
- zval *pzval, *ret;
- encodePtr enc;
- char *name;
- int found, name_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &name_len, &pzval) == FAILURE) {
- php_error(E_ERROR, "wrong number of parameters to soap_encode_to_xml");
- }
-
- enc = get_conversion(Z_TYPE_P(pzval));
- ret = php_domobject_new(seralize_zval(pzval, NULL, name, SOAP_ENCODED), &found, NULL TSRMLS_CC);
- *return_value = *ret;
- zval_copy_ctor(return_value);
- zval_ptr_dtor(&ret);
-}
-
-PHP_FUNCTION(soap_encode_to_zval)
-{
- zval *dom, **addr, *ret;
- xmlNodePtr node;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &dom) == FAILURE) {
- php_error(E_ERROR, "wrong number of parameters to soap_encode_to_zval");
- }
-
- if (zend_hash_index_find(Z_OBJPROP_P(dom), 1, (void **)&addr) == FAILURE) {
- php_error(E_ERROR, "Cannot find domaddress to parameter passed to soap_encode_to_zval");
- }
-
- node = (xmlNodePtr)Z_LVAL_PP(addr);
- ret = master_to_zval(get_conversion(UNKNOWN_TYPE), node);
- *return_value = *ret;
-}
-#endif
-
-/* SoapParam functions */
-PHP_METHOD(soapparam,soapparam)
-{
- zval *thisObj, *data;
- char *name;
- int name_length;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &data, &name, &name_length) == FAILURE) {
- php_error(E_ERROR, "Invalid arguments to SoapParam constructor");
- }
-
- GET_THIS_OBJECT(thisObj);
-
-#ifndef ZEND_ENGINE_2
- zval_add_ref(&data);
-#endif
- add_property_stringl(thisObj, "param_name", name, name_length, 1);
- add_property_zval(thisObj, "param_data", data);
-}
-
-/* SoapFault functions */
-PHP_METHOD(soapfault,soapfault)
-{
- char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL;
- int fault_string_len, fault_code_len, fault_actor_len;
- zval *thisObj, *details = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|zs",
- &fault_code, &fault_code_len,
- &fault_string, &fault_string_len,
- &details, &fault_actor, &fault_actor_len) == FAILURE) {
- php_error(E_ERROR, "Invalid arguments to SoapFault constructor");
- }
-
- GET_THIS_OBJECT(thisObj);
-
- set_soap_fault(thisObj, fault_code, fault_string, fault_actor, details TSRMLS_CC);
-}
-
-/* SoapVar functions */
-PHP_METHOD(soapvar,soapvar)
-{
- zval *data, *thisObj, *type;
- char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL;
- int stype_len, ns_len, name_len, namens_len;
-
- GET_THIS_OBJECT(thisObj);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!z|ssss", &data, &type, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE) {
- php_error(E_ERROR, "Invalid arguments to SoapVar constructor");
- }
-
- if (Z_TYPE_P(type) == IS_NULL) {
- add_property_long(thisObj, "enc_type", UNKNOWN_TYPE);
- } else {
- if (zend_hash_index_exists(SOAP_GLOBAL(defEncIndex), Z_LVAL_P(type))) {
- add_property_long(thisObj, "enc_type", Z_LVAL_P(type));
- } else {
- php_error(E_ERROR, "Cannot find encoding for SoapVar");
- }
- }
-
- if (data) {
-#ifndef ZEND_ENGINE_2
- zval_add_ref(&data);
-#endif
- add_property_zval(thisObj, "enc_value", data);
- }
-
- if (stype && strlen(stype) > 0) {
- add_property_stringl(thisObj, "enc_stype", stype, stype_len, 1);
- }
- if (ns && strlen(ns) > 0) {
- add_property_stringl(thisObj, "enc_ns", ns, ns_len, 1);
- }
- if (name && strlen(name) > 0) {
- add_property_stringl(thisObj, "enc_name", name, name_len, 1);
- }
- if (namens && strlen(namens) > 0) {
- add_property_stringl(thisObj, "enc_namens", namens, namens_len, 1);
- }
-}
-
-/* SoapServer functions */
-PHP_METHOD(soapserver,soapserver)
-{
- zval *thisObj;
- soapServicePtr service;
- char *uri;
- int ret, uri_len;
-
- SOAP_SERVER_BEGIN_CODE();
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uri, &uri_len) == FAILURE) {
- php_error(E_ERROR, "Invalid arguments to SoapServer constructor");
- }
-
- GET_THIS_OBJECT(thisObj);
-
- service = emalloc(sizeof(soapService));
- memset(service, 0, sizeof(soapService));
-
- service->uri = estrndup(uri, uri_len);
- 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);
-
- ret = zend_list_insert(service, le_service);
- add_property_resource(thisObj, "service", ret);
- zend_list_addref(ret);
-
- SOAP_SERVER_END_CODE();
-}
-
-#define NULL_OR_STRING(zval) \
- (!zval || Z_TYPE_P(zval) == IS_NULL || Z_TYPE_P(zval) == IS_STRING)
-
-#define IS_VALID_FUNCTION(zval) \
- (zval && Z_TYPE_P(zval) != IS_NULL)
-
-#ifdef HAVE_PHP_DOMXML
-PHP_FUNCTION(SoapServer,map)
-{
- char *type, *class_name;
- zval *to_xml_before = NULL, *to_xml = NULL, *to_xml_after = NULL,
- *to_zval_before = NULL, *to_zval = NULL, *to_zval_after = NULL;
- int type_len, class_name_len;
- char *ns, *ctype;
- soapServicePtr service;
-
- SOAP_SERVER_BEGIN_CODE();
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sz|zzzzz",
- &type, &type_len, &to_xml_before, &to_xml, &to_xml_after, &to_zval_before, &to_zval,
- &to_zval_after) == SUCCESS && NULL_OR_STRING(to_xml_before) && NULL_OR_STRING(to_xml) &&
- NULL_OR_STRING(to_xml_after) && NULL_OR_STRING(to_zval_before) && NULL_OR_STRING(to_zval) &&
- NULL_OR_STRING(to_zval_after)) {
-
- soapMappingPtr map;
- encodePtr enc, new_enc;
- smart_str resloved_ns = {0};
-
- FETCH_THIS_SERVICE(service);
-
- new_enc = malloc(sizeof(encode));
- memset(new_enc, 0, sizeof(encode));
-
- ctype = strrchr(type, ':');
- if (ctype) {
- smart_str_appendl(&resloved_ns, type, ctype - type);
- smart_str_0(&resloved_ns);
- ctype++;
- } else {
- ns = NULL;
- }
-
- if (ns) {
- if (zend_hash_find(SOAP_GLOBAL(defEncPrefix), resloved_ns.c, resloved_ns.len + 1, &ns) == SUCCESS) {
- enc = get_encoder(service->sdl, ns, ctype);
- smart_str_free(&resloved_ns);
- smart_str_appendl(&resloved_ns, ns, strlen(ns));
- smart_str_appendc(&resloved_ns, ':');
- smart_str_appendl(&resloved_ns, ctype, strlen(ctype));
- smart_str_0(&resloved_ns);
- type = resloved_ns.c;
- type_len = resloved_ns.len;
- } else {
- enc = get_encoder_ex(service->sdl, type);
- }
- } else {
- enc = get_encoder_ex(service->sdl, type);
- }
-
- new_enc->details.type = enc->details.type;
- new_enc->details.ns = strdup(enc->details.ns);
- new_enc->details.type_str = strdup(enc->details.type_str);
- new_enc->details.sdl_type = enc->details.sdl_type;
- new_enc->to_xml = enc->to_xml;
- new_enc->to_zval = enc->to_zval;
- new_enc->to_xml_before = enc->to_xml_before;
- new_enc->to_zval_before = enc->to_zval_before;
- new_enc->to_xml_after = enc->to_xml_after;
- new_enc->to_zval_after = enc->to_zval_after;
-
- map = emalloc(sizeof(soapMapping));
- memset(map, 0, sizeof(soapMapping));
-
- map->type = SOAP_MAP_FUNCTION;
- if (IS_VALID_FUNCTION(to_xml_before)) {
- zval_add_ref(&to_xml_before);
- map->map_functions.to_xml_before = to_xml_before;
- new_enc->to_xml_before = to_xml_before_user;
- }
- if (IS_VALID_FUNCTION(to_xml)) {
- zval_add_ref(&to_xml);
- map->map_functions.to_xml = to_xml;
- new_enc->to_xml = to_xml_user;
- }
- if (IS_VALID_FUNCTION(to_xml_after)) {
- zval_add_ref(&to_xml_after);
- map->map_functions.to_xml_after = to_xml_after;
- new_enc->to_xml_after = to_xml_after_user;
- }
- if (IS_VALID_FUNCTION(to_zval_before)) {
- zval_add_ref(&to_zval_before);
- map->map_functions.to_zval_before = to_zval_before;
- new_enc->to_zval_before = to_zval_before_user;
- }
- if (IS_VALID_FUNCTION(to_zval)) {
- zval_add_ref(&to_zval);
- map->map_functions.to_zval = to_zval;
- new_enc->to_zval = to_zval_user;
- }
- if (IS_VALID_FUNCTION(to_zval_after)) {
- zval_add_ref(&to_zval_after);
- map->map_functions.to_zval_after = to_zval_after;
- new_enc->to_zval_after = to_zval_after_user;
- }
-
- new_enc->details.map = map;
-
- if (!service->mapping) {
- service->mapping = emalloc(sizeof(HashTable));
- zend_hash_init(service->mapping, 0, NULL, delete_encoder, 0);
- }
- zend_hash_update(service->mapping, type, type_len + 1, &new_enc, sizeof(encodePtr), NULL);
- smart_str_free(&resloved_ns);
- } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &type, &type_len, &class_name, &class_name_len, &type) == SUCCESS) {
- } else {
- php_error(E_ERROR, "Wrong number of parameters to 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;
- int value;
-
- SOAP_SERVER_BEGIN_CODE();
-
- FETCH_THIS_SERVICE(service);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) != FAILURE) {
- if (service->type == SOAP_CLASS) {
- if (value == SOAP_PERSISTENCE_SESSION ||
- value == SOAP_PERSISTENCE_REQUEST) {
- service->soap_class.persistance = value;
- } else {
- php_error(E_ERROR, "Tried to set persistence with bogus value (%d)", value);
- }
- } else {
- php_error(E_ERROR, "Tried to set persistence when you are using you SOAP SERVER in function mode, no persistence needed");
- }
- }
-
- SOAP_SERVER_END_CODE();
-}
-
-PHP_METHOD(soapserver,setclass)
-{
- soapServicePtr service;
- zend_class_entry *ce;
- char *class_name = NULL;
- int found, argc;
- zval ***argv;
-
- SOAP_SERVER_BEGIN_CODE();
-
- FETCH_THIS_SERVICE(service);
-
- argc = ZEND_NUM_ARGS();
- argv = emalloc(argc * sizeof(zval **));
-
- if (argc < 1 || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- efree(argv);
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(argv[0]) == IS_STRING) {
- class_name = estrdup(Z_STRVAL_PP(argv[0]));
-
- found = zend_hash_find(EG(class_table), php_strtolower(class_name, Z_STRLEN_PP(argv[0])), Z_STRLEN_PP(argv[0]) + 1, (void **)&ce);
- efree(class_name);
- if (found != FAILURE) {
- service->type = SOAP_CLASS;
-#ifdef ZEND_ENGINE_2
- service->soap_class.ce = *(zend_class_entry**)ce;
-#else
- service->soap_class.ce = ce;
-#endif
- service->soap_class.persistance = SOAP_PERSISTENCE_REQUEST;
- service->soap_class.argc = argc - 1;
- if (service->soap_class.argc > 0) {
- int i;
- service->soap_class.argv = emalloc(sizeof(zval) * service->soap_class.argc);
- for (i = 0;i < service->soap_class.argc;i++) {
- service->soap_class.argv[i] = *(argv[i + 1]);
- zval_add_ref(&service->soap_class.argv[i]);
- }
- }
- } else {
- php_error(E_ERROR, "Tried to set a non existant class (%s)", Z_STRVAL_PP(argv[0]));
- }
- } else {
- php_error(E_ERROR, "You must pass in a string to setclass");
- }
-
- efree(argv);
-
- SOAP_SERVER_END_CODE();
-}
-
-PHP_METHOD(soapserver,getfunctions)
-{
- soapServicePtr service;
- HashTable *ft = NULL;
-
- SOAP_SERVER_BEGIN_CODE();
-
- ZERO_PARAM()
- FETCH_THIS_SERVICE(service);
-
- array_init(return_value);
- if (service->type == SOAP_CLASS) {
- ft = &service->soap_class.ce->function_table;
- } else if (service->soap_functions.functions_all == TRUE) {
- ft = EG(function_table);
- } else if (service->soap_functions.ft != NULL) {
- zval **name;
- HashPosition pos;
-
- zend_hash_internal_pointer_reset_ex(service->soap_functions.ft, &pos);
- while (zend_hash_get_current_data_ex(service->soap_functions.ft, (void **)&name, &pos) != FAILURE) {
- add_next_index_string(return_value, Z_STRVAL_PP(name), 1);
- zend_hash_move_forward_ex(service->soap_functions.ft, &pos);
- }
- }
- if (ft != NULL) {
- zend_function *f;
- HashPosition pos;
- zend_hash_internal_pointer_reset_ex(ft, &pos);
- while (zend_hash_get_current_data_ex(ft, (void **)&f, &pos) != FAILURE) {
- add_next_index_string(return_value, f->common.function_name, 1);
- zend_hash_move_forward_ex(ft, &pos);
- }
- }
-
- SOAP_SERVER_END_CODE();
-}
-
-PHP_METHOD(soapserver, addfunction)
-{
- soapServicePtr service;
- zval *function_name, *function_copy;
- HashPosition pos;
-
- SOAP_SERVER_BEGIN_CODE();
-
- FETCH_THIS_SERVICE(service);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &function_name) == FAILURE) {
- php_error(E_ERROR, "Invalid parameters passed to addfunction");
- }
-
- /* TODO: could use zend_is_callable here */
-
- if (function_name->type == IS_ARRAY) {
- if (service->type == SOAP_FUNCTIONS) {
- zval **tmp_function, *function_copy;
-
- if (service->soap_functions.ft == NULL) {
- 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);
- }
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(function_name), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_P(function_name), (void **)&tmp_function, &pos) != FAILURE) {
- char *key;
- int key_len;
- zend_function *f;
-
- if (Z_TYPE_PP(tmp_function) != IS_STRING) {
- php_error(E_ERROR, "Tried to add a function that isn't a string");
- }
-
- key_len = Z_STRLEN_PP(tmp_function);
- key = emalloc(key_len + 1);
- zend_str_tolower_copy(key, Z_STRVAL_PP(tmp_function), key_len);
-
- if (zend_hash_find(EG(function_table), key, key_len+1, (void**)&f) == FAILURE) {
- php_error(E_ERROR, "Tried to add a non existant function (\"%s\")", Z_STRVAL_PP(tmp_function));
- }
-
- MAKE_STD_ZVAL(function_copy);
- ZVAL_STRING(function_copy, f->common.function_name, 1);
- zend_hash_update(service->soap_functions.ft, key, key_len+1, &function_copy, sizeof(zval *), NULL);
-
- efree(key);
- zend_hash_move_forward_ex(Z_ARRVAL_P(function_name), &pos);
- }
- }
- } else if (function_name->type == IS_STRING) {
- char *key;
- int key_len;
- zend_function *f;
-
- key_len = Z_STRLEN_P(function_name);
- key = emalloc(key_len + 1);
- zend_str_tolower_copy(key, Z_STRVAL_P(function_name), key_len);
-
- if (zend_hash_find(EG(function_table), key, key_len+1, (void**)&f) == FAILURE) {
- php_error(E_ERROR, "Tried to add a non existant function (\"%s\")", Z_STRVAL_P(function_name));
- }
- if (service->soap_functions.ft == NULL) {
- 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);
- }
-
- MAKE_STD_ZVAL(function_copy);
- ZVAL_STRING(function_copy, f->common.function_name, 1);
- zend_hash_update(service->soap_functions.ft, key, key_len+1, &function_copy, sizeof(zval *), NULL);
- efree(key);
- } else if (function_name->type == IS_LONG) {
- if (Z_LVAL_P(function_name) == SOAP_FUNCTIONS_ALL) {
- if (service->soap_functions.ft != NULL) {
- zend_hash_destroy(service->soap_functions.ft);
- efree(service->soap_functions.ft);
- service->soap_functions.ft = NULL;
- }
- service->soap_functions.functions_all = TRUE;
- } else {
- php_error(E_ERROR, "Invalid value passed to addfunction (%ld)", Z_LVAL_P(function_name));
- }
- }
-
- SOAP_SERVER_END_CODE();
-}
-
-PHP_METHOD(soapserver, handle)
-{
- int soap_version, old_soap_version;
- sdlPtr old_sdl = NULL;
- soapServicePtr service;
- xmlDocPtr doc_request, doc_return;
- zval function_name, **params, **raw_post, *soap_obj, retval, **server_vars;
- char *fn_name, cont_len[30];
- int num_params = 0, size, i, call_status = 0;
- xmlChar *buf;
- HashTable *function_table;
-
- SOAP_SERVER_BEGIN_CODE();
-
- FETCH_THIS_SERVICE(service);
- ZERO_PARAM();
- INIT_ZVAL(retval);
-
- if (zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **)&server_vars) == SUCCESS) {
- zval **req_method, **query_string;
- if (zend_hash_find(Z_ARRVAL_PP(server_vars), "REQUEST_METHOD", sizeof("REQUEST_METHOD"), (void **)&req_method) == SUCCESS) {
- if (!strcmp(Z_STRVAL_PP(req_method), "GET") && zend_hash_find(Z_ARRVAL_PP(server_vars), "QUERY_STRING", sizeof("QUERY_STRING"), (void **)&query_string) == SUCCESS) {
- if (strstr(Z_STRVAL_PP(query_string), "wsdl") != NULL ||
- strstr(Z_STRVAL_PP(query_string), "WSDL") != NULL) {
- if (service->sdl) {
-/*
- char *hdr = emalloc(sizeof("Location: ")+strlen(service->sdl->source));
- strcpy(hdr,"Location: ");
- strcat(hdr,service->sdl->source);
- sapi_add_header(hdr, sizeof("Location: ")+strlen(service->sdl->source)-1, 1);
- efree(hdr);
-*/
- zval readfile, readfile_ret, *param;
-
- INIT_ZVAL(readfile);
- INIT_ZVAL(readfile_ret);
- MAKE_STD_ZVAL(param);
-
- sapi_add_header("Content-Type: text/xml; charset=\"utf-8\"", sizeof("Content-Type: text/xml; charset=\"utf-8\""), 1);
- ZVAL_STRING(param, service->sdl->source, 1);
- ZVAL_STRING(&readfile, "readfile", 1);
- if (call_user_function(EG(function_table), NULL, &readfile, &readfile_ret, 1, &param TSRMLS_CC) == FAILURE) {
- php_error(E_ERROR, "Couldn't find WSDL");
- }
-
- zval_ptr_dtor(&param);
- zval_dtor(&readfile);
- zval_dtor(&readfile_ret);
-
- SOAP_SERVER_END_CODE();
- return;
- } else {
- php_error(E_ERROR, "WSDL generation is not supported yet");
-/*
- sapi_add_header("Content-Type: text/xml; charset=\"utf-8\"", sizeof("Content-Type: text/xml; charset=\"utf-8\""), 1);
- PUTS("<?xml version=\"1.0\" ?>\n<definitions\n");
- PUTS(" xmlns=\"http://schemas.xmlsoap.org/wsdl/\"\n");
- PUTS(" targetNamespace=\"");
- PUTS(service->uri);
- PUTS("\">\n");
- PUTS("</definitions>");
-*/
- SOAP_SERVER_END_CODE();
- return;
- }
- }
- }
- }
- }
-
-/* Turn on output buffering... we don't want people print in their methods
- #if PHP_API_VERSION <= 20010901
- if (php_start_ob_buffer(NULL, 0 TSRMLS_CC) != SUCCESS)
- #else
-*/
- if (php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC) != SUCCESS) {
-/* #endif */
- php_error(E_ERROR,"ob_start failed");
- }
-
- if (zend_hash_find(&EG(symbol_table), HTTP_RAW_POST_DATA, sizeof(HTTP_RAW_POST_DATA), (void **) &raw_post)!=FAILURE
- && ((*raw_post)->type==IS_STRING)) {
- int old_error_reporting = EG(error_reporting);
- EG(error_reporting) &= ~(E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
-
- doc_request = xmlParseMemory(Z_STRVAL_PP(raw_post),Z_STRLEN_PP(raw_post));
- xmlCleanupParser();
-
- EG(error_reporting) = old_error_reporting;
-
- if (doc_request == NULL) {
- php_error(E_ERROR, "Bad Request");
- }
- if (xmlGetIntSubset(doc_request) != NULL) {
- php_error(E_ERROR,"DTD are not supported by SOAP");
- }
-
- old_sdl = SOAP_GLOBAL(sdl);
- SOAP_GLOBAL(sdl) = service->sdl;
- old_soap_version = SOAP_GLOBAL(soap_version);
- deseralize_function_call(service->sdl, doc_request, &function_name, &num_params, &params, &soap_version TSRMLS_CC);
- xmlFreeDoc(doc_request);
-
- if (service->type == SOAP_CLASS) {
- soap_obj = NULL;
-#if HAVE_PHP_SESSION
- /* If persistent then set soap_obj from from the previous created session (if available) */
- if (service->soap_class.persistance == SOAP_PERSISTENCE_SESSION) {
- zval **tmp_soap;
-
- if (PS(session_status) != php_session_active &&
- PS(session_status) != php_session_disabled) {
- php_session_start(TSRMLS_C);
- }
-
- /* Find the soap object and assign */
- if (zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), "_bogus_session_name", sizeof("_bogus_session_name"), (void **) &tmp_soap) == SUCCESS) {
- soap_obj = *tmp_soap;
- }
- }
-#endif
- /* If new session or something wierd happned */
- if (soap_obj == NULL) {
- zval *tmp_soap;
- char *class_name;
- int class_name_len;
-
- MAKE_STD_ZVAL(tmp_soap);
- object_init_ex(tmp_soap, service->soap_class.ce);
-
- /* Call constructor */
- class_name_len = strlen(service->soap_class.ce->name);
- class_name = emalloc(class_name_len+1);
- memcpy(class_name, service->soap_class.ce->name,class_name_len+1);
- if (zend_hash_exists(&Z_OBJCE_P(tmp_soap)->function_table, php_strtolower(class_name, class_name_len), class_name_len+1)) {
- zval c_ret, constructor;
-
- INIT_ZVAL(c_ret);
- INIT_ZVAL(constructor);
-
- ZVAL_STRING(&constructor, service->soap_class.ce->name, 1);
- if (call_user_function(NULL, &tmp_soap, &constructor, &c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) == FAILURE) {
- php_error(E_ERROR, "Error calling constructor");
- }
- zval_dtor(&constructor);
- zval_dtor(&c_ret);
- }
- efree(class_name);
-#if HAVE_PHP_SESSION
- /* If session then update session hash with new object */
- if (service->soap_class.persistance == SOAP_PERSISTENCE_SESSION) {
- zval **tmp_soap_pp;
- if (zend_hash_update(Z_ARRVAL_P(PS(http_session_vars)), "_bogus_session_name", sizeof("_bogus_session_name"), &tmp_soap, sizeof(zval *), (void **)&tmp_soap_pp) == SUCCESS) {
- soap_obj = *tmp_soap_pp;
- }
- } else {
- soap_obj = tmp_soap;
- }
-#else
- soap_obj = tmp_soap;
-#endif
-
- }
-/* function_table = &(soap_obj->value.obj.ce->function_table);*/
- function_table = &((Z_OBJCE_P(soap_obj))->function_table);
- } else {
- if (service->soap_functions.functions_all == TRUE) {
- function_table = EG(function_table);
- } else {
- function_table = service->soap_functions.ft;
- }
- }
-
- doc_return = NULL;
-
- fn_name = estrndup(Z_STRVAL(function_name),Z_STRLEN(function_name));
- if (zend_hash_exists(function_table, php_strtolower(fn_name, Z_STRLEN(function_name)), Z_STRLEN(function_name) + 1)) {
- if (service->type == SOAP_CLASS) {
- call_status = call_user_function(NULL, &soap_obj, &function_name, &retval, num_params, params TSRMLS_CC);
- if (service->soap_class.persistance != SOAP_PERSISTENCE_SESSION) {
- zval_ptr_dtor(&soap_obj);
- }
- } else {
- call_status = call_user_function(EG(function_table), NULL, &function_name, &retval, num_params, params TSRMLS_CC);
- }
- } else {
- php_error(E_ERROR, "Function (%s) doesn't exist", Z_STRVAL(function_name));
- }
- efree(fn_name);
-
- if (call_status == SUCCESS) {
- sdlFunctionPtr function;
- char *response_name;
- function = get_function(service->sdl, Z_STRVAL(function_name));
- if (function && function->responseName) {
- response_name = estrdup(function->responseName);
- } else {
- response_name = emalloc(Z_STRLEN(function_name) + strlen("Response") + 1);
- sprintf(response_name,"%sResponse",Z_STRVAL(function_name));
- }
- SOAP_GLOBAL(overrides) = service->mapping;
- doc_return = seralize_response_call(function, response_name, service->uri, &retval, soap_version TSRMLS_CC);
- SOAP_GLOBAL(overrides) = NULL;
- efree(response_name);
- } else {
- php_error(E_ERROR, "Function (%s) call failed", Z_STRVAL(function_name));
- }
-
- SOAP_GLOBAL(soap_version) = old_soap_version;
- SOAP_GLOBAL(sdl) = old_sdl;
-
- /* Flush buffer */
- php_end_ob_buffer(0, 0 TSRMLS_CC);
-
- /* xmlDocDumpMemoryEnc(doc_return, &buf, &size, XML_CHAR_ENCODING_UTF8); */
- xmlDocDumpMemory(doc_return, &buf, &size);
-
- if (size == 0) {
- php_error(E_ERROR, "Dump memory failed");
- }
-
- sprintf(cont_len, "Content-Length: %d", size);
- if (soap_version == SOAP_1_2) {
- sapi_add_header("Content-Type: application/soap+xml; charset=\"utf-8\"", sizeof("Content-Type: application/soap+xml; charset=\"utf-8\""), 1);
- } else {
- sapi_add_header("Content-Type: text/xml; charset=\"utf-8\"", sizeof("Content-Type: text/xml; charset=\"utf-8\""), 1);
- }
- sapi_add_header(cont_len, strlen(cont_len) + 1, 1);
-
- /* Free Memory */
- if (num_params > 0) {
- for (i = 0; i < num_params;i++) {
- zval_ptr_dtor(&params[i]);
- }
- efree(params);
- }
-
- zval_dtor(&function_name);
- xmlFreeDoc(doc_return);
-
- php_write(buf, size TSRMLS_CC);
- xmlFree(buf);
- } else {
- if (!zend_ini_long("always_populate_raw_post_data", sizeof("always_populate_raw_post_data"), 0)) {
- php_error(E_ERROR, "PHP-SOAP requires 'always_populate_raw_post_data' to be on please check your php.ini file");
- }
-
- php_error(E_ERROR, "Can't find HTTP_RAW_POST_DATA");
- }
-
- zval_dtor(&retval);
-
- SOAP_SERVER_END_CODE();
-}
-
-static void soap_error_handler(int error_num, const char *error_filename, const uint error_lineno, const char *format, va_list args)
-{
- char buffer[1024];
- int buffer_len;
- int soap_version;
- TSRMLS_FETCH();
-
- if (!SOAP_GLOBAL(use_soap_error_handler)) {
- old_error_handler(error_num, error_filename, error_lineno, format, args);
- return;
- }
- soap_version = SOAP_GLOBAL(soap_version);
- buffer_len = vsnprintf(buffer, sizeof(buffer)-1, format, args);
- buffer[sizeof(buffer)-1]=0;
- if (buffer_len > sizeof(buffer) - 1 || buffer_len < 0) {
- buffer_len = sizeof(buffer) - 1;
- }
-
- /*
- Trap all errors
- What do do with these warnings
- E_WARNING, E_NOTICE, E_CORE_WARNING, E_COMPILE_WARNING, E_USER_WARNING, E_USER_NOTICE
- */
- if (error_num == E_USER_ERROR || error_num == E_COMPILE_ERROR || error_num == E_CORE_ERROR ||
- error_num == E_ERROR || error_num == E_PARSE) {
- zval outbuf, outbuflen, ret;
- xmlChar *buf, cont_len[30];
- int size;
- xmlDocPtr doc_return;
-
- INIT_ZVAL(outbuf);
- INIT_ZVAL(outbuflen);
- INIT_ZVAL(ret);
-
- /* Get output buffer and send as fault detials */
- if (php_ob_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_LVAL(outbuflen) != 0) {
- php_ob_get_buffer(&outbuf TSRMLS_CC);
- }
- php_end_ob_buffer(0, 0 TSRMLS_CC);
-
- set_soap_fault(&ret, "Server", buffer, NULL, &outbuf TSRMLS_CC);
- doc_return = seralize_response_call(NULL, NULL, NULL, &ret, soap_version TSRMLS_CC);
-
- /* Build and send our headers + http 500 status */
- /*
- xmlDocDumpMemoryEnc(doc_return, &buf, &size, XML_CHAR_ENCODING_UTF8);
- */
- xmlDocDumpMemory(doc_return, &buf, &size);
- sprintf(cont_len,"Content-Length: %d", size);
- sapi_add_header(cont_len, strlen(cont_len) + 1, 1);
- if (soap_version == SOAP_1_2) {
- sapi_add_header("Content-Type: application/soap+xml; charset=\"utf-8\"", sizeof("Content-Type: application/soap+xml; charset=\"utf-8\""), 1);
- } else {
- sapi_add_header("Content-Type: text/xml; charset=\"utf-8\"", sizeof("Content-Type: text/xml; charset=\"utf-8\""), 1);
- }
- /*
- Want to return HTTP 500 but apache wants to over write
- our fault code with their own handling... Figure this out later
- sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error"), 1);
- */
- php_write(buf, size TSRMLS_CC);
-
- xmlFreeDoc(doc_return);
- xmlFree(buf);
-
- zval_dtor(&outbuf);
- zval_dtor(&outbuflen);
-/* ???
- zval_dtor(&ret);
-*/
- zend_bailout();
- }
-}
-
-PHP_FUNCTION(use_soap_error_handler)
-{
- zend_bool handler = 1;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &handler) == SUCCESS) {
- SOAP_GLOBAL(use_soap_error_handler) = handler;
- }
-}
-
-
-/* SoapObject functions */
-/*
- SoapObject($wsdl, $version=SOAP_1_1)
- SoapObject($location, $uri, $style=SOAP_RPC, $use=SOAP_ENCODED, $version=SOAP_1_1)
-*/
-PHP_METHOD(soapobject, soapobject)
-{
- char *location;
- int location_len;
- zval *thisObj;
- zval *arg2 = NULL;
- long use = SOAP_RPC;
- long style = SOAP_ENCODED;
- long version = SOAP_1_1;
- long old_soap_version ;
-
- GET_THIS_OBJECT(thisObj);
-
- 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(thisObj, "_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);
-
- add_property_resource(thisObj, "sdl", ret);
- zend_list_addref(ret);
-
- SOAP_GLOBAL(soap_version) = old_soap_version;
-
- } 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(thisObj, "location", location, location_len, 1);
- add_property_stringl(thisObj, "uri", Z_STRVAL_P(arg2), Z_STRLEN_P(arg2), 1);
- if (style == SOAP_RPC || style == SOAP_DOCUMENT) {
- add_property_long(thisObj, "style", style);
- } else {
- php_error(E_ERROR,"Can't create SoapObject. Wrong 'style' parameter.");
- }
- if (use == SOAP_ENCODED || use == SOAP_LITERAL) {
- add_property_long(thisObj, "use", use);
- } else {
- php_error(E_ERROR,"Can't create SoapObject. Wrong 'use' parameter.");
- }
- if (version == SOAP_1_1 || version == SOAP_1_2) {
- add_property_long(thisObj, "_soap_version", version);
- } else {
- php_error(E_ERROR,"Can't create SoapObject. Wrong 'version' parameter.");
- }
- } else {
- php_error(E_ERROR,"Can't create SoapObject. Wrong parameters.");
- }
- }
-}
-
-PHP_METHOD(soapobject, __trace)
-{
- int level;
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &level)) {
- php_error(E_ERROR, "Invalid arguments to SoapObject->__trace");
- }
-
- add_property_long(thisObj, "trace", level);
- RETURN_TRUE;
-}
-
-static void do_soap_call(zval* thisObj,
- char* function,
- int function_len,
- int arg_count,
- zval** real_args,
- zval* return_value
- TSRMLS_DC)
-{
- zval **tmp;
- zval **trace;
- sdlPtr sdl = NULL;
- sdlPtr old_sdl = NULL;
- sdlFunctionPtr fn;
- xmlDocPtr request = NULL;
- char *buffer;
- int len;
- int ret = FALSE;
- int soap_version, old_soap_version;
-
- if (zend_hash_find(Z_OBJPROP_P(thisObj), "trace", sizeof("trace"), (void **) &trace) == SUCCESS
- && Z_LVAL_PP(trace) > 0) {
- zend_hash_del(Z_OBJPROP_P(thisObj), "__last_request", sizeof("__last_request"));
- zend_hash_del(Z_OBJPROP_P(thisObj), "__last_response", sizeof("__last_response"));
- }
- if (zend_hash_find(Z_OBJPROP_P(thisObj), "_soap_version", sizeof("_soap_version"), (void **) &tmp) == SUCCESS
- && Z_LVAL_PP(tmp) == SOAP_1_2) {
- soap_version = SOAP_1_2;
- } else {
- soap_version = SOAP_1_1;
- }
-
- if (FIND_SDL_PROPERTY(thisObj,tmp) != FAILURE) {
- FETCH_SDL_RES(sdl,tmp);
- }
-
- clear_soap_fault(thisObj TSRMLS_CC);
-
- old_soap_version = SOAP_GLOBAL(soap_version);
-zend_try {
- SOAP_GLOBAL(soap_version) = soap_version;
- old_sdl = SOAP_GLOBAL(sdl);
- SOAP_GLOBAL(sdl) = sdl;
- if (sdl != NULL) {
- fn = get_function(sdl, function);
- if (fn != NULL) {
- sdlBindingPtr binding = fn->binding;
- if (binding->bindingType == BINDING_SOAP) {
- sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes;
- request = seralize_function_call(thisObj, fn, NULL, fnb->input.ns, real_args, arg_count, soap_version TSRMLS_CC);
- ret = send_http_soap_request(thisObj, request, binding->location, fnb->soapAction, soap_version TSRMLS_CC);
- } else {
- request = seralize_function_call(thisObj, fn, NULL, sdl->target_ns, real_args, arg_count, soap_version TSRMLS_CC);
- ret = send_http_soap_request(thisObj, request, binding->location, NULL, soap_version TSRMLS_CC);
- }
-
- xmlFreeDoc(request);
-
- if (ret) {
- ret = get_http_soap_response(thisObj, &buffer, &len TSRMLS_CC);
- if (ret) {
- parse_packet_soap(thisObj, buffer, len, fn, NULL, return_value TSRMLS_CC);
- efree(buffer);
- }
- }
- } else {
- smart_str error = {0};
- smart_str_appends(&error,"Function (\"");
- smart_str_appends(&error,function);
- smart_str_appends(&error,"\") is not a valid method for this service");
- smart_str_0(&error);
- add_soap_fault(thisObj, "Client", error.c, NULL, NULL TSRMLS_CC);
- smart_str_free(&error);
- }
- } else {
- zval **uri, **location;
- smart_str *action;
-
- if (zend_hash_find(Z_OBJPROP_P(thisObj), "uri", sizeof("uri"), (void *)&uri) == FAILURE) {
- add_soap_fault(thisObj, "Client", "Error finding \"uri\" property", NULL, NULL TSRMLS_CC);
- } else if (zend_hash_find(Z_OBJPROP_P(thisObj), "location", sizeof("location"),(void **) &location) == FAILURE) {
- add_soap_fault(thisObj, "Client", "Error could not find \"location\" property", NULL, NULL TSRMLS_CC);
- } else {
- request = seralize_function_call(thisObj, NULL, function, Z_STRVAL_PP(uri), real_args, arg_count, soap_version TSRMLS_CC);
- action = build_soap_action(thisObj, function);
- ret = send_http_soap_request(thisObj, request, Z_STRVAL_PP(location), action->c, soap_version TSRMLS_CC);
-
- smart_str_free(action);
- efree(action);
- xmlFreeDoc(request);
-
- if (ret) {
- ret = get_http_soap_response(thisObj, &buffer, &len TSRMLS_CC);
- if (ret) {
- ret = parse_packet_soap(thisObj, buffer, len, NULL, function, return_value TSRMLS_CC);
- efree(buffer);
- }
- }
- }
- }
-} zend_catch {
- ret = FALSE;
-} zend_end_try();
- if (!ret) {
- zval** fault;
- if (zend_hash_find(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) {
- *return_value = **fault;
- zval_copy_ctor(return_value);
- } else {
- *return_value = *add_soap_fault(thisObj, "Client", "Unknown Error", NULL, NULL TSRMLS_CC);
- zval_copy_ctor(return_value);
- }
- } else {
- zval** fault;
- if (zend_hash_find(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) {
- *return_value = **fault;
- zval_copy_ctor(return_value);
- }
- }
- SOAP_GLOBAL(soap_version) = old_soap_version;
- SOAP_GLOBAL(sdl) = old_sdl;
-}
-
-PHP_METHOD(soapobject, __login)
-{
- char *login_name;
- char *login_pass;
- int login_name_len;
- int login_pass_len;
- zval* thisObj;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss",
- &login_name, &login_name_len, &login_pass, &login_pass_len) == FAILURE) {
- return;
- }
- GET_THIS_OBJECT(thisObj);
- add_property_stringl(thisObj,"_login",login_name,login_name_len, 1);
- add_property_stringl(thisObj,"_password",login_pass,login_pass_len, 1);
-}
-
-
-PHP_METHOD(soapobject, __call)
-{
- char *function, *soap_action, *uri;
- int function_len, soap_action_len, uri_len, i = 0;
- zval *args;
- zval **real_args;
- zval **param;
- int arg_count;
- zval *thisObj;
-
- HashPosition pos;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|ss",
- &function, &function_len, &args, &soap_action, &soap_action_len, &uri, &uri_len) == FAILURE) {
- php_error(E_ERROR, "Invalid arguments to SoapObject->__call");
- }
-
- arg_count = zend_hash_num_elements(Z_ARRVAL_P(args));
-
- real_args = emalloc(sizeof(zval *) * arg_count);
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(args), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_P(args), (void **) &param, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_P(args), &pos)) {
- /*zval_add_ref(param);*/
- real_args[i++] = *param;
- }
- GET_THIS_OBJECT(thisObj);
- do_soap_call(thisObj, function, function_len, arg_count, real_args, return_value TSRMLS_CC);
-
- efree(real_args);
-}
-
-PHP_METHOD(soapobject, __isfault)
-{
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- if (zend_hash_exists(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault"))) {
- RETURN_TRUE
- } else {
- RETURN_FALSE
- }
-}
-
-PHP_METHOD(soapobject, __getfault)
-{
- zval *thisObj;
- zval **tmp;
-
- GET_THIS_OBJECT(thisObj);
-
- if (zend_hash_find(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault"), (void **)&tmp) == SUCCESS) {
- *return_value = *(*tmp);
- zval_copy_ctor(return_value);
- return;
- }
- RETURN_NULL();
-}
-
-PHP_METHOD(soapobject, __getfunctions)
-{
- sdlPtr sdl;
- zval *thisObj;
- HashPosition pos;
-
- GET_THIS_OBJECT(thisObj);
-
- FETCH_THIS_SDL(sdl);
-
- if (sdl) {
- smart_str buf = {0};
- sdlFunctionPtr *function;
-
- array_init(return_value);
- zend_hash_internal_pointer_reset_ex(&sdl->functions, &pos);
- while (zend_hash_get_current_data_ex(&sdl->functions, (void **)&function, &pos) != FAILURE) {
- function_to_string((*function), &buf);
- add_next_index_stringl(return_value, buf.c, buf.len, 1);
- smart_str_free(&buf);
- zend_hash_move_forward_ex(&sdl->functions, &pos);
- }
- }
-}
-
-PHP_METHOD(soapobject, __gettypes)
-{
- sdlPtr sdl;
- zval *thisObj;
- HashPosition pos;
-
- GET_THIS_OBJECT(thisObj);
-
- FETCH_THIS_SDL(sdl);
-
- if (sdl) {
- sdlTypePtr *type;
- smart_str buf = {0};
-
- array_init(return_value);
- if (sdl->types) {
- zend_hash_internal_pointer_reset_ex(sdl->types, &pos);
- while (zend_hash_get_current_data_ex(sdl->types, (void **)&type, &pos) != FAILURE) {
- type_to_string((*type), &buf, 0);
- add_next_index_stringl(return_value, buf.c, buf.len, 1);
- zend_hash_move_forward_ex(sdl->types, &pos);
- smart_str_free(&buf);
- }
- }
- }
-}
-
-PHP_METHOD(soapobject, __getlastrequest)
-{
- zval *thisObj;
- zval **tmp;
-
- GET_THIS_OBJECT(thisObj);
-
- if (zend_hash_find(Z_OBJPROP_P(thisObj), "__last_request", sizeof("__last_request"), (void **)&tmp) == SUCCESS) {
- RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
- }
- RETURN_NULL();
-}
-
-PHP_METHOD(soapobject, __getlastresponse)
-{
- zval *thisObj;
- zval **tmp;
-
- GET_THIS_OBJECT(thisObj);
-
- if (zend_hash_find(Z_OBJPROP_P(thisObj), "__last_response", sizeof("__last_response"), (void **)&tmp) == SUCCESS) {
- RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
- }
- RETURN_NULL();
-}
-
-#ifndef ZEND_ENGINE_2
-static void soap_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *)property_reference->elements_list->tail->data;
- zval *thisObj;
- char *function = Z_STRVAL(function_name->element);
- zend_function *builtin_function;
-
- GET_THIS_OBJECT(thisObj);
-
- /*
- Find if the function being called is already defined...
- ( IMHO: zend should handle this functionality )
- */
- if (zend_hash_find(&Z_OBJCE_P(thisObj)->function_table, function, Z_STRLEN(function_name->element) + 1, (void **) &builtin_function) == SUCCESS) {
- builtin_function->internal_function.handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- } else {
- int arg_count = ZEND_NUM_ARGS();
- zval **arguments = (zval **) emalloc(sizeof(zval *) * arg_count);
-
- zend_get_parameters_array(ht, arg_count, arguments);
- do_soap_call(thisObj, function, Z_STRLEN(function_name->element) + 1, arg_count, arguments, return_value TSRMLS_CC);
- efree(arguments);
- }
- zval_dtor(&function_name->element);
-}
-#endif
-
-static void clear_soap_fault(zval *obj TSRMLS_DC)
-{
- if (obj != NULL && obj->type == IS_OBJECT) {
-/* zend_hash_del(obj->value.obj.properties, "__soap_fault", sizeof("__soap_fault"));*/
- zend_hash_del(Z_OBJPROP_P(obj), "__soap_fault", sizeof("__soap_fault"));
- }
-}
-
-zval* add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC)
-{
- zval *fault;
- MAKE_STD_ZVAL(fault);
- set_soap_fault(fault, fault_code, fault_string, fault_actor, fault_detail TSRMLS_CC);
-#ifdef ZEND_ENGINE_2
- fault->refcount--; /*FIXME*/
-#endif
- add_property_zval(obj, "__soap_fault", fault);
- return fault;
-}
-
-static void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC)
-{
- if (Z_TYPE_P(obj) != IS_OBJECT) {
- object_init_ex(obj, soap_fault_class_entry);
- }
- if (fault_string != NULL) {
- add_property_string(obj, "faultstring", fault_string, 1);
- }
- if (fault_code != NULL) {
- int soap_version = SOAP_GLOBAL(soap_version);
- smart_str code = {0};
- if (soap_version == SOAP_1_1) {
- if (strcmp(fault_code,"Client") == 0) {
- smart_str_appendl(&code, SOAP_1_1_ENV_NS_PREFIX, sizeof(SOAP_1_1_ENV_NS_PREFIX)-1);
- smart_str_appendc(&code, ':');
- } else if (strcmp(fault_code,"Server") == 0) {
- smart_str_appendl(&code, SOAP_1_1_ENV_NS_PREFIX, sizeof(SOAP_1_1_ENV_NS_PREFIX)-1);
- smart_str_appendc(&code, ':');
- }
- smart_str_appends(&code,fault_code);
- } else if (soap_version == SOAP_1_2) {
- if (strcmp(fault_code,"Client") == 0) {
- smart_str_appendl(&code, SOAP_1_2_ENV_NS_PREFIX, sizeof(SOAP_1_2_ENV_NS_PREFIX)-1);
- smart_str_appendc(&code, ':');
- smart_str_appendl(&code,"Sencer",sizeof("Sender")-1);
- } else if (strcmp(fault_code,"Server") == 0) {
- smart_str_appendl(&code, SOAP_1_2_ENV_NS_PREFIX, sizeof(SOAP_1_2_ENV_NS_PREFIX)-1);
- smart_str_appendc(&code, ':');
- smart_str_appendl(&code,"Receiver",sizeof("Receiver")-1);
- } else {
- smart_str_appends(&code,fault_code);
- }
- }
- smart_str_0(&code);
- add_property_string(obj, "faultcode", code.c, 1);
- smart_str_free(&code);
- }
- if (fault_actor != NULL) {
- add_property_string(obj, "faultactor", fault_actor, 1);
- }
- if (fault_detail != NULL) {
- add_property_zval(obj, "detail", fault_detail);
- }
-}
-
-static void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *function_name, int *num_params, zval ***parameters, int *version TSRMLS_DC)
-{
- char* envelope_ns = NULL;
- xmlNodePtr trav,env,head,body,func;
- int cur_param = 0,num_of_params = 0;
- zval tmp_function_name, **tmp_parameters = NULL;
- sdlFunctionPtr function;
-
- ZVAL_EMPTY_STRING(function_name);
-
- /* Get <Envelope> element */
- env = NULL;
- trav = request->children;
- while (trav != NULL) {
- if (trav->type == XML_ELEMENT_NODE) {
- if (env == NULL && node_is_equal_ex(trav,"Envelope",SOAP_1_1_ENV_NAMESPACE)) {
- env = trav;
- *version = SOAP_1_1;
- envelope_ns = SOAP_1_1_ENV_NAMESPACE;
- SOAP_GLOBAL(soap_version) = SOAP_1_1;
- } else if (env == NULL && node_is_equal_ex(trav,"Envelope",SOAP_1_2_ENV_NAMESPACE)) {
- env = trav;
- *version = SOAP_1_2;
- envelope_ns = SOAP_1_2_ENV_NAMESPACE;
- SOAP_GLOBAL(soap_version) = SOAP_1_2;
- } else {
- php_error(E_ERROR,"looks like we got bad SOAP request\n");
- }
- }
- trav = trav->next;
- }
- if (env == NULL) {
- php_error(E_ERROR,"looks like we got XML without \"Envelope\" element\n");
- }
-
- /* Get <Header> element */
- head = NULL;
- trav = env->children;
- while (trav != NULL && trav->type != XML_ELEMENT_NODE) {
- trav = trav->next;
- }
- if (trav != NULL && node_is_equal_ex(trav,"Header",envelope_ns)) {
- head = trav;
- trav = trav->next;
- }
-
- /* Get <Body> element */
- body = NULL;
- while (trav != NULL) {
- if (trav->type == XML_ELEMENT_NODE) {
- if (body == NULL && node_is_equal_ex(trav,"Body",envelope_ns)) {
- body = trav;
- } else {
- php_error(E_ERROR,"looks like we got bad SOAP request\n");
- }
- }
- trav = trav->next;
- }
- if (body == NULL) {
- php_error(E_ERROR,"looks like we got \"Envelope\" without \"Body\" element\n");
- }
-
- func = NULL;
- trav = body->children;
- while (trav != NULL) {
- if (trav->type == XML_ELEMENT_NODE) {
- if (func != NULL) {
- php_error(E_ERROR,"looks like we got \"Body\" with several functions call\n");
- }
- func = trav;
- }
- trav = trav->next;
- }
- if (func == NULL) {
- php_error(E_ERROR,"looks like we got \"Body\" without function call\n");
- }
-
- function = get_function(sdl, func->name);
- if (sdl != NULL && function == NULL) {
- php_error(E_ERROR, "Error function \"%s\" doesn't exists for this service", func->name);
- }
-
- INIT_ZVAL(tmp_function_name);
- if (function != NULL) {
- ZVAL_STRING(&tmp_function_name, (char *)function->functionName, 1);
- } else{
- ZVAL_STRING(&tmp_function_name, (char *)func->name, 1);
- }
-
- (*function_name) = tmp_function_name;
-
- if (function != NULL) {
- sdlParamPtr *param;
- xmlNodePtr val;
- int use_names = 0;
-
- num_of_params = zend_hash_num_elements(function->requestParameters);
- zend_hash_internal_pointer_reset(function->requestParameters);
- while (zend_hash_get_current_data(function->requestParameters, (void **)&param) == SUCCESS) {
- zend_hash_move_forward(function->requestParameters);
- if (get_node(func->children, (*param)->paramName) != NULL) {
- use_names = 1;
- }
- zend_hash_move_forward(function->requestParameters);
- }
- if (use_names) {
- tmp_parameters = emalloc(num_of_params * sizeof(zval *));
- zend_hash_internal_pointer_reset(function->requestParameters);
- while (zend_hash_get_current_data(function->requestParameters, (void **)&param) == SUCCESS) {
- val = get_node(func->children, (*param)->paramName);
- if (!val) {
- /* TODO: may be "nil" is not OK? */
- MAKE_STD_ZVAL(tmp_parameters[cur_param]);
- ZVAL_NULL(tmp_parameters[cur_param]);
- } else {
- tmp_parameters[cur_param] = master_to_zval((*param)->encode, val);
- }
- cur_param++;
-
- zend_hash_move_forward(function->requestParameters);
- }
- (*parameters) = tmp_parameters;
- (*num_params) = num_of_params;
- return;
- }
- }
- if (func->children) {
- num_of_params = 0;
- trav = func->children;
- while (trav != NULL) {
- if (trav->type == XML_ELEMENT_NODE) {
- num_of_params++;
- }
- trav = trav->next;
- }
- if (num_of_params > 0) {
- tmp_parameters = emalloc(num_of_params * sizeof(zval *));
-
- trav = func->children;
- while (trav != 0 && cur_param < num_of_params) {
- if (trav->type == XML_ELEMENT_NODE) {
- encodePtr enc;
- sdlParamPtr *param = NULL;
- if (function != NULL &&
- zend_hash_index_find(function->requestParameters, cur_param, (void **)&param) == FAILURE) {
- php_error(E_ERROR, "Error cannot find parameter");
- }
- if (param == NULL) {
- enc = get_conversion(UNKNOWN_TYPE);
- } else {
- enc = (*param)->encode;
- }
- tmp_parameters[cur_param] = master_to_zval(enc, trav);
- cur_param++;
- }
- trav = trav->next;
- }
- }
- }
- (*parameters) = tmp_parameters;
- (*num_params) = num_of_params;
-}
-
-static xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_name, char *uri, zval *ret, int version TSRMLS_DC)
-{
- xmlDoc *doc;
- xmlNode *envelope = NULL, *body,*method = NULL, *param;
- xmlNs *ns = NULL;
- sdlParamPtr parameter = NULL;
- smart_str *gen_ns = NULL;
- int param_count;
- int style, use;
-
- encode_reset_ns();
-
- doc = xmlNewDoc("1.0");
- doc->charset = XML_CHAR_ENCODING_UTF8;
- doc->encoding = xmlStrdup((xmlChar*)"UTF-8");
-
- if (version == SOAP_1_1) {
- envelope = xmlNewDocNode(doc, NULL, SOAP_1_1_ENV_NS_PREFIX":Envelope", NULL);
- ns = xmlNewNs(envelope, SOAP_1_1_ENV_NAMESPACE, SOAP_1_1_ENV_NS_PREFIX);
- } else if (version == SOAP_1_2) {
- envelope = xmlNewDocNode(doc, NULL, SOAP_1_2_ENV_NS_PREFIX":Envelope", NULL);
- ns = xmlNewNs(envelope, SOAP_1_2_ENV_NAMESPACE, SOAP_1_2_ENV_NS_PREFIX);
- } else {
- php_error(E_ERROR, "Unknown SOAP version");
- }
- doc->children = envelope;
-
- body = xmlNewChild(envelope, ns, "Body", NULL);
-
- if (Z_TYPE_P(ret) == IS_OBJECT &&
- Z_OBJCE_P(ret) == soap_fault_class_entry) {
- use = SOAP_ENCODED;
- if (version == SOAP_1_1) {
- param = seralize_zval(ret, NULL, SOAP_1_1_ENV_NS_PREFIX":Fault", use TSRMLS_CC);
- } else {
- param = seralize_zval(ret, NULL, SOAP_1_2_ENV_NS_PREFIX":Fault", use TSRMLS_CC);
- }
- xmlAddChild(body, param);
- } else {
- gen_ns = encode_new_ns();
-
- if (function != NULL && function->binding->bindingType == BINDING_SOAP) {
- sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes;
-
- style = fnb->style;
- use = fnb->output.use;
- if (style == SOAP_RPC) {
- ns = xmlNewNs(body, fnb->output.ns, gen_ns->c);
- if (function->responseName) {
- method = xmlNewChild(body, ns, function->responseName, NULL);
- } else {
- method = xmlNewChild(body, ns, function->functionName, NULL);
- }
- }
- } else {
- style = SOAP_RPC;
- use = SOAP_ENCODED;
- ns = xmlNewNs(body, uri, gen_ns->c);
- method = xmlNewChild(body, ns, function_name, NULL);
- }
-
- if (function != NULL) {
- if (function->responseParameters) {
- param_count = zend_hash_num_elements(function->responseParameters);
- } else {
- param_count = 0;
- }
- } else {
- param_count = 1;
- }
-
- if (param_count == 1) {
- parameter = get_param(function, NULL, 0, TRUE);
-
- param = seralize_parameter(parameter, ret, 0, "return", use TSRMLS_CC);
- if (style == SOAP_RPC) {
- xmlAddChild(method,param);
- } else {
- if (function && function->binding->bindingType == BINDING_SOAP) {
- sdlParamPtr *sparam;
-
- if (zend_hash_index_find(function->responseParameters, 0, (void **)&sparam) == SUCCESS) {
- ns = xmlNewNs(param, (*sparam)->encode->details.ns, gen_ns->c);
- xmlNodeSetName(param, (*sparam)->encode->details.type_str);
- xmlSetNs(param, ns);
- }
- }
- xmlAddChild(body, param);
- }
- } else if (param_count > 1 && Z_TYPE_P(ret) == IS_ARRAY) {
- HashPosition pos;
- zval **data;
- int i = 0;
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(ret), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_P(ret), (void **)&data, &pos) != FAILURE) {
- char *param_name;
- int param_name_len;
- long param_index;
-
- zend_hash_get_current_key_ex(Z_ARRVAL_P(ret), &param_name, &param_name_len, &param_index, 0, &pos);
- parameter = get_param(function, param_name, param_index, TRUE);
-
- param = seralize_parameter(parameter, *data, i, param_name, use TSRMLS_CC);
- if (style == SOAP_RPC) {
- xmlAddChild(method,param);
- } else {
- if (function && function->binding->bindingType == BINDING_SOAP) {
- sdlParamPtr *sparam;
-
- if (zend_hash_index_find(function->responseParameters, i, (void **)&sparam) == SUCCESS) {
- ns = xmlNewNs(param, (*sparam)->encode->details.ns, gen_ns->c);
- xmlNodeSetName(param, (*sparam)->encode->details.type_str);
- xmlSetNs(param, ns);
- }
- }
- xmlAddChild(body, param);
- }
-
- zend_hash_move_forward_ex(Z_ARRVAL_P(ret), &pos);
- i++;
- }
- }
- }
-
-/* FIXME: if use="literal" SOAP-ENV:encodingStyle is not need.
- What about arrayType?
-*/
- if (use == SOAP_ENCODED) {
- xmlSetProp(envelope, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
- xmlSetProp(envelope, "xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
- xmlSetProp(envelope, "xmlns:" APACHE_NS_PREFIX , APACHE_NAMESPACE);
- if (version == SOAP_1_1) {
- xmlSetProp(envelope, "xmlns:"SOAP_1_1_ENC_NS_PREFIX, SOAP_1_1_ENC_NAMESPACE);
- xmlSetProp(envelope, SOAP_1_1_ENV_NS_PREFIX":encodingStyle", SOAP_1_1_ENC_NAMESPACE);
- } else if (version == SOAP_1_2) {
- xmlSetProp(envelope, "xmlns:"SOAP_1_2_ENC_NS_PREFIX, SOAP_1_2_ENC_NAMESPACE);
- if (method) {
- xmlSetProp(method, SOAP_1_2_ENV_NS_PREFIX":encodingStyle", SOAP_1_2_ENC_NAMESPACE);
- }
- }
- }
-
- if (gen_ns) {
- smart_str_free(gen_ns);
- efree(gen_ns);
- }
-
- return doc;
-}
-
-static xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function, char *function_name, char *uri, zval **arguments, int arg_count, int version TSRMLS_DC)
-{
- xmlDoc *doc;
- xmlNode *envelope = NULL, *body, *method = NULL;
- xmlNs *ns = NULL;
- zval **zstyle, **zuse;
- int i, style, use;
- smart_str *gen_ns;
-
- encode_reset_ns();
-
- doc = xmlNewDoc("1.0");
- doc->encoding = xmlStrdup((xmlChar*)"UTF-8");
- doc->charset = XML_CHAR_ENCODING_UTF8;
- if (version == SOAP_1_1) {
- envelope = xmlNewDocNode(doc, NULL, SOAP_1_1_ENV_NS_PREFIX":Envelope", NULL);
- ns = xmlNewNs(envelope, SOAP_1_1_ENV_NAMESPACE, SOAP_1_1_ENV_NS_PREFIX);
- } else if (version == SOAP_1_2) {
- envelope = xmlNewDocNode(doc, NULL, SOAP_1_2_ENV_NS_PREFIX":Envelope", NULL);
- ns = xmlNewNs(envelope, SOAP_1_2_ENV_NAMESPACE, SOAP_1_2_ENV_NS_PREFIX);
- } else {
- php_error(E_ERROR, "Unknown SOAP version");
- }
- xmlDocSetRootElement(doc, envelope);
-
- body = xmlNewChild(envelope, ns, "Body", NULL);
-
- gen_ns = encode_new_ns();
-
- if (function && function->binding->bindingType == BINDING_SOAP) {
- sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes;
-
- style = fnb->style;
- /*FIXME: how to pass method name if style is SOAP_DOCUMENT */
- /*style = SOAP_RPC;*/
- use = fnb->input.use;
- if (style == SOAP_RPC) {
- ns = xmlNewNs(body, fnb->input.ns, gen_ns->c);
- if (function->requestName) {
- method = xmlNewChild(body, ns, function->requestName, NULL);
- } else {
- method = xmlNewChild(body, ns, function->functionName, NULL);
- }
- }
- } else {
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "style", sizeof("style"), (void **)&zstyle) == SUCCESS) {
- style = Z_LVAL_PP(zstyle);
- } else {
- style = SOAP_RPC;
- }
- /*FIXME: how to pass method name if style is SOAP_DOCUMENT */
- /*style = SOAP_RPC;*/
- if (style == SOAP_RPC) {
- ns = xmlNewNs(body, uri, gen_ns->c);
- method = xmlNewChild(body, ns, function_name, NULL);
- }
-
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "use", sizeof("use"), (void **)&zuse) == SUCCESS &&
- Z_LVAL_PP(zuse) == SOAP_LITERAL) {
- use = SOAP_LITERAL;
- } else {
- use = SOAP_ENCODED;
- }
- }
-
-/* FIXME: if use="literal" SOAP-ENV:encodingStyle is not need.
- What about arrayType?
-*/
- if (use == SOAP_ENCODED) {
- xmlSetProp(envelope, "xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
- xmlSetProp(envelope, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
- xmlSetProp(envelope, "xmlns:" APACHE_NS_PREFIX , APACHE_NAMESPACE);
- if (version == SOAP_1_1) {
- xmlSetProp(envelope, "xmlns:"SOAP_1_1_ENC_NS_PREFIX, SOAP_1_1_ENC_NAMESPACE);
- xmlSetProp(envelope, SOAP_1_1_ENV_NS_PREFIX":encodingStyle", SOAP_1_1_ENC_NAMESPACE);
- } else if (version == SOAP_1_2) {
- xmlSetProp(envelope, "xmlns:"SOAP_1_2_ENC_NS_PREFIX, SOAP_1_2_ENC_NAMESPACE);
- if (method) {
- xmlSetProp(method, SOAP_1_2_ENV_NS_PREFIX":encodingStyle", SOAP_1_2_ENC_NAMESPACE);
- }
- }
- }
-
- for (i = 0;i < arg_count;i++) {
- xmlNodePtr param;
- sdlParamPtr parameter = get_param(function, NULL, i, FALSE);
-
- param = seralize_parameter(parameter, arguments[i], i, NULL, use TSRMLS_CC);
-
- if (style == SOAP_RPC) {
- xmlAddChild(method, param);
- } else if (style == SOAP_DOCUMENT) {
- if (function && function->binding->bindingType == BINDING_SOAP) {
- sdlParamPtr *sparam;
-
- if (zend_hash_index_find(function->requestParameters, i, (void **)&sparam) == SUCCESS) {
- ns = xmlNewNs(param, (*sparam)->encode->details.ns, gen_ns->c);
- xmlNodeSetName(param, (*sparam)->encode->details.type_str);
- xmlSetNs(param, ns);
- }
- }
- xmlAddChild(body, param);
- }
- }
- smart_str_free(gen_ns);
- efree(gen_ns);
-
- return doc;
-}
-
-static xmlNodePtr seralize_parameter(sdlParamPtr param, zval *param_val, int index, char *name, int style TSRMLS_DC)
-{
- char *paramName;
- xmlNodePtr xmlParam;
-
- if (Z_TYPE_P(param_val) == IS_OBJECT &&
- Z_OBJCE_P(param_val) == soap_param_class_entry) {
- zval **param_name;
- zval **param_data;
-
- if (zend_hash_find(Z_OBJPROP_P(param_val), "param_name", sizeof("param_name"), (void **)&param_name) == SUCCESS &&
- zend_hash_find(Z_OBJPROP_P(param_val), "param_data", sizeof("param_data"), (void **)&param_data) == SUCCESS) {
- param_val = *param_data;
- name = Z_STRVAL_PP(param_name);
- }
- }
-
- if (param != NULL && param->paramName != NULL) {
- paramName = estrdup(param->paramName);
- } else {
- if (name == NULL) {
- paramName = emalloc(10);
- sprintf(paramName,"param%d",index);
- } else {
- paramName = estrdup(name);
- }
- }
-
- xmlParam = seralize_zval(param_val, param, paramName, style TSRMLS_CC);
-
- efree(paramName);
-
- return xmlParam;
-}
-
-static xmlNodePtr seralize_zval(zval *val, sdlParamPtr param, char *paramName, int style TSRMLS_DC)
-{
- xmlNodePtr xmlParam;
- encodePtr enc;
-
- if (param != NULL) {
- enc = param->encode;
- } else {
- enc = get_conversion(val->type);
- }
- xmlParam = master_to_xml(enc, val, style);
- if (!strcmp(xmlParam->name, "BOGUS")) {
- xmlNodeSetName(xmlParam, paramName);
- }
- return xmlParam;
-}
-
-static sdlParamPtr get_param(sdlFunctionPtr function, char *param_name, int index, int response)
-{
- sdlParamPtr *tmp;
- HashTable *ht;
-
- if (function == NULL) {
- return NULL;
- }
-
- if (response == FALSE) {
- ht = function->requestParameters;
- } else {
- ht = function->responseParameters;
- }
-
- if (param_name != NULL) {
- if (zend_hash_find(ht, param_name, strlen(param_name), (void **)&tmp) != FAILURE) {
- return *tmp;
- }
- } else {
- if (zend_hash_index_find(ht, index, (void **)&tmp) != FAILURE) {
- return (*tmp);
- }
- }
- return NULL;
-}
-
-static sdlFunctionPtr get_function(sdlPtr sdl, const char *function_name)
-{
- sdlFunctionPtr *tmp;
-
- int len = strlen(function_name);
- char *str = estrndup(function_name,len);
- php_strtolower(str,len);
- if (sdl != NULL) {
- if (zend_hash_find(&sdl->functions, str, len+1, (void **)&tmp) != FAILURE) {
- efree(str);
- return (*tmp);
- } else if (sdl->requests != NULL && zend_hash_find(sdl->requests, str, len+1, (void **)&tmp) != FAILURE) {
- efree(str);
- return (*tmp);
- }
- }
- efree(str);
- return NULL;
-}
-
-static void function_to_string(sdlFunctionPtr function, smart_str *buf)
-{
- int i = 0;
- HashPosition pos;
-
- if (function->responseParameters && function->responseParameters->pListHead) {
- sdlParamPtr *param;
- param = function->responseParameters->pListHead->pData;
- if ((*param)->encode->details.type_str) {
- smart_str_appendl(buf, (*param)->encode->details.type_str, strlen((*param)->encode->details.type_str));
- smart_str_appendc(buf, ' ');
- } else {
- smart_str_appendl(buf, "mixed ", 6);
- }
- } else {
- smart_str_appendl(buf, "void ", 5);
- }
-
- smart_str_appendl(buf, function->functionName, strlen(function->functionName));
-
- smart_str_appendc(buf, '(');
- if (function->requestParameters) {
- sdlParamPtr *param;
-
- i = 0;
- zend_hash_internal_pointer_reset_ex(function->requestParameters, &pos);
- while (zend_hash_get_current_data_ex(function->requestParameters, (void **)&param, &pos) != FAILURE) {
- if ((*param)->encode->details.type_str) {
- smart_str_appendl(buf, (*param)->encode->details.type_str, strlen((*param)->encode->details.type_str));
- } else {
- smart_str_appendl(buf, "mixed ", 6);
- }
- smart_str_appendc(buf, ' ');
- smart_str_appendc(buf, '$');
- smart_str_appendl(buf, (*param)->paramName, strlen((*param)->paramName));
- if (zend_hash_num_elements(function->requestParameters) > i + 1) {
- smart_str_appendl(buf, ", ", 2);
- }
- zend_hash_move_forward_ex(function->requestParameters, &pos);
- i++;
- }
- }
- smart_str_appendc(buf, ')');
- smart_str_0(buf);
-}
-
-static void type_to_string(sdlTypePtr type, smart_str *buf, int level)
-{
- int i;
- smart_str spaces = {0};
- HashPosition pos;
-
- for (i = 0;i < level;i++) {
- smart_str_appendc(&spaces, ' ');
- }
- smart_str_appendl(buf, spaces.c, spaces.len);
-
- if (type->elements) {
- sdlTypePtr *t_type;
-
- smart_str_appendl(buf, "struct ", 7);
- smart_str_appendl(buf, type->name, strlen(type->name));
- smart_str_appendc(buf, '\n');
- smart_str_appendl(buf, spaces.c, spaces.len);
- smart_str_appendl(buf, "{\n", 2);
-
- zend_hash_internal_pointer_reset_ex(type->elements, &pos);
- level++;
- while (zend_hash_get_current_data_ex(type->elements, (void **)&t_type, &pos) != FAILURE) {
- type_to_string((*t_type), buf, level);
- zend_hash_move_forward_ex(type->elements, &pos);
- }
-
- smart_str_appendl(buf, spaces.c, spaces.len);
- smart_str_appendl(buf, "}\n", 2);
- } else {
- smart_str_appendl(buf, type->encode->details.type_str, strlen(type->encode->details.type_str));
- smart_str_appendc(buf, ' ');
- smart_str_appendl(buf, type->name, strlen(type->name));
- smart_str_appendl(buf, ";\n", 2);
- }
- smart_str_free(&spaces);
- smart_str_0(buf);
-}
-
-static void delete_url(void *handle)
-{
- php_url_free((php_url*)handle);
-}
-
-static void delete_service(void *data)
-{
- soapServicePtr service = (soapServicePtr)data;
-
- if (service->soap_functions.ft) {
- zend_hash_destroy(service->soap_functions.ft);
- efree(service->soap_functions.ft);
- }
-
- if (service->mapping) {
- zend_hash_destroy(service->mapping);
- efree(service->mapping);
- }
-
- if (service->soap_class.argc) {
- int i;
- for (i = 0; i < service->soap_class.argc;i++) {
- zval_ptr_dtor(&service->soap_class.argv[i]);
- }
- efree(service->soap_class.argv);
- }
-
- efree(service->uri);
- efree(service);
-}
diff --git a/ext/soap/tests/server001.phpt b/ext/soap/tests/server001.phpt
deleted file mode 100644
index 462a8960aa..0000000000
--- a/ext/soap/tests/server001.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-SOAP Server 1: new/addfunction/handle
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-function test() {
- return "Hello World";
-}
-
-$server = new soapserver("http://testuri.org");
-$server->addfunction("test");
-
-$HTTP_RAW_POST_DATA = <<<EOF
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<SOAP-ENV:Envelope
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:si="http://soapinterop.org/xsd">
- <SOAP-ENV:Body>
- <ns1:test xmlns:ns1="http://testuri.org" />
- </SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-EOF;
-$server->handle();
-echo "ok\n";
-?>
---EXPECT--
-<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:apache="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body xmlns:ns1="http://testuri.org"><ns1:testResponse><return xsi:type="xsd:string">Hello World</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
-ok
diff --git a/ext/soap/tests/server002.phpt b/ext/soap/tests/server002.phpt
deleted file mode 100644
index 757fbf5437..0000000000
--- a/ext/soap/tests/server002.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-SOAP Server 2: function with parameters and result
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-function Add($x,$y) {
- return $x+$y;
-}
-
-$server = new soapserver("http://testuri.org");
-$server->addfunction("Add");
-
-$HTTP_RAW_POST_DATA = <<<EOF
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<SOAP-ENV:Envelope
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:si="http://soapinterop.org/xsd">
- <SOAP-ENV:Body>
- <ns1:Add xmlns:ns1="http://testuri.org">
- <x xsi:type="xsd:int">22</x>
- <y xsi:type="xsd:int">33</y>
- </ns1:Add>
- </SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-EOF;
-
-$server->handle();
-echo "ok\n";
-?>
---EXPECT--
-<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:apache="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body xmlns:ns1="http://testuri.org"><ns1:AddResponse><return xsi:type="xsd:int">55</return></ns1:AddResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
-ok
diff --git a/ext/soap/tests/server003.phpt b/ext/soap/tests/server003.phpt
deleted file mode 100644
index d47fc30d0d..0000000000
--- a/ext/soap/tests/server003.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-SOAP Server 3: all functions
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-$server = new soapserver("http://testuri.org");
-$server->addfunction(SOAP_FUNCTIONS_ALL);
-
-$HTTP_RAW_POST_DATA = <<<EOF
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<SOAP-ENV:Envelope
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:si="http://soapinterop.org/xsd">
- <SOAP-ENV:Body>
- <ns1:strlen xmlns:ns1="http://testuri.org">
- <x xsi:type="xsd:string">Hello World</x>
- </ns1:strlen>
- </SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-EOF;
-
-$server->handle();
-echo "ok\n";
-?>
---EXPECT--
-<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:apache="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body xmlns:ns1="http://testuri.org"><ns1:strlenResponse><return xsi:type="xsd:int">11</return></ns1:strlenResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
-ok
diff --git a/ext/soap/tests/server004.phpt b/ext/soap/tests/server004.phpt
deleted file mode 100644
index 92b714f513..0000000000
--- a/ext/soap/tests/server004.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-SOAP Server 4: addfunctions
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-function Add($x,$y) {
- return $x+$y;
-}
-function Sub($x,$y) {
- return $x-$y;
-}
-
-$server = new soapserver("http://testuri.org");
-$server->addfunction(array("Sub","Add"));
-
-$HTTP_RAW_POST_DATA = <<<EOF
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<SOAP-ENV:Envelope
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:si="http://soapinterop.org/xsd">
- <SOAP-ENV:Body>
- <ns1:Add xmlns:ns1="http://testuri.org">
- <x xsi:type="xsd:int">22</x>
- <y xsi:type="xsd:int">33</y>
- </ns1:Add>
- </SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-EOF;
-
-$server->handle();
-echo "ok\n";
-?>
---EXPECT--
-<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:apache="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body xmlns:ns1="http://testuri.org"><ns1:AddResponse><return xsi:type="xsd:int">55</return></ns1:AddResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
-ok
diff --git a/ext/soap/tests/server005.phpt b/ext/soap/tests/server005.phpt
deleted file mode 100644
index 476422bd0b..0000000000
--- a/ext/soap/tests/server005.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-SOAP Server 5: setclass
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-class Foo {
- function test() {
- return "Hello World";
- }
-}
-
-$server = new soapserver("http://testuri.org");
-$server->setclass("Foo");
-
-$HTTP_RAW_POST_DATA = <<<EOF
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<SOAP-ENV:Envelope
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:si="http://soapinterop.org/xsd">
- <SOAP-ENV:Body>
- <ns1:test xmlns:ns1="http://testuri.org" />
- </SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-EOF;
-
-$server->handle();
-echo "ok\n";
-?>
---EXPECT--
-<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:apache="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body xmlns:ns1="http://testuri.org"><ns1:testResponse><return xsi:type="xsd:string">Hello World</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
-ok
diff --git a/ext/soap/tests/server006.phpt b/ext/soap/tests/server006.phpt
deleted file mode 100644
index 88c855e82e..0000000000
--- a/ext/soap/tests/server006.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-SOAP Server 6: setclass with constructor
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-class Foo {
- private $str = "";
-
- function Foo($str) {
- $this->str = $str . " World";
- }
-
- function test() {
- return $this->str;
- }
-}
-
-$server = new soapserver("http://testuri.org");
-$server->setclass("Foo","Hello");
-
-$HTTP_RAW_POST_DATA = <<<EOF
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<SOAP-ENV:Envelope
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:si="http://soapinterop.org/xsd">
- <SOAP-ENV:Body>
- <ns1:test xmlns:ns1="http://testuri.org" />
- </SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-EOF;
-
-$server->handle();
-echo "ok\n";
-?>
---EXPECT--
-<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:apache="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body xmlns:ns1="http://testuri.org"><ns1:testResponse><return xsi:type="xsd:string">Hello World</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
-ok
diff --git a/ext/soap/tests/server007.phpt b/ext/soap/tests/server007.phpt
deleted file mode 100644
index 113ddac4a3..0000000000
--- a/ext/soap/tests/server007.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-SOAP Server 7: addfunction and getfunctions
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-function Add($x,$y) {
- return $x+$y;
-}
-function Sub($x,$y) {
- return $x-$y;
-}
-
-$server = new soapserver("http://testuri.org");
-$server->addfunction(array("Sub","Add"));
-var_dump($server->getfunctions());
-echo "ok\n";
-?>
---EXPECT--
-array(2) {
- [0]=>
- string(3) "Sub"
- [1]=>
- string(3) "Add"
-}
-ok
diff --git a/ext/soap/tests/server008.phpt b/ext/soap/tests/server008.phpt
deleted file mode 100644
index 73f91f3891..0000000000
--- a/ext/soap/tests/server008.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-SOAP Server 8: setclass and getfunctions
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-class Foo {
-
- function Foo() {
- }
-
- function test() {
- return $this->str;
- }
-}
-
-$server = new soapserver("http://testuri.org");
-$server->setclass("Foo");
-var_dump($server->getfunctions());
-echo "ok\n";
-?>
---EXPECT--
-array(2) {
- [0]=>
- string(3) "Foo"
- [1]=>
- string(4) "test"
-}
-ok
diff --git a/ext/soap/tests/server009.phpt b/ext/soap/tests/server009.phpt
deleted file mode 100644
index 661fa7dc21..0000000000
--- a/ext/soap/tests/server009.phpt
+++ /dev/null
@@ -1,66 +0,0 @@
---TEST--
-SOAP Server 9: setclass and setpersistence(SOAP_PERSISTENCE_SESSION)
---SKIPIF--
-<?php
- require_once('skipif.inc');
- if (!extension_loaded('session')) {
- die('skip this test needs session extension');
- }
-?>
---FILE--
-<?php
-class foo {
- private $sum = 0;
-
- function Sum($num) {
- return $this->sum += $num;
- }
-}
-
-$server = new soapserver("http://testuri.org");
-$server->setclass("foo");
-$server->setpersistence(SOAP_PERSISTENCE_SESSION);
-
-ob_start();
-$HTTP_RAW_POST_DATA = <<<EOF
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<SOAP-ENV:Envelope
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:si="http://soapinterop.org/xsd">
- <SOAP-ENV:Body>
- <ns1:Sum xmlns:ns1="http://testuri.org">
- <num xsi:type="xsd:int">5</num>
- </ns1:Sum>
- </SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-EOF;
-$server->handle();
-ob_clean();
-
-$HTTP_RAW_POST_DATA = <<<EOF
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<SOAP-ENV:Envelope
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:si="http://soapinterop.org/xsd">
- <SOAP-ENV:Body>
- <ns1:Sum xmlns:ns1="http://testuri.org">
- <num xsi:type="xsd:int">3</num>
- </ns1:Sum>
- </SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-EOF;
-$server->handle();
-ob_end_flush();
-
-echo "ok\n";
-?>
---EXPECT--
-<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:apache="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body xmlns:ns1="http://testuri.org"><ns1:SumResponse><return xsi:type="xsd:int">8</return></ns1:SumResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
-ok
diff --git a/ext/soap/tests/server010.phpt b/ext/soap/tests/server010.phpt
deleted file mode 100644
index e25c9a3158..0000000000
--- a/ext/soap/tests/server010.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-SOAP Server 10: setclass and setpersistence(SOAP_PERSISTENCE_REQUEST)
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-class foo {
- private $sum = 0;
-
- function Sum($num) {
- return $this->sum += $num;
- }
-}
-
-$server = new soapserver("http://testuri.org");
-$server->setclass("foo");
-$server->setpersistence(SOAP_PERSISTENCE_REQUEST);
-
-
-ob_start();
-$HTTP_RAW_POST_DATA = <<<EOF
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<SOAP-ENV:Envelope
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:si="http://soapinterop.org/xsd">
- <SOAP-ENV:Body>
- <ns1:Sum xmlns:ns1="http://testuri.org">
- <num xsi:type="xsd:int">5</num>
- </ns1:Sum>
- </SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-EOF;
-$server->handle();
-ob_clean();
-
-$HTTP_RAW_POST_DATA = <<<EOF
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<SOAP-ENV:Envelope
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:si="http://soapinterop.org/xsd">
- <SOAP-ENV:Body>
- <ns1:Sum xmlns:ns1="http://testuri.org">
- <num xsi:type="xsd:int">3</num>
- </ns1:Sum>
- </SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-EOF;
-$server->handle();
-ob_end_flush();
-echo "ok\n";
-?>
---EXPECT--
-<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:apache="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body xmlns:ns1="http://testuri.org"><ns1:SumResponse><return xsi:type="xsd:int">3</return></ns1:SumResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
-ok
diff --git a/ext/soap/tests/server011.phpt b/ext/soap/tests/server011.phpt
deleted file mode 100644
index d5f6d3703d..0000000000
--- a/ext/soap/tests/server011.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-SOAP Server 11: bind
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---GET--
-wsdl
---FILE--
-<?php
-function Add($x,$y) {
- return $x+$y;
-}
-
-$server = new soapserver("http://testuri.org");
-$server->bind(dirname(__FILE__)."/test.wsdl");
-ob_start();
-$server->handle();
-$wsdl = ob_get_contents();
-ob_end_clean();
-if ($wsdl == file_get_contents(dirname(__FILE__)."/test.wsdl")) {
- echo "ok\n";
-} else {
- echo "fail\n";
-}
-?>
---EXPECT--
-ok
diff --git a/ext/soap/tests/server012.phpt b/ext/soap/tests/server012.phpt
deleted file mode 100644
index 6a697ec1a2..0000000000
--- a/ext/soap/tests/server012.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-SOAP Server 12: WSDL generation
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---GET--
-WSDL
---FILE--
-<?php
-function Add($x,$y) {
- return $x+$y;
-}
-
-$server = new soapserver("http://testuri.org");
-$server->addfunction("Add");
-$server->handle();
-echo "ok\n";
-?>
---EXPECT--
-<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:apache="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><SOAP-ENV:Fault xsi:type="SOAP-ENC:Struct"><faultstring xsi:type="xsd:string">WSDL generation is not supported yet</faultstring><faultcode xsi:type="xsd:string">SOAP-ENV:Server</faultcode><detail xsi:nil="1"/></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
diff --git a/ext/soap/tests/server013.phpt b/ext/soap/tests/server013.phpt
deleted file mode 100644
index d2e845012c..0000000000
--- a/ext/soap/tests/server013.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-SOAP Server 13: array handling
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-function Sum($a) {
- $sum = 0;
- if (is_array($a)) {
- foreach($a as $val) {
- $sum += $val;
- }
- }
- return $sum;
-}
-
-$server = new soapserver("http://testuri.org");
-$server->addfunction("Sum");
-
-$HTTP_RAW_POST_DATA = <<<EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <SOAP-ENV:Body xmlns:ns1="http://linuxsrv.home/~dmitry/soap/">
- <ns1:sum>
- <param0 SOAP-ENC:arrayType="xsd:int[2]" xsi:type="SOAP-ENC:Array">
- <val xsi:type="xsd:int">3</val>
- <val xsi:type="xsd:int">5</val>
- </param0>
- </ns1:sum>
- </SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-EOF;
-$server->handle();
-echo "ok\n";
-?>
---EXPECT--
-<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:apache="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body xmlns:ns1="http://testuri.org"><ns1:sumResponse><return xsi:type="xsd:int">8</return></ns1:sumResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
-ok
diff --git a/ext/soap/tests/server014.phpt b/ext/soap/tests/server014.phpt
deleted file mode 100644
index d81c3652a4..0000000000
--- a/ext/soap/tests/server014.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-SOAP Server 14: fault
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-function Add($x,$y) {
- undefined_function_x();
- return $x+$y;
-}
-
-$server = new soapserver("http://testuri.org");
-$server->addfunction("Add");
-
-$HTTP_RAW_POST_DATA = <<<EOF
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<SOAP-ENV:Envelope
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:si="http://soapinterop.org/xsd">
- <SOAP-ENV:Body>
- <ns1:Add xmlns:ns1="http://testuri.org">
- <x xsi:type="xsd:int">22</x>
- <y xsi:type="xsd:int">33</y>
- </ns1:Add>
- </SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-EOF;
-
-$server->handle();
-echo "ok\n";
-?>
---EXPECT--
-<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:apache="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><SOAP-ENV:Fault xsi:type="SOAP-ENC:Struct"><faultstring xsi:type="xsd:string">Call to undefined function undefined_function_x()</faultstring><faultcode xsi:type="xsd:string">SOAP-ENV:Server</faultcode><detail xsi:nil="1"/></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
diff --git a/ext/soap/tests/skipif.inc b/ext/soap/tests/skipif.inc
deleted file mode 100644
index fa8574e6a2..0000000000
--- a/ext/soap/tests/skipif.inc
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
- if (!extension_loaded('soap')) die('skip soap extension not available');
-?>
diff --git a/ext/soap/tests/test.wsdl b/ext/soap/tests/test.wsdl
deleted file mode 100644
index 0740b7db62..0000000000
--- a/ext/soap/tests/test.wsdl
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" ?>
-<definitions
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:si="http://soapinterop.org/xsd"
- xmlns:tns="http://linuxsrv.home/~dmitry/soap/test.wsdl"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- targetNamespace="http://linuxsrv.home/~dmitry/soap/test.wsdl">
-
- <types>
- <xsd:schema targetNamespace="http://linuxsrv.home/~dmitry/soap/test.wsdl">
- <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
- </xsd:schema>
- </types>
-
- <message name="AddRequest">
- <part name="x" type="xsd:double" />
- <part name="y" type="xsd:double" />
- </message>
- <message name="AddResponse">
- <part name="result" type="xsd:double" />
- </message>
-
- <portType name="TestServicePortType">
- <operation name="Add">
- <input message="tns:AddRequest" />
- <output message="tns:AddResponse" />
- </operation>
- </portType>
-
- <binding name="TestServiceBinding" type="tns:TestServicePortType">
- <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
- <operation name="Add">
- <soap:operation soapAction="Add" style="rpc" />
- <input>
- <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- </binding>
-
- <service name="TestService">
- <port name="TestServicePort" binding="tns:TestServiceBinding">
- <soap:address location="http://linuxsrv.home/~dmitry/soap/soap_server.php" />
- </port>
- </service>
-
-</definitions>