mirror of
https://github.com/php/php-src.git
synced 2025-01-18 09:43:36 +08:00
PHP5 support, better encoding and WSDL support, interop round 2 base and groupB
This commit is contained in:
parent
2e2d5d78f0
commit
de6184edee
115
ext/soap/TODO
115
ext/soap/TODO
@ -1,39 +1,82 @@
|
||||
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
|
||||
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
|
||||
|
||||
does this list stop... what exactly have i done?
|
||||
im sure im forgetting 20 thousand more things....
|
||||
SOAP
|
||||
----
|
||||
- support for SOAP headers
|
||||
- mustUnderstend attribute
|
||||
- make sure soap 1.1 and 1.2 are supported fully
|
||||
|
||||
Encoding
|
||||
--------
|
||||
- full support for standard simple types (
|
||||
- duration,
|
||||
- anyURI,
|
||||
- QName,
|
||||
- NOTATION,
|
||||
- normalizedString,
|
||||
- token,
|
||||
- language,
|
||||
- NMTOKEN,
|
||||
- Name,
|
||||
- NCName,
|
||||
- ID,
|
||||
- IDREF,
|
||||
- IDREFS,
|
||||
- ENTITY,
|
||||
- ENTITIES,
|
||||
- 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
|
||||
? arrayType attribute
|
||||
- offset attribute
|
||||
- position attribute
|
||||
? multidimensional arrays
|
||||
? arrays of arrays
|
||||
? provide schema 1999/2001 support???
|
||||
? make internal refrences for soap encoding (use seralization logic)???
|
||||
? provide user space overriding of serialization certin objects and types???
|
||||
|
||||
- brad
|
||||
WSDL
|
||||
----
|
||||
? support for style "rpc"/"document" encoding
|
||||
? support for "encoded"/"literal" encoding
|
||||
? support for "nillable" and "nil"
|
||||
- function/method overloading (test(int); test(string))
|
||||
- wsdl caching
|
||||
- wsdl auto generation
|
||||
|
||||
Error Handling
|
||||
--------------
|
||||
- ???
|
||||
|
||||
Transport
|
||||
---------
|
||||
? support for https://
|
||||
- support for persistent HTTP connections (keep_alive)
|
||||
- support for HTTP compression (gzip,x-gzip,defalte)
|
||||
- support for HTTP athentication
|
||||
- support for HTTP proxies
|
||||
- transport abstraction layer
|
||||
|
||||
UDDI
|
||||
----
|
||||
- ???
|
||||
|
||||
Interop Testing
|
||||
---------------
|
||||
- more rounds/groups
|
||||
- ???
|
||||
|
39
ext/soap/TODO.old
Normal file
39
ext/soap/TODO.old
Normal file
@ -0,0 +1,39 @@
|
||||
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
|
@ -1,25 +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$
|
||||
//
|
||||
class Interop_Base
|
||||
{
|
||||
}
|
||||
|
||||
?>
|
@ -9,7 +9,7 @@
|
||||
<a href="index.php">Back to Interop Index</a><br>
|
||||
<p> </p>
|
||||
<?php
|
||||
require_once 'SOAP/interop/client_round2_interop.php';
|
||||
require_once 'client_round2_interop.php';
|
||||
|
||||
$iop = new Interop_Client();
|
||||
|
||||
@ -18,6 +18,7 @@ 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';
|
||||
@ -28,15 +29,20 @@ function endpointList($test,$sel_endpoint)
|
||||
function methodList($test,$sel_method)
|
||||
{
|
||||
global $iop;
|
||||
|
||||
$ml = $iop->getMethodList($test);
|
||||
global $soap_tests;
|
||||
|
||||
echo "<select name='method'>\n";
|
||||
foreach ($ml as $method) {
|
||||
$selected = '';
|
||||
if ($sel_method == $method) $selected = ' SELECTED';
|
||||
echo "<option value='$method'$selected>$method</option>\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 "<option value='ALL'>Run All Methods</option>\n";
|
||||
echo "</select>\n";
|
||||
}
|
||||
|
||||
@ -50,9 +56,14 @@ function endpointTestForm($test, $endpoint, $method, $paramType, $useWSDL)
|
||||
echo "<input type='hidden' name='test' value='$test'>\n";
|
||||
endpointList($test, $endpoint);
|
||||
methodList($test, $method);
|
||||
echo "<select name='paramType'><option value='soapval'>soap value</option>";
|
||||
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'><option value='0'>go Direct</option><option value='1'".($useWSDL?' selected':'').">use WSDL</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";
|
||||
}
|
||||
@ -80,7 +91,7 @@ if ($_POST['test'] && array_key_exists('endpoint', $_POST) && array_key_exists('
|
||||
// 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
|
||||
@ -88,10 +99,10 @@ if ($_POST['test'] && array_key_exists('endpoint', $_POST) && array_key_exists('
|
||||
$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
|
||||
$this->nosave = 0; // 1= disable saving results to database
|
||||
$iop->nosave = 0; // 1= disable saving results to database
|
||||
// debug output
|
||||
$iop->show = 1;
|
||||
$iop->debug = 1;
|
||||
$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
|
||||
|
@ -19,23 +19,23 @@
|
||||
// $Id$
|
||||
//
|
||||
require_once 'DB.php'; // PEAR/DB
|
||||
require_once 'base.php';
|
||||
require_once 'client_round2_params.php';
|
||||
require_once 'test.utility.php';
|
||||
require_once 'config.php';
|
||||
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
|
||||
class Interop_Client extends Interop_Base
|
||||
class Interop_Client
|
||||
{
|
||||
// database DNS
|
||||
var $DSN = 'mysql://user@localhost/interop2';
|
||||
var $DSN = "";
|
||||
|
||||
// our central interop server, where we can get the list of endpoints
|
||||
var $interopServer = "http://www.whitemesa.net/interopInfo";
|
||||
|
||||
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'
|
||||
@ -50,15 +50,17 @@ class Interop_Client extends Interop_Base
|
||||
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
|
||||
@ -67,41 +69,41 @@ class Interop_Client extends Interop_Base
|
||||
$this->dbc = NULL;
|
||||
}
|
||||
// set up local endpoint
|
||||
$this->localEndpoint['base'] = array(
|
||||
'endpointName'=>'PEAR SOAP',
|
||||
'endpointURL'=>'http://localhost/soap_interop/server_round2.php',
|
||||
'wsdlURL'=>'http://localhost/soap_interop/interop.wsdl'
|
||||
$this->localEndpoint['base'] = (object)array(
|
||||
'endpointName'=>'PHP ext/soap',
|
||||
'endpointURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/server_round2_base.php',
|
||||
'wsdlURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/interop.wsdl.php'
|
||||
);
|
||||
$this->localEndpoint['GroupB'] = array(
|
||||
'endpointName'=>'PEAR SOAP',
|
||||
'endpointURL'=>'http://localhost/soap_interop/server_round2.php',
|
||||
'wsdlURL'=>'http://localhost/soap_interop/interopB.wsdl'
|
||||
$this->localEndpoint['GroupB'] = (object)array(
|
||||
'endpointName'=>'PHP ext/soap',
|
||||
'endpointURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/server_round2_groupB.php',
|
||||
'wsdlURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/interopB.wsdl.php'
|
||||
);
|
||||
$this->localEndpoint['GroupC'] = array(
|
||||
'endpointName'=>'PEAR SOAP',
|
||||
'endpointURL'=>'http://localhost/soap_interop/server_round2.php',
|
||||
'wsdlURL'=>'http://localhost/soap_interop/echoheadersvc.wsdl'
|
||||
$this->localEndpoint['GroupC'] = (object)array(
|
||||
'endpointName'=>'PHP ext/soap',
|
||||
'endpointURL'=>'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/server_round2_groupC.php',
|
||||
'wsdlURL'=>'http://'.$_SERVER['SERVER_NAME'].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/");
|
||||
$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]);
|
||||
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)) {
|
||||
@ -110,10 +112,10 @@ class Interop_Client extends Interop_Base
|
||||
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']}");
|
||||
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')");
|
||||
$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());
|
||||
@ -121,18 +123,18 @@ class Interop_Client extends Interop_Base
|
||||
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 {
|
||||
@ -141,12 +143,13 @@ class Interop_Client extends Interop_Base
|
||||
}
|
||||
$test = 'base';
|
||||
}
|
||||
|
||||
|
||||
// retreive all endpoints now
|
||||
$this->currentTest = $test;
|
||||
return $this->_getEndpoints($test);
|
||||
$x = $this->_getEndpoints();
|
||||
return $x;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getEndpoints
|
||||
* retreive endpoints from either database or interop server
|
||||
@ -155,7 +158,7 @@ class Interop_Client extends Interop_Base
|
||||
* @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);
|
||||
@ -171,7 +174,7 @@ class Interop_Client extends Interop_Base
|
||||
* @param boolean all (if false, only get valid endpoints, status=1)
|
||||
* @return boolean result
|
||||
* @access private
|
||||
*/
|
||||
*/
|
||||
function _getEndpoints($base = "", $all = 0) {
|
||||
$this->endpoints = array();
|
||||
|
||||
@ -182,7 +185,7 @@ class Interop_Client extends Interop_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";
|
||||
@ -193,6 +196,13 @@ class Interop_Client extends Interop_Base
|
||||
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;
|
||||
@ -209,7 +219,7 @@ class Interop_Client extends Interop_Base
|
||||
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 );
|
||||
@ -224,7 +234,7 @@ class Interop_Client extends Interop_Base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* saveResults
|
||||
* save the results of a method test into the database
|
||||
@ -233,7 +243,7 @@ class Interop_Client extends Interop_Base
|
||||
*/
|
||||
function _saveResults($endpoint_id, &$soap_test) {
|
||||
if ($this->nosave) return;
|
||||
|
||||
|
||||
$result = $soap_test->result;
|
||||
$wire = $result['wire'];
|
||||
if ($result['success']) {
|
||||
@ -244,7 +254,7 @@ class Interop_Client extends Interop_Base
|
||||
$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) {
|
||||
@ -261,7 +271,7 @@ class Interop_Client extends Interop_Base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$sql = "delete from results where endpoint=$endpoint_id ".
|
||||
"and class='$this->currentTest' and type='$this->paramType' ".
|
||||
"and wsdl=$this->useWSDL and function=".
|
||||
@ -272,7 +282,7 @@ class Interop_Client extends Interop_Base
|
||||
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,".
|
||||
@ -282,7 +292,7 @@ class Interop_Client extends Interop_Base
|
||||
($wire?$this->dbc->quote($wire):"''").")";
|
||||
#echo "\n".$sql;
|
||||
$res = $this->dbc->query($sql);
|
||||
|
||||
|
||||
if (DB::isError($res)) {
|
||||
die ($res->getMessage());
|
||||
}
|
||||
@ -296,7 +306,7 @@ class Interop_Client extends Interop_Base
|
||||
* @param SOAP_Value soapval
|
||||
* @return mixed result
|
||||
* @access public
|
||||
*/
|
||||
*/
|
||||
function decodeSoapval($soapval)
|
||||
{
|
||||
if (gettype($soapval) == "object" &&
|
||||
@ -320,7 +330,7 @@ class Interop_Client extends Interop_Base
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* compareResult
|
||||
* compare two php types for a match
|
||||
@ -329,22 +339,10 @@ class Interop_Client extends Interop_Base
|
||||
* @param string test_result
|
||||
* @return boolean result
|
||||
* @access public
|
||||
*/
|
||||
*/
|
||||
function compareResult($expect, $result, $type = NULL)
|
||||
{
|
||||
$ok = 0;
|
||||
$expect_type = gettype($expect);
|
||||
$result_type = gettype($result);
|
||||
if ($expect_type == "array" && $result_type == "array") {
|
||||
# compare arrays
|
||||
$ok = array_compare($expect, $result);
|
||||
} else {
|
||||
if ($type == 'boolean')
|
||||
$ok = boolean_compare($expect, $result);
|
||||
else
|
||||
$ok = string_compare($expect, $result);
|
||||
}
|
||||
return $ok;
|
||||
return compare($expect, $result);
|
||||
}
|
||||
|
||||
|
||||
@ -356,22 +354,23 @@ class Interop_Client extends Interop_Base
|
||||
* @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();
|
||||
@ -404,6 +403,7 @@ class Interop_Client extends Interop_Base
|
||||
}
|
||||
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'];
|
||||
}
|
||||
@ -417,7 +417,6 @@ class Interop_Client extends Interop_Base
|
||||
// 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) {
|
||||
@ -428,16 +427,16 @@ class Interop_Client extends Interop_Base
|
||||
} else {
|
||||
$return = $soap->__call($soap_test->method_name,$soap_test->method_params,$soapaction, $namespace);
|
||||
}
|
||||
|
||||
// save the wire
|
||||
$wire = $soap->__getlastrequest()."\n\n".$soap->__getlastresponse();
|
||||
$wire = str_replace('>',">\n",$wire);
|
||||
$wire = str_replace('" ',"\" \n",$wire);
|
||||
#print $wire;
|
||||
|
||||
|
||||
|
||||
if(!$soap->__isfault()){
|
||||
if (is_array($soap_test->method_params) && count($soap_test->method_params) == 1) {
|
||||
$sent = array_shift($soap_test->method_params);
|
||||
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;
|
||||
}
|
||||
@ -445,7 +444,7 @@ class Interop_Client extends Interop_Base
|
||||
// compare header results
|
||||
$header_result = array();
|
||||
$headers_ok = TRUE;
|
||||
|
||||
|
||||
# XXX need to implement header support!
|
||||
#
|
||||
#if ($soap_test->headers) {
|
||||
@ -476,15 +475,24 @@ class Interop_Client extends Interop_Base
|
||||
|
||||
# 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
|
||||
|
||||
$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');
|
||||
@ -514,48 +522,54 @@ class Interop_Client extends Interop_Base
|
||||
$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;
|
||||
@ -570,13 +584,13 @@ class Interop_Client extends Interop_Base
|
||||
$soap_test->result = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// if we're looking for a specific method, skip unless we have it
|
||||
if ($this->testMethod && !strstr($this->testMethod,$soap_test->test_name)) continue;
|
||||
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) {
|
||||
@ -594,7 +608,7 @@ class Interop_Client extends Interop_Base
|
||||
}
|
||||
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, '',
|
||||
@ -623,7 +637,7 @@ class Interop_Client extends Interop_Base
|
||||
if ($this->numservers && ++$i >= $this->numservers) break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function doGroupTests() {
|
||||
$dowsdl = array(0,1);
|
||||
foreach($dowsdl as $usewsdl) {
|
||||
@ -636,13 +650,13 @@ class Interop_Client extends Interop_Base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* doTests
|
||||
* go all out. This takes time.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
*/
|
||||
function doTests() {
|
||||
// the mother of all interop tests
|
||||
$dowsdl = array(0,1);
|
||||
@ -659,10 +673,10 @@ class Interop_Client extends Interop_Base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***********************************************************
|
||||
// output functions
|
||||
|
||||
|
||||
/**
|
||||
* getResults
|
||||
* retreive results from the database, stuff them into the endpoint array
|
||||
@ -679,18 +693,18 @@ class Interop_Client extends Interop_Base
|
||||
}
|
||||
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;
|
||||
@ -709,14 +723,14 @@ class Interop_Client extends Interop_Base
|
||||
}
|
||||
$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;
|
||||
}
|
||||
|
||||
# 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) {
|
||||
@ -766,7 +780,7 @@ class Interop_Client extends Interop_Base
|
||||
}
|
||||
echo "</ul><br><br>\n";
|
||||
}
|
||||
|
||||
|
||||
function outputTables() {
|
||||
// the mother of all interop tests
|
||||
$dowsdl = array(0,1);
|
||||
@ -783,7 +797,7 @@ class Interop_Client extends Interop_Base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function showWire($id) {
|
||||
$results = $this->dbc->getAll("select * from results where id=$id",NULL, DB_FETCHMODE_ASSOC );
|
||||
#$wire = preg_replace("/>/",">\n",$results[0]['wire']);
|
||||
|
@ -35,11 +35,11 @@ class SOAP_Test {
|
||||
var $show = 1;
|
||||
var $debug = 0;
|
||||
var $encoding = 'UTF-8';
|
||||
|
||||
|
||||
function SOAP_Test($methodname, $params, $expect = 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;
|
||||
@ -48,8 +48,10 @@ class SOAP_Test {
|
||||
$this->test_name = $this->method_name = $methodname;
|
||||
}
|
||||
$this->method_params = $params;
|
||||
$this->expect = $expect;
|
||||
|
||||
if ($expect !== NULL) {
|
||||
$this->expect = $expect;
|
||||
}
|
||||
|
||||
// determine test type
|
||||
if ($params) {
|
||||
$v = array_values($params);
|
||||
@ -58,7 +60,7 @@ class SOAP_Test {
|
||||
$this->type = 'soapval';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function setResult($ok, $result, $wire, $error = '', $fault = NULL)
|
||||
{
|
||||
$this->result['success'] = $ok;
|
||||
@ -75,19 +77,19 @@ class SOAP_Test {
|
||||
* @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;
|
||||
@ -96,22 +98,22 @@ class SOAP_Test {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($debug) {
|
||||
print "method params: ";
|
||||
print_r($this->params);
|
||||
print "\n";
|
||||
}
|
||||
|
||||
|
||||
$ok = $this->result['success'];
|
||||
if ($ok) {
|
||||
print "SUCCESS\n";
|
||||
print "<font color=\"#00cc00\">SUCCESS</font>\n";
|
||||
} else {
|
||||
$fault = $this->result['fault'];
|
||||
if ($fault) {
|
||||
print "FAILED: {$fault->faultcode} {$fault->faultstring}\n";
|
||||
print "<font color=\"#ff0000\">FAILED: {$fault->faultcode} {$fault->faultstring}</font>\n";
|
||||
} else {
|
||||
print "FAILED: ".$this->result['result']."\n";
|
||||
print "<font color=\"#ff0000\">FAILED: ".$this->result['result']."</font>\n";
|
||||
}
|
||||
}
|
||||
if ($debug) {
|
||||
@ -151,10 +153,14 @@ class SOAPStruct {
|
||||
|
||||
$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(null)', array('inputString' => ""));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoString(null)', array('inputString' => soap_value('inputString','',XSD_STRING)));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => 'hello world\nline 2\n'));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => soap_value('inputString','hello world\nline 2\n',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;
|
||||
@ -170,15 +176,25 @@ $soap_tests['base'][] = new SOAP_Test('echoStringArray',
|
||||
$soap_tests['base'][] = new SOAP_Test('echoStringArray',
|
||||
array('inputStringArray' =>
|
||||
soap_value('inputStringArray',array('good','bad'),SOAP_ENC_ARRAY)));
|
||||
|
||||
// null array test
|
||||
|
||||
$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
|
||||
#$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,XSD_STRING)));
|
||||
// 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)));
|
||||
|
||||
@ -191,12 +207,7 @@ $soap_tests['base'][] = new SOAP_Test('echoIntegerArray',
|
||||
soap_value('inputIntegerArray',
|
||||
array(new soapvar(12345,XSD_INT),new soapvar(654321,XSD_INT)),
|
||||
SOAP_ENC_ARRAY)));
|
||||
#
|
||||
#// null array test
|
||||
# XXX NULL Arrays not supported
|
||||
#$soap_tests['base'][] = new SOAP_Test('echoIntegerArray(null)', array('inputIntegerArray' => NULL));
|
||||
#$soap_tests['base'][] = new SOAP_Test('echoIntegerArray(null)', array('inputIntegerArray' => new SOAP_Value('inputIntegerArray','Array',NULL)));
|
||||
#
|
||||
|
||||
//***********************************************************
|
||||
// Base echoFloat
|
||||
|
||||
@ -207,7 +218,7 @@ $soap_tests['base'][] = new SOAP_Test('echoFloat', array('inputFloat' => soap_va
|
||||
// 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',
|
||||
$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)),
|
||||
@ -243,177 +254,179 @@ $soap_tests['base'][] = $test;
|
||||
|
||||
$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)));
|
||||
soap_value('inputBase64','TmVicmFza2E=',XSD_BASE64BINARY)));
|
||||
|
||||
//***********************************************************
|
||||
// Base echoHexBinary
|
||||
|
||||
$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' => '736F61707834'));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' =>
|
||||
soap_value('inputHexBinary','736F61707834',XSD_HEXBINARY)));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' =>
|
||||
soap_value('inputHexBinary','736F61707834',XSD_HEXBINARY)));
|
||||
|
||||
//***********************************************************
|
||||
// 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)));
|
||||
$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'));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoDate', array('inputDate' =>
|
||||
$soap_tests['base'][] = new SOAP_Test('echoDate', array('inputDate' =>
|
||||
soap_value('inputDate','2001-05-24T17:31:41Z',XSD_DATETIME)));#'2001-04-25T13:31:41-0700'
|
||||
|
||||
|
||||
//***********************************************************
|
||||
// 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', array('inputBoolean' => TRUE));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoBoolean', array('inputBoolean' =>
|
||||
$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', array('inputBoolean' => FALSE));
|
||||
$soap_tests['base'][] = new SOAP_Test('echoBoolean', array('inputBoolean' =>
|
||||
$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 B
|
||||
#
|
||||
#
|
||||
#//***********************************************************
|
||||
#// GroupB echoStructAsSimpleTypes
|
||||
#
|
||||
#$expect = array(
|
||||
# 'outputString'=>'arg',
|
||||
# 'outputInteger'=>34,
|
||||
# 'outputFloat'=>325.325
|
||||
# );
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echoStructAsSimpleTypes',
|
||||
# array('inputStruct' => array(
|
||||
# 'varString'=>'arg',
|
||||
# 'varInt'=>34,
|
||||
# 'varFloat'=>325.325
|
||||
# )), $expect);
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echoStructAsSimpleTypes',
|
||||
# array('inputStruct' =>
|
||||
# new SOAP_Value('inputStruct','SOAPStruct',
|
||||
# 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)
|
||||
# ))), $expect);
|
||||
#
|
||||
#//***********************************************************
|
||||
#// GroupB echoSimpleTypesAsStruct
|
||||
#
|
||||
#$expect =
|
||||
# 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(
|
||||
# new SOAP_Value('inputString','string','arg'),
|
||||
# new SOAP_Value('inputInteger','int',34),
|
||||
# new SOAP_Value('inputFloat','float',325.325)
|
||||
# ), $expect);
|
||||
#
|
||||
#//***********************************************************
|
||||
#// GroupB echo2DStringArray
|
||||
#
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echo2DStringArray',
|
||||
# array('input2DStringArray' => make_2d(3,3)));
|
||||
#
|
||||
#$multidimarray =
|
||||
# new SOAP_Value('input2DStringArray','Array',
|
||||
# array(
|
||||
# array(
|
||||
# new SOAP_Value('item','string','row0col0'),
|
||||
# new SOAP_Value('item','string','row0col1'),
|
||||
# new SOAP_Value('item','string','row0col2')
|
||||
# ),
|
||||
# array(
|
||||
# new SOAP_Value('item','string','row1col0'),
|
||||
# new SOAP_Value('item','string','row1col1'),
|
||||
# new SOAP_Value('item','string','row1col2')
|
||||
# )
|
||||
# )
|
||||
# );
|
||||
#$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' => array(
|
||||
# 'varString'=>'arg',
|
||||
# 'varInt'=>34,
|
||||
# 'varFloat'=>325.325,
|
||||
# 'varStruct' => array(
|
||||
# 'varString'=>'arg',
|
||||
# 'varInt'=>34,
|
||||
# 'varFloat'=>325.325
|
||||
# )
|
||||
# )));
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedStruct',
|
||||
# array('inputStruct' =>
|
||||
# new SOAP_Value('inputStruct','struct',
|
||||
# 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),
|
||||
# new SOAP_Value('varStruct','SOAPStruct',
|
||||
# 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)
|
||||
# )
|
||||
# /*,NULL,'http://soapinterop.org/xsd'*/)
|
||||
# )
|
||||
# )));
|
||||
#
|
||||
#//***********************************************************
|
||||
#// GroupB echoNestedArray
|
||||
#
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedArray',
|
||||
# array('inputStruct' => array(
|
||||
# 'varString'=>'arg',
|
||||
# 'varInt'=>34,
|
||||
# 'varFloat'=>325.325,
|
||||
# 'varArray' => array('red','blue','green')
|
||||
# )));
|
||||
#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedArray',
|
||||
# array('inputStruct' =>
|
||||
# new SOAP_Value('inputStruct','struct',
|
||||
# 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),
|
||||
# new SOAP_Value('varArray','Array',
|
||||
# array( #push struct elements into one soap value
|
||||
# new SOAP_Value('item','string','red'),
|
||||
# new SOAP_Value('item','string','blue'),
|
||||
# new SOAP_Value('item','string','green')
|
||||
# )
|
||||
# )
|
||||
# )
|
||||
# )));
|
||||
#
|
||||
#
|
||||
#//***********************************************************
|
||||
#// GROUP C header tests
|
||||
#
|
||||
|
@ -60,7 +60,7 @@ if ($_GET['wire']) {
|
||||
} else {
|
||||
$iop->getEndpoints();
|
||||
$iop->getResults();
|
||||
|
||||
|
||||
if ($_GET['test']) {
|
||||
$iop->currentTest = $_GET['test'];
|
||||
$iop->useWSDL = $_GET['wsdl']?$_GET['wsdl']:0;
|
||||
|
@ -29,17 +29,17 @@ $iop = new Interop_Client();
|
||||
// set some options
|
||||
$iop->currentTest = 'base'; // see $tests above
|
||||
$iop->paramType = 'php'; // 'php' or 'soapval'
|
||||
$iop->useWSDL = 1; // 1= do wsdl tests
|
||||
$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
|
||||
//$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->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='';
|
||||
$this->nosave = 0; // 1= disable saving results to database
|
||||
$iop->nosave = 0; // 1= disable saving results to database
|
||||
// debug output
|
||||
$iop->show = 1;
|
||||
$iop->debug = 0;
|
||||
|
4
ext/soap/interop/config.php.dist
Normal file
4
ext/soap/interop/config.php.dist
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
// configuration items
|
||||
$interopConfig['DSN'] = 'mysql://root@localhost/soapinterop';
|
||||
?>
|
@ -42,4 +42,3 @@ CREATE TABLE results (
|
||||
wire text NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
|
@ -1,4 +1,8 @@
|
||||
<?xml version="1.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/"/>
|
||||
@ -8,7 +12,7 @@
|
||||
<service name="interopLabEchoHeader">
|
||||
|
||||
<port name="interopPortEchoHdr" binding="tns:InteropEchoHeaderBinding">
|
||||
<soap:address location="http://localhost/soap_interop/server_round2.php"/>
|
||||
<soap:address location="http://<?php echo ($_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']));?>/server_round2.php"/>
|
||||
</port>
|
||||
|
||||
</service>
|
@ -1,85 +0,0 @@
|
||||
# phpMyAdmin MySQL-Dump
|
||||
# version 2.2.5
|
||||
# http://phpwizard.net/phpMyAdmin/
|
||||
# http://phpmyadmin.sourceforge.net/ (download page)
|
||||
#
|
||||
# Host: localhost
|
||||
# Generation Time: Jul 14, 2002 at 03:13 PM
|
||||
# Server version: 3.23.49
|
||||
# PHP Version: 4.2.1
|
||||
# Database : `interop2`
|
||||
|
||||
#
|
||||
# Dumping data for table `endpoints`
|
||||
#
|
||||
|
||||
INSERT INTO endpoints VALUES (1, '4s4c', 'http://soap.4s4c.com/ilab/soap.asp', 'http://www.pocketsoap.com/services/ilab.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (2, '4s4c v2.0', 'http://soap.4s4c.com/ilab2/soap.asp', 'http://soap.4s4c.com/ilab2/ilab.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (3, 'Apache Axis', 'http://nagoya.apache.org:5049/axis/services/echo', 'http://nagoya.apache.org:5049/axis/services/echo?wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (4, 'Apache SOAP 2.2', 'http://nagoya.apache.org:5049/soap/servlet/rpcrouter', 'http://www.apache.org/~rubys/ApacheSoap.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (5, 'ASP.NET Web Services', 'http://www.mssoapinterop.org/asmx/simple.asmx', 'http://www.mssoapinterop.org/asmx/simple.asmx?wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (6, 'CapeConnect', 'http://interop.capeclear.com/ccx/soapbuilders-round2', 'http://interop.capeclear.com/wsdl/soapbuilders-round2.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (7, 'Delphi SOAP', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropService.exe/soap/InteropTestPortType', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropService.exe/wsdl/InteropTestPortType', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (8, 'EasySoap++', 'http://easysoap.sourceforge.net/cgi-bin/interopserver', 'http://easysoap.sourceforge.net/interopA.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (9, 'eSOAP', 'http://www.quakersoft.net/cgi-bin/interop2_server.cgi', 'http://www.quakersoft.net/wsdl/interop2.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (10, 'gSOAP', 'http://websrv.cs.fsu.edu/~engelen/interop2.cgi', 'http://www.cs.fsu.edu/~engelen/interop2.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (11, 'Frontier', 'http://www.soapware.org/xmethodsInterop', '', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (12, 'GLUE', 'http://www.themindelectric.net:8005/glue/round2', 'http://www.themindelectric.net:8005/glue/round2.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (13, 'HP SOAP', 'http://soap.bluestone.com/hpws/soap/EchoService', 'http://soap.bluestone.com/hpws/soap/EchoService.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (14, 'IONA XMLBus', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/BaseService/BasePort', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/BaseService/BasePort', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (15, 'IONA XMLBus (CORBA)', 'http://interop.xmlbus.com:7002/xmlbus/container/CORBAInterop/BaseService/BasePort', 'http://interop.xmlbus.com:7002/xmlbus/container/CORBAInterop/BaseService/BasePort', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (16, 'kSOAP', 'http://kissen.cs.uni-dortmund.de:8080/ksoapinterop', 'http://www.whitemesa.com/interop/kSOAP.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (17, 'MS .NET Remoting', 'http://www.mssoapinterop.org/remoting/ServiceA.soap', 'http://www.mssoapinterop.org/remoting/ServiceA.soap?wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (18, 'MS SOAP ToolKit 2.0', 'http://mssoapinterop.org/stk/Interop.wsdl', 'http://mssoapinterop.org/stk/Interop.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (19, 'MS SOAP ToolKit 3.0', 'http://mssoapinterop.org/stkV3/Interop.wsdl', 'http://mssoapinterop.org/stkV3/Interop.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (20, 'NuSOAP', 'http://dietrich.ganx4.com/nusoap/testbed/round2_base_server.php', 'http://dietrich.ganx4.com/nusoap/testbed/round2_base.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (21, 'OpenLink', 'http://demo.openlinksw.com:8890/Interop', 'http://demo.openlinksw.com:8890/Interop/services.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (24, 'SIM', 'http://soapinterop.simdb.com/round2', 'http://soapinterop.simdb.com/round2?WSDL', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (25, 'SOAP4R', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/SOAP4R_SOAPBuildersInteropTest_R2base.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (26, 'SOAP:Lite', 'http://services.soaplite.com/interop.cgi', 'http://services.soaplite.com/interop2.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (27, 'Spheon JSOAP', 'http://213.23.125.181:8081/RPC', 'http://213.23.125.181:8081/interop.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (28, 'Spray 2001', 'http://www.dolphinharbor.org/services/interop2001', 'http://www.dolphinharbor.org/services/interop2001/service.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (29, 'SQLData SOAP Server', 'http://soapclient.com/interop/sqldatainterop.wsdl', 'http://soapclient.com/interop/sqldatainterop.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (30, 'WASP Advanced 3.0', 'http://soap.systinet.net:6060/InteropService/', 'http://soap.systinet.net:6060/InteropService/', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (32, 'White Mesa SOAP Server', 'http://www.whitemesa.net/interop/std', 'http://www.whitemesa.net/wsdl/std/interop.wsdl', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (33, 'PEAR SOAP', 'http://localhost/soap_interop/server_round2.php', 'http://localhost/soap_interop/interop.wsdl.php', 'base', 1);
|
||||
INSERT INTO endpoints VALUES (34, '4s4c', 'http://soap.4s4c.com/ilab/soap.asp', 'http://www.pocketsoap.com/services/ilab_b.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (35, '4s4c v2.0', 'http://soap.4s4c.com/ilab2/soap.asp', 'http://soap.4s4c.com/ilab2/ilab_b.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (36, 'Apache Axis', 'http://nagoya.apache.org:5049/axis/services/echo', 'http://nagoya.apache.org:5049/axis/services/echo?wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (37, 'ASP.NET Web Services', 'http://www.mssoapinterop.org/asmx/simpleB.asmx', 'http://www.mssoapinterop.org/asmx/simpleb.asmx?wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (38, 'Delphi SOAP', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropGroupB.exe/soap/InteropTestPortTypeB', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropGroupB.exe/wsdl/InteropTestPortTypeB', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (39, 'EasySoap++', 'http://easysoap.sourceforge.net/cgi-bin/interopserver', 'http://easysoap.sourceforge.net/interopB.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (40, 'GLUE', 'http://www.themindelectric.net:8005/glue/round2B', 'http://www.themindelectric.net:8005/glue/round2B.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (41, 'gSOAP', 'http://websrv.cs.fsu.edu/~engelen/interop2B.cgi', 'http://www.cs.fsu.edu/~engelen/interop2B.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (42, 'HP SOAP', 'http://soap.bluestone.com/hpws/soap/EchoService', 'http://soap.bluestone.com/hpws/soap/EchoService.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (43, 'IONA XMLBus', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/GroupBService/GroupBPort', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/GroupBService/GroupBPort', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (44, 'MS .NET Remoting', 'http://www.mssoapinterop.org/remoting/ServiceB.soap', 'http://www.mssoapinterop.org/remoting/ServiceB.soap?wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (45, 'MS SOAP ToolKit 2.0', 'http://mssoapinterop.org/stk/InteropBtyped.wsdl', 'http://mssoapinterop.org/stk/InteropBtyped.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (46, 'MS SOAP ToolKit 3.0', 'http://mssoapinterop.org/stkV3/InteropB.wsdl', 'http://mssoapinterop.org/stkV3/InteropB.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (47, 'NuSOAP', 'http://dietrich.ganx4.com/nusoap/testbed/round2_groupb_server.php', 'http://dietrich.ganx4.com/nusoap/testbed/round2_groupb.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (48, 'OpenLink', 'http://demo.openlinksw.com:8890/Interop', 'http://demo.openlinksw.com:8890/Interop/services.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (50, 'SIM', 'http://soapinterop.simdb.com/round2B', 'http://soapinterop.simdb.com/round2B?WSDL', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (51, 'SOAP4R', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/SOAP4R_SOAPBuildersInteropTest_R2GroupB.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (52, 'SOAP:Lite', 'http://services.soaplite.com/interop.cgi', 'http://services.soaplite.com/InteropTestB.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (53, 'Spheon JSOAP', 'http://213.23.125.181:8081/RPC', 'http://213.23.125.181:8081/interopb.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (54, 'Spray 2001', 'http://www.dolphinharbor.org/services/interopB2001', 'http://www.dolphinharbor.org/services/interopB2001/service.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (55, 'SQLData SOAP Server', 'http://soapclient.com/interop/InteropB.wsdl', 'http://soapclient.com/interop/InteropB.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (56, 'WASP Advanced 3.0', 'http://soap.systinet.net:6060/InteropBService/', 'http://soap.systinet.net:6060/InteropBService/', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (58, 'White Mesa SOAP Server', 'http://www.whitemesa.net/interop/std/groupB', 'http://www.whitemesa.net/wsdl/std/interopB.wsdl', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (59, 'PEAR SOAP', 'http://localhost/soap_interop/server_round2.php', 'http://localhost/soap_interop/interopB.wsdl.php', 'GroupB', 1);
|
||||
INSERT INTO endpoints VALUES (60, '4s4c v2.0', 'http://soap.4s4c.com/ilab2/soap.asp', 'http://soap.4s4c.com/ilab2/ilab_c.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (61, 'Apache Axis', 'http://nagoya.apache.org:5049/axis/services/echo', 'http://nagoya.apache.org:5049/axis/services/echo?wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (62, 'ASP.NET Web Services', 'http://mssoapinterop.org/asmx/header.asmx', 'http://mssoapinterop.org/asmx/header.asmx?wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (63, 'EasySoap++', 'http://easysoap.sourceforge.net/cgi-bin/interopserver', 'http://easysoap.sourceforge.net/interopC.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (64, 'MS SOAP ToolKit 2.0', 'http://mssoapinterop.org/stk/InteropC.wsdl', 'http://mssoapinterop.org/stk/InteropC.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (65, 'MS SOAP ToolKit 3.0', 'http://mssoapinterop.org/stkV3/InteropC.wsdl', 'http://mssoapinterop.org/stkV3/InteropC.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (66, 'OpenLink', 'http://demo.openlinksw.com:8890/Interop', 'http://demo.openlinksw.com:8890/Interop/services.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (67, 'SOAP:Lite', 'http://services.soaplite.com/interopC.cgi', 'http://services.soaplite.com/InteropTestC.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (68, 'Spray 2001', 'http://www.dolphinharbor.org/services/interopC', 'http://www.dolphinharbor.org/services/interopC/service.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (69, 'SQLData SOAP Server', 'http://soapclient.com/interop/interopC.wsdl', 'http://soapclient.com/interop/interopC.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (70, 'WASP Advanced 3.0', 'http://soap.systinet.net:6060/InteropCService/', 'http://soap.systinet.net:6060/InteropCService/', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (71, 'White Mesa SOAP Server', 'http://www.whitemesa.net/interop/std/echohdr', 'http://www.whitemesa.net/wsdl/std/echoheadersvc.wsdl', 'GroupC', 1);
|
||||
INSERT INTO endpoints VALUES (72, 'PEAR SOAP', 'http://localhost/soap_interop/server_round2.php', 'http://localhost/soap_interop/echoheadersvc.wsdl.php', 'GroupC', 1);
|
||||
|
||||
|
||||
|
@ -7,10 +7,9 @@
|
||||
<?php
|
||||
// get our endpoint
|
||||
$server = $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'];
|
||||
$endpoint = 'http://'.$server."/soap_interop/server_round2.php";
|
||||
$base = 'http://'.$server."/soap_interop/interop.wsdl";
|
||||
$groupb = 'http://'.$server."/soap_interop/interopB.wsdl";
|
||||
$groupc = 'http://'.$server."/soap_interop/echoheadersvc.wsdl";
|
||||
$base = 'http://'.$server.dirname($_SERVER['PHP_SELF'])."/interop.wsdl.php";
|
||||
$groupb = 'http://'.$server.dirname($_SERVER['PHP_SELF'])."/interopB.wsdl.php";
|
||||
$groupc = 'http://'.$server.dirname($_SERVER['PHP_SELF'])."/echoheadersvc.wsdl.php";
|
||||
?>
|
||||
<body>
|
||||
|
||||
@ -21,7 +20,6 @@ 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>
|
||||
Endpoint: <?php echo $endpoint; ?><br>
|
||||
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>
|
||||
|
@ -1 +0,0 @@
|
||||
<?php phpinfo(); ?>
|
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<definitions name="InteropTest" targetNamespace="http://soapinterop.org/"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:tns="http://soapinterop.org/">
|
||||
|
||||
<import location="http://www.whitemesa.com/wsdl/wmmsgrouter.xsd" namespace="http://whitemesa.com/headers/soapmsgrouter.xsd"/>
|
||||
<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"/>
|
||||
|
||||
<service name="interopLab">
|
||||
<port name="interopTestPort" binding="tns:InteropTestSoapBinding">
|
||||
<soap:address location="http://localhost/soap_interop/server_round2.php"/>
|
||||
</port>
|
||||
</service>
|
||||
|
||||
</definitions>
|
335
ext/soap/interop/interop.wsdl.php
Normal file
335
ext/soap/interop/interop.wsdl.php
Normal file
@ -0,0 +1,335 @@
|
||||
<?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="http://<?php echo ($_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']));?>/server_round2_base.php"/>
|
||||
</port>
|
||||
</service>
|
||||
|
||||
</definitions>
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<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/InteropTestB.wsdl" namespace="http://soapinterop.org/"/>
|
||||
<import location="http://www.whitemesa.com/interop/InteropTestB.wsdl" namespace="http://soapinterop.org/xsd"/>
|
||||
|
||||
<service name="interopLabB">
|
||||
<port name="interopTestPortB" binding="tns:InteropTestSoapBindingB">
|
||||
<soap:address location="http://localhost/soap_interop/server_round2.php"/>
|
||||
</port>
|
||||
</service>
|
||||
|
||||
</definitions>
|
@ -1,35 +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 'SOAP/Server.php';
|
||||
|
||||
$server = new SOAP_Server;
|
||||
|
||||
require_once 'server_round2_base.php';
|
||||
require_once 'server_round2_groupB.php';
|
||||
require_once 'server_round2_groupC.php';
|
||||
|
||||
$server->service(isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:NULL);
|
||||
#echo "Content-Length is {$_SERVER['CONTENT_LENGTH']}\n\n";
|
||||
#echo "<!---\n\nlen:".strlen($HTTP_RAW_POST_DATA)."\n\n";
|
||||
#echo "[$HTTP_RAW_POST_DATA";
|
||||
#print "]\n\nend of input data-->";
|
||||
?>
|
@ -19,7 +19,6 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
require_once 'SOAP/Server.php';
|
||||
|
||||
function generateFault($short, $long)
|
||||
{
|
||||
@ -42,7 +41,7 @@ function hex2bin($data)
|
||||
|
||||
class SOAP_Interop_Base {
|
||||
var $method_namespace = 'http://soapinterop.org/';
|
||||
|
||||
|
||||
function SOAP_Interop_Base() {
|
||||
#if ($server) {
|
||||
# $server->addToMap("echoString",array("string"),array("string"));
|
||||
@ -64,121 +63,83 @@ class SOAP_Interop_Base {
|
||||
|
||||
function echoString($inputString)
|
||||
{
|
||||
return new SOAP_Value('outputString','string',$inputString);
|
||||
return $inputString;
|
||||
}
|
||||
|
||||
function echoStringArray($inputStringArray)
|
||||
{
|
||||
$ra = array();
|
||||
if ($inputStringArray) {
|
||||
foreach($inputStringArray as $s) {
|
||||
$ra[] = new SOAP_Value('item','string',$s);
|
||||
}
|
||||
}
|
||||
return new SOAP_Value('outputStringArray',NULL,$ra);
|
||||
return $inputStringArray;
|
||||
}
|
||||
|
||||
|
||||
function echoInteger($inputInteger)
|
||||
{
|
||||
return new SOAP_Value('outputInteger','int',(integer)$inputInteger);
|
||||
return $inputInteger;
|
||||
}
|
||||
|
||||
function echoIntegerArray($inputIntegerArray)
|
||||
{
|
||||
$ra = array();
|
||||
if ($inputIntegerArray) {
|
||||
foreach ($inputIntegerArray as $i) {
|
||||
$ra[] = new SOAP_Value('item','int',$i);
|
||||
}
|
||||
}
|
||||
return new SOAP_Value('outputIntArray',NULL,$ra);
|
||||
return $inputIntegerArray;
|
||||
}
|
||||
|
||||
function echoFloat($inputFloat)
|
||||
{
|
||||
return new SOAP_Value('outputFloat','float',(FLOAT)$inputFloat);
|
||||
return $inputFloat;
|
||||
}
|
||||
|
||||
function echoFloatArray($inputFloatArray)
|
||||
{
|
||||
$ra = array();
|
||||
if ($inputFloatArray) {
|
||||
foreach($inputFloatArray as $float) {
|
||||
$ra[] = new SOAP_Value('item','float',(FLOAT)$float);
|
||||
}
|
||||
}
|
||||
return new SOAP_Value('outputFloatArray',NULL,$ra);
|
||||
return $inputFloatArray;
|
||||
}
|
||||
|
||||
function echoStruct($inputStruct)
|
||||
{
|
||||
return new SOAP_Value('return','{http://soapinterop.org/xsd}SOAPStruct',
|
||||
array(
|
||||
new SOAP_Value('varInt','int',$inputStruct['varInt']),
|
||||
new SOAP_Value('varFloat','float',$inputStruct['varFloat']),
|
||||
new SOAP_Value('varString','string',$inputStruct['varString'])
|
||||
));
|
||||
return $inputStruct;
|
||||
}
|
||||
|
||||
function echoStructArray($inputStructArray)
|
||||
{
|
||||
$ra = array();
|
||||
if ($inputStructArray) {
|
||||
foreach($inputStructArray as $struct) {
|
||||
$ra[] = new SOAP_Value('item','{http://soapinterop.org/xsd}SOAPStruct',
|
||||
array(
|
||||
new SOAP_Value('varInt','int',$struct['varInt']),
|
||||
new SOAP_Value('varFloat','float',$struct['varFloat']),
|
||||
new SOAP_Value('varString','string',$struct['varString'])
|
||||
));
|
||||
}
|
||||
}
|
||||
return $ra;
|
||||
return $inputStructArray;
|
||||
}
|
||||
|
||||
function echoVoid()
|
||||
{
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
function echoBase64($b_encoded)
|
||||
{
|
||||
return new SOAP_Value('return','base64Binary',base64_encode(base64_decode($b_encoded)));
|
||||
return $b_encoded;
|
||||
}
|
||||
|
||||
function echoDate($timeInstant)
|
||||
{
|
||||
$dt = new SOAP_Type_dateTime($timeInstant);
|
||||
if ($dt->toUnixtime() != -1) {
|
||||
$value = $dt->toSOAP();
|
||||
return new SOAP_Value('return','dateTime',$value);
|
||||
} else {
|
||||
return new SOAP_Fault("Value $timeInstant is not a dateTime value");
|
||||
}
|
||||
return $timeInstant;
|
||||
}
|
||||
|
||||
function echoHexBinary($hb)
|
||||
{
|
||||
return new SOAP_Value('return','hexBinary',bin2hex(hex2bin($hb)));
|
||||
return $hb;
|
||||
}
|
||||
|
||||
function echoDecimal($dec)
|
||||
{
|
||||
return new SOAP_Value('return','decimal',(FLOAT)$dec);
|
||||
return $dec;
|
||||
}
|
||||
|
||||
function echoBoolean($boolean)
|
||||
{
|
||||
return new SOAP_Value('return','boolean',$boolean);
|
||||
return $boolean;
|
||||
}
|
||||
|
||||
|
||||
function echoMimeAttachment($stuff)
|
||||
{
|
||||
return new SOAP_Attachment('return','application/octet-stream',NULL,$stuff);
|
||||
}
|
||||
}
|
||||
|
||||
$base = new SOAP_Interop_Base();
|
||||
$server->addObjectMap($base);
|
||||
$server = new SoapServer("http://test-uri");
|
||||
$server->bind("http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/interop.wsdl.php");
|
||||
$server->setClass("SOAP_Interop_Base");
|
||||
$server->handle();
|
||||
?>
|
@ -19,69 +19,52 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
require_once 'SOAP/Server.php';
|
||||
|
||||
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')
|
||||
);
|
||||
|
||||
# $server->addToMap('echoSimpleTypesAsStruct',
|
||||
# array('outputString' => 'string', 'outputInteger' => 'int', 'outputFloat' => 'float'),
|
||||
# array('return' => 'struct'));
|
||||
# $server->addToMap('echoNestedStruct', array(), array());
|
||||
# $server->addToMap('echo2DStringArray', array(), array());
|
||||
# $server->addToMap('echoNestedArray', array(), array());
|
||||
$this->dispatch_map['echoStructAsSimpleTypes'] =
|
||||
array('in' => array('inputStruct' => 'SOAPStruct'),
|
||||
'out' => array('outputString' => 'string', 'outputInteger' => 'int', 'outputFloat' => 'float')
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function echoStructAsSimpleTypes ($struct)
|
||||
{
|
||||
# convert a SOAPStruct to an array
|
||||
$vals = array_values($struct);
|
||||
return array(
|
||||
new SOAP_Value('outputString','string',$struct['varString']),
|
||||
new SOAP_Value('outputInteger','int',$struct['varInt']),
|
||||
new SOAP_Value('outputFloat','float',$struct['varFloat'])
|
||||
);
|
||||
return array_values($struct);
|
||||
return array('outputString' => $struct->varString,
|
||||
'outputInteger' => $struct->varInt,
|
||||
'outputFloat' => $struct->varFloat);
|
||||
}
|
||||
|
||||
function echoSimpleTypesAsStruct($string, $int, $float)
|
||||
{
|
||||
# convert a input into struct
|
||||
$ret = new SOAP_Value('return','{http://soapinterop.org/xsd}SOAPStruct',
|
||||
array( #push struct elements into one soap value
|
||||
new SOAP_Value('varString','string',$string),
|
||||
new SOAP_Value('varInt','int',(int)$int),
|
||||
new SOAP_Value('varFloat','float',(FLOAT)$float)
|
||||
)
|
||||
);
|
||||
return $ret;
|
||||
return (object)array("varString" => $string,
|
||||
"varInt" => $int,
|
||||
"varFloat" => $float);
|
||||
}
|
||||
|
||||
function echoNestedStruct($struct)
|
||||
{
|
||||
return $struct;
|
||||
return $struct;
|
||||
}
|
||||
|
||||
function echo2DStringArray($ary)
|
||||
{
|
||||
$ret = new SOAP_Value('return','Array',$ary);
|
||||
$ret->options['flatten'] = TRUE;
|
||||
return $ret;
|
||||
// $ret->options['flatten'] = TRUE;
|
||||
return $ary;
|
||||
}
|
||||
|
||||
function echoNestedArray($ary)
|
||||
{
|
||||
return $ary;
|
||||
return $ary;
|
||||
}
|
||||
}
|
||||
|
||||
$groupb = new SOAP_Interop_GroupB();
|
||||
$server->addObjectMap($groupb);
|
||||
|
||||
$server = new SoapServer("http://test-uri");
|
||||
$server->bind("http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/interopB.wsdl.php");
|
||||
$server->setClass("SOAP_Interop_GroupB");
|
||||
$server->handle();
|
||||
?>
|
@ -18,12 +18,10 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
require_once 'SOAP/Server.php';
|
||||
require_once 'SOAP/Value.php';
|
||||
|
||||
class SOAP_Interop_GroupC {
|
||||
var $method_namespace = 'http://soapinterop.org/echoheader/';
|
||||
|
||||
|
||||
function echoMeStringRequest($string)
|
||||
{
|
||||
return new SOAP_Value('{'.$this->method_namespace.'}echoMeStringResponse','string',$string);
|
||||
@ -35,7 +33,7 @@ class SOAP_Interop_GroupC {
|
||||
}
|
||||
}
|
||||
|
||||
$groupc = new SOAP_Interop_GroupC();
|
||||
$server->addObjectMap($groupc);
|
||||
|
||||
$server = new SoapServer("http://test-uri");
|
||||
$server->setClass("SOAP_Interop_GroupC");
|
||||
$server->handle();
|
||||
?>
|
@ -1,258 +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> Port to PEAR and more |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
require_once 'SOAP/Server.php';
|
||||
|
||||
$server = new SOAP_Server;
|
||||
|
||||
require_once 'server_round2_base.php';
|
||||
require_once 'server_round2_groupB.php';
|
||||
require_once 'server_round2_groupC.php';
|
||||
|
||||
$test = '<?xml version="1.0"?>
|
||||
|
||||
<SOAP-ENV:Envelope 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:ns6="http://soapinterop.org/echoheader/"
|
||||
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<SOAP-ENV:Header>
|
||||
|
||||
<ns6:echoMeStringRequest xsi:type="xsd:string" SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:mustUnderstand="0">hello world</ns6:echoMeStringRequest>
|
||||
</SOAP-ENV:Header>
|
||||
<SOAP-ENV:Body>
|
||||
|
||||
<echoVoid></echoVoid>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>';
|
||||
|
||||
$test = '<?xml version="1.0"?>
|
||||
|
||||
<SOAP-ENV:Envelope 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:ns6="http://soapinterop.org/echoheader/"
|
||||
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<SOAP-ENV:Header>
|
||||
|
||||
<ns6:echoMeStructRequest xsi:type="si:SOAPStruct"
|
||||
SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next"
|
||||
SOAP-ENV:mustUnderstand="1">
|
||||
<varString xsi:type="xsd:string">arg</varString>
|
||||
|
||||
<varInt xsi:type="xsd:int">34</varInt>
|
||||
|
||||
<varFloat xsi:type="xsd:float">325.325</varFloat>
|
||||
</ns6:echoMeStructRequest>
|
||||
</SOAP-ENV:Header>
|
||||
<SOAP-ENV:Body>
|
||||
|
||||
<echoVoid></echoVoid>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>
|
||||
';
|
||||
|
||||
$test = '<?xml version="1.0"?>
|
||||
|
||||
<SOAP-ENV:Envelope 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:ns6="http://soapinterop.org/echoheader/"
|
||||
xmlns:ns7="http://soapinterop.org/"
|
||||
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<SOAP-ENV:Body>
|
||||
|
||||
<ns7:echoString>
|
||||
<inputString xsi:type="xsd:string"></inputString>
|
||||
</ns7:echoString>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>
|
||||
';
|
||||
$test = '<?xml version="1.0" encoding="US-ASCII"?>
|
||||
|
||||
<SOAP-ENV:Envelope 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:ns6="http://soapinterop.org/"
|
||||
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<SOAP-ENV:Body>
|
||||
<ns6:echoVoid/>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>';
|
||||
|
||||
$test = '<?xml version="1.0" encoding="US-ASCII"?>
|
||||
|
||||
<SOAP-ENV:Envelope 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:ns6="http://soapinterop.org/"
|
||||
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<SOAP-ENV:Body>
|
||||
<ns6:echoIntegerArray><inputIntegerArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:int[3]" SOAP-ENC:offset="[0]"><item xsi:type="xsd:int">1</item>
|
||||
<item xsi:type="xsd:int">234324324</item>
|
||||
<item xsi:type="xsd:int">2</item>
|
||||
</inputIntegerArray>
|
||||
</ns6:echoIntegerArray>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>';
|
||||
|
||||
#$test = "<S:Envelope
|
||||
#S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
|
||||
#xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/'
|
||||
#xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'
|
||||
#xmlns:a='http://soapinterop.org/'
|
||||
#xmlns:b='http://soapinterop.org/xsd'
|
||||
#xmlns:XS='http://www.w3.org/2001/XMLSchema'
|
||||
#xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'>
|
||||
#<S:Body>
|
||||
#<b:SOAPStruct Enc:root='0' id='21b56c4' XI:type='b:SOAPStruct'>
|
||||
#<varInt XI:type='XS:int'>1</varInt>
|
||||
#<varFloat XI:type='XS:float'>2</varFloat>
|
||||
#<varString XI:type='XS:string'>wilma</varString>
|
||||
#</b:SOAPStruct>
|
||||
#<a:echoStructArray>
|
||||
#<inputStructArray XI:type='Enc:Array' Enc:arrayType='XS:anyType[3]'>
|
||||
#<fred href='#21b56c4'/>
|
||||
#<i href='#21b56c4'/>
|
||||
#<i href='#21b56c4'/>
|
||||
#</inputStructArray>
|
||||
#</a:echoStructArray>
|
||||
#</S:Body></S:Envelope>";
|
||||
|
||||
#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:b='http://soapinterop.org/xsd' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoStructArray><inputStructArray XI:type='Enc:Array' Enc:arrayType='b:SOAPStruct[2]'><inputStruct href='#213e654'/> <inputStruct href='#21b8c4c'/> </inputStructArray> </a:echoStructArray> <b:SOAPStruct Enc:root='0' id='21b8c4c' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>-1</varInt> <varFloat XI:type='XS:float'>-1</varFloat> <varString XI:type='XS:string'>lean on into the groove y'all</varString> </b:SOAPStruct> <b:SOAPStruct Enc:root='0' id='213e654' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>1073741824</varInt> <varFloat XI:type='XS:float'>-42.24</varFloat> <varString XI:type='XS:string'>pocketSOAP rocks!<g></varString> </b:SOAPStruct> </S:Body></S:Envelope>";
|
||||
|
||||
#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:b='http://soapinterop.org/' xmlns:a='http://soapinterop.org/headers/' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Header> <a:Transaction S:mustUnderstand='1' XI:type='XS:short'>5</a:Transaction> </S:Header> <S:Body><b:echoString><inputString XI:type='XS:string'>Opps, should never see me</inputString> </b:echoString> </S:Body></S:Envelope>";
|
||||
#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:b='http://soapinterop.org/' xmlns:a='http://soapinterop.org/headers/' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Header> <a:Transaction XI:type='XS:short'>5</a:Transaction> </S:Header> <S:Body><b:echoString><inputString XI:type='XS:string'>Opps, should never see me</inputString> </b:echoString> </S:Body></S:Envelope>";
|
||||
#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:b='http://soapinterop.org/xsd' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoStructAsSimpleTypes><inputStruct href='#213e59c'/> </a:echoStructAsSimpleTypes> <b:SOAPStruct Enc:root='0' id='213e59c' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>42</varInt> <varString XI:type='XS:string'>Orbital</varString> <varFloat XI:type='XS:float'>-42.42</varFloat> </b:SOAPStruct> </S:Body></S:Envelope>";
|
||||
|
||||
// white mesa failures
|
||||
/*$test = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><h:echoMeStringRequest SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:mustUnderstand="1" xmlns:h="http://unknown.org/">White Mesa Test Header String.</h:echoMeStringRequest></SOAP-ENV:Header><SOAP-ENV:Body><m:echoVoid SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:m="http://soapinterop.org/" /></SOAP-ENV:Body></SOAP-ENV:Envelope>';
|
||||
*/
|
||||
/*
|
||||
$test = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><h:echoMeStringRequest SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:mustUnderstand="1" xmlns:h="http://unknown.org/">White Mesa Test Header String.</h:echoMeStringRequest></SOAP-ENV:Header><SOAP-ENV:Body><m:echoVoid SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:m="http://soapinterop.org/" /></SOAP-ENV:Body></SOAP-ENV:Envelope>';
|
||||
*/
|
||||
//$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoIntegerArray><inputIntegerArray XI:nil='true'></inputIntegerArray> </a:echoIntegerArray> </S:Body></S:Envelope>";
|
||||
|
||||
$test = '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<SOAP-ENV:Envelope 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:ns4="http://soapinterop.org/"
|
||||
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<SOAP-ENV:Body>
|
||||
|
||||
<ns4:echo2DStringArray>
|
||||
<input2DStringArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[2,3]">
|
||||
<item xsi:type="xsd:string">row0col0</item>
|
||||
<item xsi:type="xsd:string">row0col1</item>
|
||||
<item xsi:type="xsd:string">row0col2</item>
|
||||
<item xsi:type="xsd:string">row1col0</item>
|
||||
<item xsi:type="xsd:string">row1col1</item>
|
||||
<item xsi:type="xsd:string">row1col2</item></input2DStringArray></ns4:echo2DStringArray>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>';
|
||||
|
||||
$_SERVER['REQUEST_METHOD'] = "POST";
|
||||
$_SERVER['CONTENT_TYPE'] = 'multipart/related; type=text/xml; boundary="=_d624611fe466a88d956a205651c74fdb"';
|
||||
|
||||
$test = '--=_d624611fe466a88d956a205651c74fdb
|
||||
Content-Type: text/xml; charset="UTF-8"
|
||||
Content-Transfer-Encoding: base64
|
||||
|
||||
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCg0KPFNPQVAtRU5WOkVudmVs
|
||||
b3BlICB4bWxuczpTT0FQLUVOVj0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZl
|
||||
bG9wZS8iDQogIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiDQog
|
||||
IHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiDQog
|
||||
IHhtbG5zOlNPQVAtRU5DPSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy9zb2FwL2VuY29kaW5n
|
||||
LyINCiAgU09BUC1FTlY6ZW5jb2RpbmdTdHlsZT0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcv
|
||||
c29hcC9lbmNvZGluZy8iPg0KPFNPQVAtRU5WOkJvZHk+DQoNCjxlY2hvTWltZUF0dGFjaG1lbnQ+
|
||||
DQo8dGVzdCBocmVmPSJjaWQ6ZTZiOTg0M2JiYzUxY2JiMDAzOTk0MGVmN2VlNzY2MDMiLz48L2Vj
|
||||
aG9NaW1lQXR0YWNobWVudD4NCjwvU09BUC1FTlY6Qm9keT4NCjwvU09BUC1FTlY6RW52ZWxvcGU+
|
||||
DQo=
|
||||
--=_d624611fe466a88d956a205651c74fdb
|
||||
Content-Disposition: attachment.php
|
||||
Content-Type: text/plain
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-ID: <e6b9843bbc51cbb0039940ef7ee76603>
|
||||
|
||||
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
|
||||
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
|
||||
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
|
||||
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
|
||||
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
|
||||
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
|
||||
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
|
||||
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
|
||||
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
|
||||
Ow0KcHJpbnRfcigkcmVzcCk7DQpwcmludCAkY2xpZW50LT53aXJlOw0KPz4=
|
||||
--=_d624611fe466a88d956a205651c74fdb--';
|
||||
|
||||
$_SERVER['CONTENT_TYPE'] = 'multipart/related; type=text/xml; boundary="=_a2cbb051424cc43e72d3c8c8d0b8f70e"';
|
||||
$test='--=_a2cbb051424cc43e72d3c8c8d0b8f70e
|
||||
Content-Type: text/xml; charset="UTF-8"
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<SOAP-ENV:Envelope 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/"
|
||||
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<SOAP-ENV:Body>
|
||||
|
||||
<echoMimeAttachment>
|
||||
<test href="cid:a223fea3c35b5f0e6dedf8da75efd6b3"/></echoMimeAttachment>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>
|
||||
|
||||
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
|
||||
Content-Disposition: attachment.php
|
||||
Content-Type: text/plain
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-ID: <a223fea3c35b5f0e6dedf8da75efd6b3>
|
||||
|
||||
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
|
||||
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
|
||||
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
|
||||
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
|
||||
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
|
||||
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
|
||||
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
|
||||
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
|
||||
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
|
||||
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
|
||||
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
|
||||
';
|
||||
$server->service($test, '',TRUE);
|
||||
print $server->response;
|
||||
?>
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
require_once("SOAP/Parser.php");
|
||||
require_once("SOAP/Value.php");
|
||||
|
||||
function number_compare($f1, $f2)
|
||||
{
|
||||
@ -12,7 +10,8 @@ function number_compare($f1, $f2)
|
||||
$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 bccomp($f1, $f2, $d) == 0;
|
||||
return $f1 == $f2;
|
||||
// return bccomp($f1, $f2, $d) == 0;
|
||||
}
|
||||
|
||||
function boolean_compare($f1, $f2)
|
||||
@ -34,30 +33,50 @@ function string_compare($e1, $e2)
|
||||
$e2_type = gettype($e2);
|
||||
$ok = FALSE;
|
||||
if ($e1_type == "string") {
|
||||
$dt = new SOAP_Type_dateTime();
|
||||
$ok = $dt->compare($e1, $e2) == 0;
|
||||
// $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;
|
||||
# first a shallow diff
|
||||
if (count($ar1) != count($ar2)) return FALSE;
|
||||
$diff = array_diff($ar1, $ar2);
|
||||
if (count($diff) == 0) return TRUE;
|
||||
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;
|
||||
}
|
||||
|
||||
# diff failed, do a full check of the array
|
||||
foreach ($ar1 as $k => $v) {
|
||||
#print "comparing $v == $ar2[$k]\n";
|
||||
if (gettype($v) == "array") {
|
||||
if (!array_compare($v, $ar2[$k])) return FALSE;
|
||||
} else {
|
||||
if (!string_compare($v, $ar2[$k])) return FALSE;
|
||||
}
|
||||
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 TRUE;
|
||||
}
|
||||
return $ok;
|
||||
}
|
||||
|
||||
|
||||
@ -77,5 +96,12 @@ function parseMessage($msg)
|
||||
return $v;
|
||||
}
|
||||
|
||||
function var_dump_str($var) {
|
||||
ob_start();
|
||||
var_dump($var);
|
||||
$res = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $res;
|
||||
}
|
||||
|
||||
?>
|
@ -1,17 +0,0 @@
|
||||
<html><body>
|
||||
<?
|
||||
error_reporting(2039);
|
||||
include("SOAP/Client.php");
|
||||
|
||||
$txt = "Bjoern";
|
||||
|
||||
$soapc = new SOAP_Client("http://localhost/soap_interop/testserver.php");
|
||||
$soapc->debug_flag = TRUE;
|
||||
print_r($soapc->call("testMethod",array("txt" => $txt)));
|
||||
print "<br>Debug: ";
|
||||
print $soapc->wire;
|
||||
print "<br><br>";
|
||||
unset($soapc);
|
||||
|
||||
?>
|
||||
</html></body>
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
include "SOAP/Server.php";
|
||||
|
||||
function testMethod($arg) {
|
||||
if ($arg != "") {
|
||||
return crypt($arg);
|
||||
} else {
|
||||
return "Please supply a text";
|
||||
}
|
||||
}
|
||||
|
||||
$server = new soap_server();
|
||||
|
||||
$server->addToMap("testMethod",array("string"),array("string"));
|
||||
$server->service($HTTP_RAW_POST_DATA);
|
||||
echo "<!-- this is a test -->";
|
||||
?>
|
@ -21,6 +21,12 @@
|
||||
<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>
|
||||
@ -56,4 +62,3 @@
|
||||
</dir>
|
||||
</filelist>
|
||||
</package>
|
||||
|
||||
|
@ -5,10 +5,10 @@
|
||||
encode defaultEncoding[] = {
|
||||
{{UNKNOWN_TYPE, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert},
|
||||
|
||||
{{IS_NULL, "null", "null", NULL}, to_zval_null, to_xml_null},
|
||||
{{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_string},
|
||||
{{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_ENC_NAMESPACE, NULL}, to_zval_array, guess_array_map},
|
||||
@ -17,9 +17,9 @@ encode defaultEncoding[] = {
|
||||
|
||||
{{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_double, to_xml_string},
|
||||
{{XSD_FLOAT, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
|
||||
{{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
|
||||
{{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_NAMESPACE, NULL}, to_zval_string, 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_string, to_xml_datetime},
|
||||
{{XSD_TIME, XSD_TIME_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_time},
|
||||
{{XSD_DATE, XSD_DATE_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_date},
|
||||
@ -32,8 +32,16 @@ encode defaultEncoding[] = {
|
||||
{{XSD_BASE64BINARY, XSD_BASE64BINARY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, 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_string},
|
||||
{{XSD_SHORT, XSD_SHORT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_string},
|
||||
{{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},
|
||||
|
||||
{{APACHE_MAP, APACHE_MAP_STRING, APACHE_NAMESPACE, NULL}, to_zval_map, to_xml_map},
|
||||
|
||||
@ -43,12 +51,12 @@ encode defaultEncoding[] = {
|
||||
/* 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_long, to_xml_string},
|
||||
{{XSD_FLOAT, XSD_FLOAT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_string},
|
||||
{{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_string},
|
||||
{{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_string, 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_string},
|
||||
{{XSD_SHORT, XSD_SHORT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_string},
|
||||
{{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_1999_TIMEINSTANT, XSD_1999_TIMEINSTANT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_string, to_xml_string},
|
||||
|
||||
{{END_KNOWN_TYPES, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert}
|
||||
@ -63,9 +71,6 @@ encode defaultEncoding[] = {
|
||||
#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
|
||||
@ -88,24 +93,8 @@ encode defaultEncoding[] = {
|
||||
#define XSD_ENTITY_STRING "ENTITY"
|
||||
#define XSD_ENTITYS 129
|
||||
#define XSD_ENTITYS_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_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"
|
||||
*/
|
||||
};
|
||||
|
||||
@ -126,7 +115,6 @@ xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style)
|
||||
zval *master_to_zval(encodePtr encode, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
|
||||
data = check_and_resolve_href(data);
|
||||
if(encode->to_zval_before)
|
||||
data = encode->to_zval_before(encode->details, data, 0);
|
||||
@ -267,9 +255,11 @@ zval *to_zval_string(encodeType type, xmlNodePtr data)
|
||||
zval *ret;
|
||||
MAKE_STD_ZVAL(ret);
|
||||
FIND_XML_NULL(data, ret);
|
||||
|
||||
if(data && data->children)
|
||||
if(data && data->children && data->children->content) {
|
||||
ZVAL_STRING(ret, data->children->content, 1);
|
||||
} else {
|
||||
ZVAL_EMPTY_STRING(ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -278,9 +268,11 @@ zval *to_zval_stringl(encodeType type, xmlNodePtr data)
|
||||
zval *ret;
|
||||
MAKE_STD_ZVAL(ret);
|
||||
FIND_XML_NULL(data, ret);
|
||||
|
||||
if(data && data->children)
|
||||
if(data && data->children && data->children->content) {
|
||||
ZVAL_STRINGL(ret, data->children->content, xmlStrlen(data->children->content), 1);
|
||||
} else {
|
||||
ZVAL_EMPTY_STRING(ret)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -292,16 +284,23 @@ xmlNodePtr to_xml_string(encodeType type, zval *data, int style)
|
||||
TSRMLS_FETCH();
|
||||
|
||||
ret = xmlNewNode(NULL, "BOGUS");
|
||||
FIND_ZVAL_NULL(data, ret);
|
||||
FIND_ZVAL_NULL(data, ret, style);
|
||||
|
||||
convert_to_string(data);
|
||||
str = php_escape_html_entities(Z_STRVAL_P(data), Z_STRLEN_P(data), &new_len, 0, 0, NULL TSRMLS_CC);
|
||||
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)
|
||||
@ -314,10 +313,17 @@ xmlNodePtr to_xml_stringl(encodeType type, zval *data, int style)
|
||||
xmlNodePtr ret;
|
||||
|
||||
ret = xmlNewNode(NULL, "BOGUS");
|
||||
FIND_ZVAL_NULL(data, ret);
|
||||
FIND_ZVAL_NULL(data, ret, style);
|
||||
|
||||
convert_to_string(data);
|
||||
xmlNodeSetContentLen(ret, estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data)), Z_STRLEN_P(data));
|
||||
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);
|
||||
@ -330,7 +336,11 @@ zval *to_zval_double(encodeType type, xmlNodePtr data)
|
||||
MAKE_STD_ZVAL(ret);
|
||||
FIND_XML_NULL(data, ret);
|
||||
|
||||
ZVAL_DOUBLE(ret, atof(data->children->content));
|
||||
if (data && data->children && data->children->content) {
|
||||
ZVAL_DOUBLE(ret, atof(data->children->content));
|
||||
} else {
|
||||
ZVAL_NULL(ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -340,21 +350,53 @@ zval *to_zval_long(encodeType type, xmlNodePtr data)
|
||||
MAKE_STD_ZVAL(ret);
|
||||
FIND_XML_NULL(data, ret);
|
||||
|
||||
ZVAL_LONG(ret, atol(data->children->content));
|
||||
if (data && data->children && data->children->content) {
|
||||
ZVAL_LONG(ret, atol(data->children->content));
|
||||
} else {
|
||||
ZVAL_NULL(ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_long(encodeType type, zval *data, int style)
|
||||
{
|
||||
xmlNodePtr ret;
|
||||
zval tmp;
|
||||
|
||||
ret = xmlNewNode(NULL, "BOGUS");
|
||||
FIND_ZVAL_NULL(data, ret);
|
||||
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;
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_double(encodeType 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);
|
||||
|
||||
convert_to_long(data);
|
||||
convert_to_string(data);
|
||||
xmlNodeSetContentLen(ret, Z_STRVAL_P(data), Z_STRLEN_P(data));
|
||||
|
||||
if(style == SOAP_ENCODED)
|
||||
set_ns_and_type(ret, type);
|
||||
return ret;
|
||||
@ -366,15 +408,19 @@ zval *to_zval_bool(encodeType type, xmlNodePtr data)
|
||||
MAKE_STD_ZVAL(ret);
|
||||
FIND_XML_NULL(data, ret);
|
||||
|
||||
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);
|
||||
if (data && data->children && 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 {
|
||||
ZVAL_NULL(ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -382,16 +428,27 @@ zval *to_zval_bool(encodeType type, xmlNodePtr data)
|
||||
xmlNodePtr to_xml_bool(encodeType type, zval *data, int style)
|
||||
{
|
||||
xmlNodePtr ret;
|
||||
zval tmp;
|
||||
|
||||
ret = xmlNewNode(NULL, "BOGUS");
|
||||
FIND_ZVAL_NULL(data, ret);
|
||||
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;
|
||||
}
|
||||
|
||||
convert_to_boolean(data);
|
||||
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;
|
||||
@ -411,10 +468,10 @@ xmlNodePtr to_xml_null(encodeType type, zval *data, int style)
|
||||
xmlNodePtr ret;
|
||||
|
||||
ret = xmlNewNode(NULL, "BOGUS");
|
||||
FIND_ZVAL_NULL(data, ret);
|
||||
|
||||
FIND_ZVAL_NULL(data, ret, style);
|
||||
|
||||
if(style == SOAP_ENCODED)
|
||||
xmlSetProp(ret, "xsi:null", "1");
|
||||
xmlSetProp(ret, "xsi:nil", "1");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -423,28 +480,47 @@ zval *to_zval_object(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
xmlNodePtr trav;
|
||||
encodePtr enc;
|
||||
sdlPtr sdl;
|
||||
sdlTypePtr sdlType = NULL;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
MAKE_STD_ZVAL(ret);
|
||||
FIND_XML_NULL(data, ret);
|
||||
|
||||
sdl = SOAP_GLOBAL(sdl);
|
||||
if (sdl && type.sdl_type) {
|
||||
sdlType = type.sdl_type;
|
||||
}
|
||||
|
||||
object_init(ret);
|
||||
trav = data->children;
|
||||
|
||||
enc = get_conversion(UNKNOWN_TYPE);
|
||||
do
|
||||
{
|
||||
if(trav->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
while (trav != NULL) {
|
||||
if(trav->type == XML_ELEMENT_NODE) {
|
||||
sdlTypePtr *element;
|
||||
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);
|
||||
}
|
||||
if (enc == NULL && sdlType != NULL && sdlType->elements != NULL && trav->name != NULL &&
|
||||
zend_hash_find(sdlType->elements, (char*)trav->name, strlen(trav->name)+1,(void **)&element) == SUCCESS) {
|
||||
enc = (*element)->encode;
|
||||
}
|
||||
if (enc == NULL) {
|
||||
enc = get_conversion(UNKNOWN_TYPE);
|
||||
}
|
||||
|
||||
tmpVal = master_to_zval(enc, trav);
|
||||
#ifdef ZEND_ENGINE_2
|
||||
tmpVal->refcount--;
|
||||
#endif
|
||||
add_property_zval(ret, (char *)trav->name, tmpVal);
|
||||
}
|
||||
trav = trav->next;
|
||||
}
|
||||
while(trav = trav->next);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -456,18 +532,21 @@ xmlNodePtr to_xml_object(encodeType type, zval *data, int style)
|
||||
TSRMLS_FETCH();
|
||||
|
||||
/* Special handling of class SoapVar */
|
||||
if(data && Z_TYPE_P(data) == IS_OBJECT && !strcmp(Z_OBJCE_P(data)->name, soap_var_class_entry.name))
|
||||
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");
|
||||
if(zend_hash_find(Z_OBJPROP_P(data), "enc_value", sizeof("enc_value"), (void **)&zdata) == FAILURE)
|
||||
php_error(E_ERROR, "error encoding SoapVar");
|
||||
|
||||
enc = get_conversion(Z_LVAL_P(*ztype));
|
||||
xmlParam = master_to_xml(enc, *zdata, style);
|
||||
|
||||
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)
|
||||
{
|
||||
@ -494,7 +573,7 @@ xmlNodePtr to_xml_object(encodeType type, zval *data, int style)
|
||||
else
|
||||
{
|
||||
xmlParam = xmlNewNode(NULL, "BOGUS");
|
||||
FIND_ZVAL_NULL(data, xmlParam);
|
||||
FIND_ZVAL_NULL(data, xmlParam, style);
|
||||
|
||||
if(Z_TYPE_P(data) == IS_OBJECT)
|
||||
{
|
||||
@ -520,7 +599,7 @@ xmlNodePtr to_xml_object(encodeType type, zval *data, int style)
|
||||
zend_hash_move_forward(prop);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(style == SOAP_ENCODED)
|
||||
set_ns_and_type(xmlParam, type);
|
||||
}
|
||||
@ -535,13 +614,10 @@ xmlNodePtr guess_array_map(encodeType type, zval *data, int style)
|
||||
|
||||
if(data && Z_TYPE_P(data) == IS_ARRAY)
|
||||
{
|
||||
if(zend_hash_num_elements(Z_ARRVAL_P(data)) > 0)
|
||||
{
|
||||
if(is_map(data))
|
||||
enc = get_conversion(APACHE_MAP);
|
||||
else
|
||||
enc = get_conversion(SOAP_ENC_ARRAY);
|
||||
}
|
||||
if(is_map(data))
|
||||
enc = get_conversion(APACHE_MAP);
|
||||
else
|
||||
enc = get_conversion(SOAP_ENC_ARRAY);
|
||||
}
|
||||
if(!enc)
|
||||
enc = get_conversion(IS_NULL);
|
||||
@ -558,13 +634,13 @@ xmlNodePtr to_xml_array(encodeType type, zval *data, int style)
|
||||
|
||||
xmlParam = xmlNewNode(NULL,"BOGUS");
|
||||
|
||||
FIND_ZVAL_NULL(data, xmlParam);
|
||||
FIND_ZVAL_NULL(data, xmlParam, style);
|
||||
|
||||
if(Z_TYPE_P(data) == IS_ARRAY)
|
||||
{
|
||||
i = zend_hash_num_elements(Z_ARRVAL_P(data));
|
||||
|
||||
if(style == SOAP_ENCODED)
|
||||
if(i > 0 && style == SOAP_ENCODED)
|
||||
{
|
||||
get_array_type(data, &array_type TSRMLS_CC);
|
||||
smart_str_append(&array_type_and_size, &array_type);
|
||||
@ -604,31 +680,157 @@ xmlNodePtr to_xml_array(encodeType type, zval *data, int style)
|
||||
return xmlParam;
|
||||
}
|
||||
|
||||
static xmlNodePtr add_zval_array_elements(zval* ret,
|
||||
sdlPtr sdl,
|
||||
encodePtr enc,
|
||||
int dimension,
|
||||
int* dims,
|
||||
xmlNodePtr data)
|
||||
{
|
||||
int i;
|
||||
if (dimension == 1) {
|
||||
for (i = 0; i < dims[0]; i++) {
|
||||
zval *tmpVal;
|
||||
encodePtr typeEnc = NULL;
|
||||
xmlAttrPtr type = get_attribute(data->properties,"type");
|
||||
if (type != NULL && type->children && type->children->content) {
|
||||
typeEnc = get_encoder_from_prefix(sdl, data, type->children->content);
|
||||
}
|
||||
if (typeEnc) {
|
||||
tmpVal = master_to_zval(typeEnc, data);
|
||||
} else {
|
||||
tmpVal = master_to_zval(enc, data);
|
||||
}
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(ret), &tmpVal, sizeof(zval*), NULL);
|
||||
if (data != NULL) {
|
||||
do {
|
||||
data = data->next;
|
||||
} while (data != NULL && data->type != XML_ELEMENT_NODE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < dims[0]; i++) {
|
||||
zval *tmpVal;
|
||||
MAKE_STD_ZVAL(tmpVal);
|
||||
array_init(tmpVal);
|
||||
data = add_zval_array_elements(tmpVal,sdl,enc,dimension-1,dims+1,data);
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(ret), &tmpVal, sizeof(zval*), NULL);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
zval *to_zval_array(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
xmlNodePtr trav;
|
||||
encodePtr enc;
|
||||
encodePtr enc = NULL;
|
||||
int dimension = 1;
|
||||
int* dims = NULL;
|
||||
xmlAttrPtr arrayTypeAttr;
|
||||
sdlPtr sdl;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
|
||||
MAKE_STD_ZVAL(ret);
|
||||
FIND_XML_NULL(data, ret);
|
||||
sdl = SOAP_GLOBAL(sdl);
|
||||
|
||||
if (data &&
|
||||
(arrayTypeAttr = get_attribute(data->properties,"arrayType")) &&
|
||||
arrayTypeAttr->children &&
|
||||
arrayTypeAttr->children->content) {
|
||||
char *type, *end, *ns;
|
||||
xmlNsPtr nsptr;
|
||||
|
||||
parse_namespace(arrayTypeAttr->children->content, &type, &ns);
|
||||
nsptr = xmlSearchNs(arrayTypeAttr->doc, arrayTypeAttr->parent, ns);
|
||||
|
||||
end = strrchr(type,'[');
|
||||
if (end) {
|
||||
int i;
|
||||
char *tmp = end+1;
|
||||
*end = '\0';
|
||||
end++;
|
||||
while (*tmp != ']' && *tmp != '\0') {
|
||||
if (*tmp == ',') {
|
||||
dimension++;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
dims = emalloc(sizeof(int)*dimension);
|
||||
memset(dims,0,sizeof(int)*dimension);
|
||||
tmp = end; i = 0;
|
||||
while (*tmp != ']' && *tmp != '\0') {
|
||||
if (*tmp >= '0' && *tmp <= '9') {
|
||||
dims[i] = (dims[i]*10)+(*tmp-'0');
|
||||
} else if (*tmp == ',') {
|
||||
i++;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
if(nsptr != NULL) {
|
||||
enc = get_encoder(SOAP_GLOBAL(sdl), nsptr->href, type);
|
||||
}
|
||||
efree(type);
|
||||
if (ns) efree(ns);
|
||||
}
|
||||
if (enc == NULL) {
|
||||
enc = get_conversion(UNKNOWN_TYPE);
|
||||
}
|
||||
|
||||
array_init(ret);
|
||||
trav = data->children;
|
||||
|
||||
enc = get_conversion(UNKNOWN_TYPE);
|
||||
while(trav)
|
||||
{
|
||||
if(trav->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
zval *tmpVal;
|
||||
tmpVal = master_to_zval(enc, trav);
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(ret), &tmpVal, sizeof(zval *), NULL);
|
||||
if (dims == NULL) {
|
||||
trav = data->children;
|
||||
while(trav) {
|
||||
if(trav->type == XML_ELEMENT_NODE) {
|
||||
zval *tmpVal;
|
||||
encodePtr typeEnc = NULL;
|
||||
xmlAttrPtr type = get_attribute(trav->properties,"type");
|
||||
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);
|
||||
}
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(ret), &tmpVal, sizeof(zval *), NULL);
|
||||
}
|
||||
trav = trav->next;
|
||||
}
|
||||
trav = trav->next;
|
||||
} else {
|
||||
trav = data->children;
|
||||
while (trav != NULL && trav->type != XML_ELEMENT_NODE) {
|
||||
trav = trav->next;
|
||||
}
|
||||
add_zval_array_elements(ret, sdl, enc, dimension, dims, trav);
|
||||
}
|
||||
/*
|
||||
if (data) {
|
||||
if (dims == NULL && dimension <= 1) {
|
||||
trav = data->children;
|
||||
while(trav) {
|
||||
if(trav->type == XML_ELEMENT_NODE) {
|
||||
zval *tmpVal;
|
||||
tmpVal = master_to_zval(enc, trav);
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(ret), &tmpVal, sizeof(zval *), NULL);
|
||||
}
|
||||
trav = trav->next;
|
||||
}
|
||||
} else {
|
||||
trav = data->children;
|
||||
while (trav != NULL && trav->type != XML_ELEMENT_NODE) {
|
||||
trav = trav->next;
|
||||
}
|
||||
add_zval_array_elements(ret, enc, dimension, dims, trav);
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (dims) {
|
||||
efree(dims);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -640,7 +842,7 @@ xmlNodePtr to_xml_map(encodeType type, zval *data, int style)
|
||||
TSRMLS_FETCH();
|
||||
|
||||
xmlParam = xmlNewNode(NULL, "BOGUS");
|
||||
FIND_ZVAL_NULL(data, xmlParam);
|
||||
FIND_ZVAL_NULL(data, xmlParam, style);
|
||||
|
||||
if(Z_TYPE_P(data) == IS_ARRAY)
|
||||
{
|
||||
@ -709,33 +911,36 @@ zval *to_zval_map(encodeType type, xmlNodePtr data)
|
||||
MAKE_STD_ZVAL(ret);
|
||||
FIND_XML_NULL(data, ret);
|
||||
|
||||
array_init(ret);
|
||||
trav = data->children;
|
||||
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");
|
||||
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");
|
||||
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);
|
||||
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");
|
||||
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);
|
||||
}
|
||||
ENDFOREACH(trav);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -760,14 +965,21 @@ zval *guess_zval_convert(encodeType type, xmlNodePtr data)
|
||||
|
||||
data = check_and_resolve_href(data);
|
||||
|
||||
if(data == NULL || data->children == NULL)
|
||||
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)
|
||||
{
|
||||
enc = get_conversion_from_type(data, tmpattr->children->content);
|
||||
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);
|
||||
@ -786,15 +998,14 @@ zval *guess_zval_convert(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
enc = get_conversion(XSD_STRING);
|
||||
trav = data->children;
|
||||
do
|
||||
{
|
||||
while (trav != NULL) {
|
||||
if(trav->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
enc = get_conversion(SOAP_ENC_OBJECT);
|
||||
break;
|
||||
}
|
||||
trav = trav->next;
|
||||
}
|
||||
while(trav = trav->next);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -813,24 +1024,32 @@ xmlNodePtr to_xml_datetime_ex(encodeType type, zval *data, char *format, int sty
|
||||
xmlNodePtr xmlParam;
|
||||
|
||||
xmlParam = xmlNewNode(NULL, "BOGUS");
|
||||
FIND_ZVAL_NULL(data, xmlParam);
|
||||
FIND_ZVAL_NULL(data, xmlParam, style);
|
||||
|
||||
timestamp = Z_LVAL_P(data);
|
||||
if (Z_TYPE_P(data) == IS_LONG) {
|
||||
timestamp = Z_LVAL_P(data);
|
||||
/*time(×tamp);*/
|
||||
ta = php_localtime_r(×tamp, &tmbuf);
|
||||
|
||||
time(×tamp);
|
||||
ta = php_localtime_r(×tamp, &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;
|
||||
}
|
||||
|
||||
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;
|
||||
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");
|
||||
}
|
||||
|
||||
xmlNodeSetContent(xmlParam, buf);
|
||||
efree(buf);
|
||||
|
||||
if(style == SOAP_ENCODED)
|
||||
set_ns_and_type(xmlParam, type);
|
||||
return xmlParam;
|
||||
@ -966,20 +1185,20 @@ encodePtr get_conversion_ex(HashTable *encoding, int encode)
|
||||
return *enc;
|
||||
}
|
||||
|
||||
encodePtr get_conversion_from_href_type_ex(HashTable *encoding, char *type, int len)
|
||||
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, type, len + 1, (void **)&enc) == FAILURE)
|
||||
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, char *type)
|
||||
encodePtr get_conversion_from_type_ex(HashTable *encoding, xmlNodePtr node, const char *type)
|
||||
{
|
||||
encodePtr *enc = NULL;
|
||||
xmlNsPtr nsptr;
|
||||
@ -1000,14 +1219,14 @@ encodePtr get_conversion_from_type_ex(HashTable *encoding, xmlNodePtr node, char
|
||||
|
||||
if(zend_hash_find(encoding, nscat.c, nscat.len + 1, (void **)&enc) == FAILURE)
|
||||
{
|
||||
if(zend_hash_find(encoding, type, strlen(type) + 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, type, strlen(type) + 1, (void **)&enc) == FAILURE)
|
||||
if(zend_hash_find(encoding, (char*)type, strlen(type) + 1, (void **)&enc) == FAILURE)
|
||||
enc = NULL;
|
||||
}
|
||||
|
||||
@ -1035,7 +1254,6 @@ void get_array_type(zval *array, smart_str *type TSRMLS_DC)
|
||||
{
|
||||
HashTable *ht = HASH_OF(array);
|
||||
int i, count, cur_type, prev_type, different;
|
||||
char *name = NULL;
|
||||
zval **tmp;
|
||||
/* TSRMLS_FETCH();*/
|
||||
|
||||
@ -1051,7 +1269,7 @@ void get_array_type(zval *array, smart_str *type TSRMLS_DC)
|
||||
{
|
||||
zend_hash_get_current_data(ht, (void **)&tmp);
|
||||
|
||||
if(Z_TYPE_PP(tmp) == IS_OBJECT && !strcmp(Z_OBJCE_PP(tmp)->name, soap_var_class_entry.name))
|
||||
if(Z_TYPE_PP(tmp) == IS_OBJECT && Z_OBJCE_PP(tmp) == soap_var_class_entry)
|
||||
{
|
||||
zval **ztype;
|
||||
|
||||
@ -1132,4 +1350,3 @@ void delete_encoder(void *encode)
|
||||
delete_mapping(t->details.map);
|
||||
free(t);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
#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
|
||||
@ -173,6 +175,7 @@ zval *to_zval_null(encodeType type, xmlNodePtr data);
|
||||
zval *guess_zval_convert(encodeType type, xmlNodePtr data);
|
||||
|
||||
xmlNodePtr to_xml_long(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_double(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_bool(encodeType type, zval *data, int style);
|
||||
|
||||
/* String encode */
|
||||
@ -214,8 +217,8 @@ smart_str *encode_new_ns();
|
||||
void set_ns_and_type(xmlNodePtr node, encodeType type);
|
||||
void set_ns_and_type_ex(xmlNodePtr node, char *ns, char *type);
|
||||
encodePtr get_conversion_ex(HashTable *encoding, int encode);
|
||||
encodePtr get_conversion_from_type_ex(HashTable *encoding, xmlNodePtr node, char *type);
|
||||
encodePtr get_conversion_from_href_type_ex(HashTable *encoding, char *type, int len);
|
||||
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);
|
||||
|
||||
int is_map(zval *array);
|
||||
void get_array_type(zval *array, smart_str *out_type TSRMLS_DC);
|
||||
@ -227,14 +230,14 @@ extern encode defaultEncoding[];
|
||||
#define FIND_XML_NULL(xml,zval) \
|
||||
{ \
|
||||
xmlAttrPtr null; \
|
||||
if(!xml || !xml->children) \
|
||||
if(!xml) \
|
||||
{ \
|
||||
ZVAL_NULL(zval); \
|
||||
return zval; \
|
||||
} \
|
||||
if(xml->properties) \
|
||||
{ \
|
||||
null = get_attribute(xml->properties, "null"); \
|
||||
null = get_attribute(xml->properties, "nil"); \
|
||||
if(null) \
|
||||
{ \
|
||||
ZVAL_NULL(zval); \
|
||||
@ -243,11 +246,13 @@ extern encode defaultEncoding[];
|
||||
} \
|
||||
}
|
||||
|
||||
#define FIND_ZVAL_NULL(zval, xml) \
|
||||
#define FIND_ZVAL_NULL(zval, xml, style) \
|
||||
{ \
|
||||
if(!zval) \
|
||||
if(!zval || Z_TYPE_P(zval) == IS_NULL) \
|
||||
{ \
|
||||
xmlSetProp(xml, "xsi:null", "1"); \
|
||||
if (style == SOAP_ENCODED) {\
|
||||
xmlSetProp(xml, "xsi:nil", "1"); \
|
||||
}\
|
||||
return xml; \
|
||||
} \
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
#include "php_soap.h"
|
||||
|
||||
void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, char *soapaction TSRMLS_DC)
|
||||
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);
|
||||
|
||||
int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *soapaction TSRMLS_DC)
|
||||
{
|
||||
xmlChar *buf;
|
||||
char *soap_headers;
|
||||
@ -15,10 +19,10 @@ void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, ch
|
||||
FETCH_THIS_SDL(sdl);
|
||||
|
||||
xmlDocDumpMemory(doc, &buf, &buf_size);
|
||||
|
||||
if(!buf)
|
||||
php_error(E_ERROR, "Error build soap request");
|
||||
|
||||
if(!buf) {
|
||||
add_soap_fault(this_ptr, "SOAP-ENV: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);
|
||||
@ -31,8 +35,10 @@ void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, ch
|
||||
if(!sdl)
|
||||
{
|
||||
zval **location;
|
||||
if(zend_hash_find(Z_OBJPROP_P(this_ptr), "location", sizeof("location"),(void **) &location) == FAILURE)
|
||||
php_error(E_ERROR, "Error could not find location");
|
||||
if(zend_hash_find(Z_OBJPROP_P(this_ptr), "location", sizeof("location"),(void **) &location) == FAILURE) {
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "Error could not find location", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
url = Z_STRVAL_PP(location);
|
||||
}
|
||||
else
|
||||
@ -42,22 +48,26 @@ void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, ch
|
||||
url = binding->location;
|
||||
}
|
||||
|
||||
phpurl = php_url_parse(url);
|
||||
if (url[0] != '\000') {
|
||||
phpurl = php_url_parse(url);
|
||||
}
|
||||
if (phpurl == NULL) {
|
||||
php_error(E_ERROR, "Unable to parse URL \"%s\"", url);
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "Unable to parse URL", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
use_ssl = strcmp(phpurl->scheme, "https") == 0;
|
||||
#if !HAVE_OPENSSL_EXT
|
||||
if (use_ssl) {
|
||||
php_error(E_ERROR, "SSL support not available in this build");
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "SSL support not available in this build", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (phpurl->port == 0) {
|
||||
phpurl->port = use_ssl ? 443 : 80;
|
||||
}
|
||||
|
||||
|
||||
stream = php_stream_sock_open_host(phpurl->host, (unsigned short)phpurl->port, SOCK_STREAM, NULL, NULL);
|
||||
|
||||
if(stream)
|
||||
@ -67,18 +77,20 @@ void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, ch
|
||||
/* fire up SSL, if requested */
|
||||
if (use_ssl) {
|
||||
if (FAILURE == php_stream_sock_ssl_activate(stream, 1)) {
|
||||
php_error(E_ERROR, "SSL Connection attempt failed");
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "SSL Connection attempt failed", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
add_property_resource(this_ptr, "httpsocket", php_stream_get_resource_id(stream));
|
||||
|
||||
ret = zend_list_insert(phpurl, le_url);
|
||||
add_property_resource(this_ptr, "httpurl", ret);
|
||||
zend_list_addref(ret);
|
||||
} else {
|
||||
php_error(E_ERROR, "Could not connect to host");
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "Could not connect to host", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,23 +100,19 @@ void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, ch
|
||||
int size = strlen(header) + strlen(phpurl->host) + strlen(phpurl->path) + 10;
|
||||
|
||||
/* TODO: Add authentication */
|
||||
if(sdl != NULL)
|
||||
{
|
||||
/* TODO: need to grab soap action from wsdl....*/
|
||||
soap_headers = emalloc(size + strlen(soapaction));
|
||||
sprintf(soap_headers, header, phpurl->path, phpurl->host, buf_size, soapaction);
|
||||
}
|
||||
else
|
||||
{
|
||||
soap_headers = emalloc(size + strlen(soapaction));
|
||||
sprintf(soap_headers, header, phpurl->path, phpurl->host, buf_size, soapaction);
|
||||
}
|
||||
|
||||
|
||||
/* TODO: need to grab soap action from wsdl....*/
|
||||
soap_headers = emalloc(size + strlen(soapaction));
|
||||
sprintf(soap_headers, header, phpurl->path, phpurl->host, buf_size, soapaction);
|
||||
|
||||
err = php_stream_write(stream, soap_headers, strlen(soap_headers));
|
||||
|
||||
if(err != (int)strlen(soap_headers))
|
||||
php_error(E_ERROR,"Failed Sending HTTP Headers");
|
||||
|
||||
if(err != (int)strlen(soap_headers)) {
|
||||
php_stream_close(stream);
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "Failed Sending HTTP Headers", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
/* Send cookies along with request */
|
||||
if(zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS)
|
||||
{
|
||||
@ -131,46 +139,58 @@ void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, ch
|
||||
|
||||
err = php_stream_write(stream, cookie_str.c, cookie_str.len);
|
||||
|
||||
if(err != (int)cookie_str.len)
|
||||
php_error(E_ERROR,"Failed Sending HTTP Headers");
|
||||
if(err != (int)cookie_str.len) {
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "Failed Sending HTTP Headers", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
smart_str_free(&cookie_str);
|
||||
}
|
||||
|
||||
err = php_stream_write(stream, "\r\n", 2);
|
||||
|
||||
if(err != 2)
|
||||
php_error(E_ERROR,"Failed Sending HTTP Headers");
|
||||
if(err != 2) {
|
||||
php_stream_close(stream);
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "Failed Sending HTTP Headers", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
err = php_stream_write(stream, buf, buf_size);
|
||||
|
||||
if(err != (int)strlen(buf))
|
||||
php_error(E_ERROR,"Failed Sending HTTP Content");
|
||||
if(err != (int)strlen(buf)) {
|
||||
php_stream_close(stream);
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "Failed Sending HTTP Content", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
efree(soap_headers);
|
||||
}
|
||||
xmlFree(buf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS_DC)
|
||||
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;
|
||||
sdlPtr sdl;
|
||||
zval **socket_ref;
|
||||
php_stream *stream;
|
||||
zval **trace;
|
||||
|
||||
FETCH_THIS_SDL(sdl);
|
||||
|
||||
if(FIND_SOCKET_PROPERTY(this_ptr, socket_ref) != FAILURE)
|
||||
{
|
||||
FETCH_SOCKET_RES(stream, socket_ref);
|
||||
}
|
||||
|
||||
if(!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC))
|
||||
php_error(E_ERROR, "Error Fetching 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, "SOAP-ENV: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/");
|
||||
@ -210,15 +230,23 @@ void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRML
|
||||
/* Try and get headers again */
|
||||
if(!strcmp(http_status, "100"))
|
||||
{
|
||||
if(!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC))
|
||||
php_error(E_ERROR, "Error Fetching 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, "SOAP-ENV:Client", "Error Fetching http headers", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
efree(http_version);
|
||||
}
|
||||
|
||||
if(!get_http_body(stream, http_headers, &http_body, &http_body_size TSRMLS_CC))
|
||||
php_error(E_ERROR, "Error Fetching http body");
|
||||
|
||||
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, "SOAP-ENV: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)
|
||||
@ -270,14 +298,13 @@ void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRML
|
||||
ZVAL_STRINGL(err, http_body, http_body_size, 1);
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "Didn't recieve an xml document", NULL, err TSRMLS_CC);
|
||||
efree(content_type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
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
|
||||
@ -326,9 +353,10 @@ void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRML
|
||||
*buffer = http_body;
|
||||
*buffer_len = http_body_size;
|
||||
efree(http_headers);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char *get_http_header_value(char *headers, char *type)
|
||||
static char *get_http_header_value(char *headers, char *type)
|
||||
{
|
||||
char *pos, *tmp = NULL;
|
||||
int typelen, headerslen;
|
||||
@ -343,7 +371,7 @@ char *get_http_header_value(char *headers, char *type)
|
||||
/* start of buffer or start of line */
|
||||
if (strncasecmp(pos, type, typelen) == 0) {
|
||||
char *eol;
|
||||
|
||||
|
||||
/* match */
|
||||
tmp = pos + typelen;
|
||||
eol = strstr(tmp, "\r\n");
|
||||
@ -352,7 +380,7 @@ char *get_http_header_value(char *headers, char *type)
|
||||
}
|
||||
return estrndup(tmp, eol - tmp);
|
||||
}
|
||||
|
||||
|
||||
/* find next line */
|
||||
pos = strstr(pos, "\r\n");
|
||||
if (pos)
|
||||
@ -363,7 +391,7 @@ char *get_http_header_value(char *headers, char *type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int get_http_body(php_stream *stream, char *headers, char **response, int *out_size TSRMLS_DC)
|
||||
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;
|
||||
@ -372,7 +400,7 @@ int get_http_body(php_stream *stream, char *headers, char **response, int *out_
|
||||
content_length = get_http_header_value(headers, "Content-Length: ");
|
||||
|
||||
if (trans_enc && !strcmp(trans_enc, "chunked")) {
|
||||
int cur = 0, size = 0, buf_size = 0, len_size;
|
||||
int buf_size = 0, len_size;
|
||||
char done, chunk_size[10];
|
||||
|
||||
done = FALSE;
|
||||
@ -384,12 +412,12 @@ int get_http_body(php_stream *stream, char *headers, char **response, int *out_
|
||||
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);
|
||||
}
|
||||
@ -405,7 +433,7 @@ int get_http_body(php_stream *stream, char *headers, char **response, int *out_
|
||||
} else {
|
||||
http_buf[http_buf_size] = '\0';
|
||||
}
|
||||
|
||||
|
||||
} else if (content_length) {
|
||||
int size;
|
||||
size = atoi(content_length);
|
||||
@ -417,7 +445,8 @@ int get_http_body(php_stream *stream, char *headers, char **response, int *out_
|
||||
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");
|
||||
// php_error(E_ERROR, "Don't know how to read http body, No Content-Length or chunked data");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
(*response) = http_buf;
|
||||
@ -425,10 +454,9 @@ int get_http_body(php_stream *stream, char *headers, char **response, int *out_
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int get_http_headers(php_stream *stream, char **response, int *out_size TSRMLS_DC)
|
||||
static int get_http_headers(php_stream *stream, char **response, int *out_size TSRMLS_DC)
|
||||
{
|
||||
int done = FALSE;
|
||||
char chr;
|
||||
smart_str tmp_response = {0};
|
||||
char headerbuf[8192];
|
||||
|
||||
@ -452,5 +480,3 @@ int get_http_headers(php_stream *stream, char **response, int *out_size TSRMLS_D
|
||||
(*out_size) = tmp_response.len;
|
||||
return done;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,11 +1,7 @@
|
||||
#ifndef PHP_HTTP_H
|
||||
#define PHP_HTTP_H
|
||||
|
||||
void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, char *soapaction TSRMLS_DC);
|
||||
void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS_DC);
|
||||
|
||||
char *get_http_header_value(char *headers, char *type);
|
||||
int get_http_body(php_stream *socketd, char *headers, char **response, int *out_size TSRMLS_DC);
|
||||
int get_http_headers(php_stream *socketd,char **response, int *out_size TSRMLS_DC);
|
||||
int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *soapaction TSRMLS_DC);
|
||||
int get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS_DC);
|
||||
|
||||
#endif
|
||||
|
@ -1,141 +1,209 @@
|
||||
#include "php_soap.h"
|
||||
|
||||
int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval ***ret, int *num_params TSRMLS_DC)
|
||||
/* 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)
|
||||
{
|
||||
xmlDocPtr response;
|
||||
xmlNodePtr trav, trav2, env, body, resp, cur, fault;
|
||||
zval **tmp_ret;
|
||||
xmlNodePtr trav, /*trav2,*/ env, body, resp, cur, fault;
|
||||
int param_count = 0;
|
||||
|
||||
ZVAL_NULL(return_value);
|
||||
|
||||
/* Parse XML packet */
|
||||
response = xmlParseMemory(buffer, buffer_size);
|
||||
xmlCleanupParser();
|
||||
|
||||
if (!response) {
|
||||
php_error(E_ERROR, "looks like we got no XML document");
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "looks like we got no XML document", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
(*num_params) = 0;
|
||||
|
||||
/* Get <Envelope> element */
|
||||
env = NULL;
|
||||
trav = response->children;
|
||||
FOREACHNODE(trav,"Envelope",env)
|
||||
{
|
||||
trav2 = env->children;
|
||||
FOREACHNODE(trav2,"Body",body)
|
||||
{
|
||||
fault = get_node(body->children,"Fault");
|
||||
if(fault != NULL)
|
||||
{
|
||||
char *faultcode = NULL, *faultstring = NULL, *faultactor = NULL;
|
||||
zval *details = NULL;
|
||||
xmlNodePtr tmp;
|
||||
while (trav != NULL) {
|
||||
if (trav->type == XML_ELEMENT_NODE &&
|
||||
node_is_equal_ex(trav,"Envelope","http://schemas.xmlsoap.org/soap/envelope/")) {
|
||||
if (env != NULL) {
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "looks like we got XML with several \"Envelope\" elements\n", NULL, NULL TSRMLS_CC);
|
||||
xmlFreeDoc(response);
|
||||
return FALSE;
|
||||
}
|
||||
env = trav;
|
||||
}
|
||||
trav = trav->next;
|
||||
}
|
||||
if (env == NULL) {
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "looks like we got XML without \"Envelope\" element\n", NULL, NULL TSRMLS_CC);
|
||||
xmlFreeDoc(response);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
tmp = get_node(fault->children,"faultcode");
|
||||
if(tmp != NULL && tmp->children != NULL)
|
||||
faultcode = tmp->children->content;
|
||||
/* Get <Body> element */
|
||||
body = NULL;
|
||||
trav = env->children;
|
||||
while (trav != NULL) {
|
||||
if (trav->type == XML_ELEMENT_NODE &&
|
||||
node_is_equal_ex(trav,"Body","http://schemas.xmlsoap.org/soap/envelope/")) {
|
||||
if (body != NULL) {
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "looks like we got \"Envelope\" with several \"Body\" elements\n", NULL, NULL TSRMLS_CC);
|
||||
xmlFreeDoc(response);
|
||||
return FALSE;
|
||||
}
|
||||
body = trav;
|
||||
}
|
||||
trav = trav->next;
|
||||
}
|
||||
if (body == NULL) {
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "looks like we got \"Envelope\" without \"Body\" element\n", NULL, NULL TSRMLS_CC);
|
||||
xmlFreeDoc(response);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
tmp = get_node(fault->children,"faultstring");
|
||||
if(tmp != NULL && tmp->children != NULL)
|
||||
faultstring = tmp->children->content;
|
||||
/* Check if <Body> contains <Fault> element */
|
||||
fault = get_node_ex(body->children,"Fault","http://schemas.xmlsoap.org/soap/envelope/");
|
||||
if(fault != NULL) {
|
||||
char *faultcode = NULL, *faultstring = NULL, *faultactor = NULL;
|
||||
zval *details = NULL;
|
||||
xmlNodePtr tmp;
|
||||
|
||||
tmp = get_node(fault->children,"faultactor");
|
||||
if(tmp != NULL && tmp->children != NULL)
|
||||
faultactor = tmp->children->content;
|
||||
tmp = get_node(fault->children,"faultcode");
|
||||
if (tmp != NULL && tmp->children != NULL) {
|
||||
faultcode = tmp->children->content;
|
||||
}
|
||||
|
||||
tmp = get_node(fault->children,"detail");
|
||||
if(tmp != NULL)
|
||||
{
|
||||
encodePtr enc;
|
||||
enc = get_conversion(UNKNOWN_TYPE);
|
||||
details = enc->to_zval(enc->details, tmp);
|
||||
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 = enc->to_zval(enc->details, tmp);
|
||||
}
|
||||
|
||||
add_soap_fault(this_ptr, faultcode, faultstring, faultactor, details TSRMLS_CC);
|
||||
xmlFreeDoc(response);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Parse content of <Body> element */
|
||||
resp = body->children;
|
||||
if (fn != NULL) {
|
||||
/* Function has WSDL description */
|
||||
sdlParamPtr *h_param, param = NULL;
|
||||
xmlNodePtr val = NULL;
|
||||
char *name, *ns = NULL;
|
||||
zval* tmp;
|
||||
|
||||
if (fn->bindingType == BINDING_SOAP) {
|
||||
sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes;
|
||||
int res_count = zend_hash_num_elements(fn->responseParameters);
|
||||
|
||||
array_init(return_value);
|
||||
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 = ? */
|
||||
}
|
||||
|
||||
add_soap_fault(this_ptr, faultcode, faultstring, faultactor, details TSRMLS_CC);
|
||||
/* 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) {
|
||||
/* TODO: may be "nil" is not OK? */
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_NULL(tmp);
|
||||
/*
|
||||
add_soap_fault(this_ptr, "SOAP-ENV: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
|
||||
{
|
||||
resp = body->children;
|
||||
if(fn != NULL)
|
||||
{
|
||||
sdlParamPtr *h_param, param = NULL;
|
||||
xmlNodePtr val = NULL;
|
||||
encodePtr enc;
|
||||
char *name, *ns = NULL;
|
||||
|
||||
if(fn->bindingType == BINDING_SOAP)
|
||||
{
|
||||
sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes;
|
||||
|
||||
zend_hash_internal_pointer_reset(fn->responseParameters);
|
||||
if(zend_hash_get_current_data(fn->responseParameters, (void **)&h_param) != SUCCESS)
|
||||
php_error(E_ERROR, "Can't find response parameter \"%s\"", param->paramName);
|
||||
|
||||
param = (*h_param);
|
||||
if(fnb->style == SOAP_DOCUMENT)
|
||||
{
|
||||
name = (*h_param)->encode->details.type_str;
|
||||
ns = (*h_param)->encode->details.ns;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = fn->responseName;
|
||||
/* ns = ? */
|
||||
}
|
||||
|
||||
cur = get_node_ex(resp, name, ns);
|
||||
/* TODO: produce warning invalid ns */
|
||||
if(!cur)
|
||||
cur = get_node(resp, name);
|
||||
|
||||
if(!cur)
|
||||
php_error(E_ERROR, "Can't find response data");
|
||||
|
||||
|
||||
if(fnb->style == SOAP_DOCUMENT)
|
||||
val = cur;
|
||||
else
|
||||
val = get_node(cur->children, param->paramName);
|
||||
|
||||
if(!val)
|
||||
php_error(E_ERROR, "Can't find response data");
|
||||
|
||||
tmp_ret = emalloc(sizeof(zval **));
|
||||
if(param != NULL)
|
||||
enc = param->encode;
|
||||
else
|
||||
enc = get_conversion(UNKNOWN_TYPE);
|
||||
|
||||
tmp_ret[0] = master_to_zval(enc, val);
|
||||
(*ret) = tmp_ret;
|
||||
(*num_params) = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Function hasn't WSDL description */
|
||||
cur = resp;
|
||||
array_init(return_value);
|
||||
while(cur && cur->type != XML_ELEMENT_NODE) {
|
||||
cur = cur->next;
|
||||
}
|
||||
if (cur != NULL) {
|
||||
xmlNodePtr val;
|
||||
val = cur->children;
|
||||
while (val != NULL) {
|
||||
while(val && val->type != XML_ELEMENT_NODE) {
|
||||
val = val->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur = resp;
|
||||
while(cur && cur->type != XML_ELEMENT_NODE)
|
||||
cur = cur->next;
|
||||
if(cur != NULL)
|
||||
{
|
||||
xmlNodePtr val;
|
||||
val = cur->children;
|
||||
while(val && val->type != XML_ELEMENT_NODE)
|
||||
val = val->next;
|
||||
|
||||
if(val != NULL)
|
||||
{
|
||||
encodePtr enc;
|
||||
enc = get_conversion(UNKNOWN_TYPE);
|
||||
tmp_ret = emalloc(sizeof(zval **));
|
||||
tmp_ret[0] = master_to_zval(enc, val);
|
||||
(*ret) = tmp_ret;
|
||||
(*num_params) = 1;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
ENDFOREACH(trav2);
|
||||
}
|
||||
ENDFOREACH(trav);
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#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 ***ret, int *num_params TSRMLS_DC);
|
||||
int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value TSRMLS_DC);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1,4 +1,27 @@
|
||||
#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_sequence(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr seqType, 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_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
|
||||
static int schema_restriction_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
|
||||
static int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
|
||||
static int schema_extension(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
|
||||
static int schema_all(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
|
||||
static int schema_group(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr cur_type);
|
||||
static int schema_choice(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr cur_type);
|
||||
static int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr cur_type);
|
||||
static int schema_attribute(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type);
|
||||
static int schema_any(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
|
||||
|
||||
static int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr);
|
||||
static void delete_restriction_var_int(void *rvi);
|
||||
|
||||
static int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr);
|
||||
static void delete_schema_restriction_var_char(void *srvc);
|
||||
/*
|
||||
2.6.1 xsi:type
|
||||
2.6.2 xsi:nil
|
||||
@ -70,7 +93,7 @@ int load_schema(sdlPtr *sdl,xmlNodePtr schema)
|
||||
Content: (annotation?, (restriction | list | union))
|
||||
</simpleType>
|
||||
*/
|
||||
int schema_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpleType, sdlTypePtr cur_type)
|
||||
static int schema_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpleType, sdlTypePtr cur_type)
|
||||
{
|
||||
xmlNodePtr content;
|
||||
xmlAttrPtr name, ns;
|
||||
@ -147,7 +170,7 @@ int schema_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpleType, sdlTyp
|
||||
Content: (annotation?, (simpleType?))
|
||||
</list>
|
||||
*/
|
||||
int schema_list(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr listType, sdlTypePtr cur_type)
|
||||
static int schema_list(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr listType, sdlTypePtr cur_type)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -160,7 +183,7 @@ int schema_list(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr listType, sdlTypePtr cur
|
||||
Content: (annotation?, (simpleType*))
|
||||
</union>
|
||||
*/
|
||||
int schema_union(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr unionType, sdlTypePtr cur_type)
|
||||
static int schema_union(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr unionType, sdlTypePtr cur_type)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -172,7 +195,7 @@ int schema_union(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr unionType, sdlTypePtr c
|
||||
Content: (annotation?, (restriction | extension))
|
||||
</simpleContent>
|
||||
*/
|
||||
int schema_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpCompType, sdlTypePtr cur_type)
|
||||
static int schema_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpCompType, sdlTypePtr cur_type)
|
||||
{
|
||||
xmlNodePtr content;
|
||||
|
||||
@ -203,7 +226,7 @@ int schema_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpCompType, s
|
||||
Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*)?, ((attribute | attributeGroup)*, anyAttribute?))
|
||||
</restriction>
|
||||
*/
|
||||
int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type)
|
||||
static int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type)
|
||||
{
|
||||
xmlNodePtr content, trav;
|
||||
xmlAttrPtr base;
|
||||
@ -230,8 +253,7 @@ int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restTy
|
||||
}
|
||||
|
||||
trav = restType->children;
|
||||
do
|
||||
{
|
||||
while (trav != NULL) {
|
||||
if(trav->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
if(!strcmp(trav->name, "minExclusive"))
|
||||
@ -269,7 +291,8 @@ int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restTy
|
||||
zend_hash_next_index_insert(cur_type->restrictions->enumeration, &enumval, sizeof(sdlRestrictionCharPtr), NULL);
|
||||
}
|
||||
}
|
||||
}while(trav = trav->next);
|
||||
trav = trav->next;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -282,7 +305,7 @@ int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restTy
|
||||
Content: (annotation?, (group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))
|
||||
</restriction>
|
||||
*/
|
||||
int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type)
|
||||
static int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type)
|
||||
{
|
||||
xmlAttrPtr base;
|
||||
xmlNodePtr trav;
|
||||
@ -304,8 +327,7 @@ int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr re
|
||||
}
|
||||
|
||||
trav = restType->children;
|
||||
do
|
||||
{
|
||||
while (trav != NULL) {
|
||||
if(trav->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
if(!strcmp(trav->name, "group"))
|
||||
@ -333,7 +355,8 @@ int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr re
|
||||
schema_attribute(sdl, tsn, trav, cur_type);
|
||||
}
|
||||
}
|
||||
}while(trav = trav->next);
|
||||
trav = trav->next;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -346,7 +369,7 @@ int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr re
|
||||
Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*))
|
||||
</restriction>
|
||||
*/
|
||||
int schema_restriction_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type)
|
||||
static int schema_restriction_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type)
|
||||
{
|
||||
xmlNodePtr content, trav;
|
||||
xmlAttrPtr base;
|
||||
@ -366,8 +389,7 @@ int schema_restriction_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr res
|
||||
cur_type->restrictions = malloc(sizeof(sdlRestrictions));
|
||||
|
||||
trav = restType->children;
|
||||
do
|
||||
{
|
||||
while (trav != NULL) {
|
||||
if(trav->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
if(!strcmp(trav->name, "minExclusive"))
|
||||
@ -405,12 +427,13 @@ int schema_restriction_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr res
|
||||
zend_hash_next_index_insert(cur_type->restrictions->enumeration, &enumval, sizeof(sdlRestrictionCharPtr), NULL);
|
||||
}
|
||||
}
|
||||
}while(trav = trav->next);
|
||||
trav = trav->next;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr)
|
||||
static int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr)
|
||||
{
|
||||
xmlAttrPtr fixed, value, id;
|
||||
|
||||
@ -439,7 +462,7 @@ int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void delete_restriction_var_int(void *rvi)
|
||||
static void delete_restriction_var_int(void *rvi)
|
||||
{
|
||||
sdlRestrictionIntPtr ptr = *((sdlRestrictionIntPtr*)rvi);
|
||||
if(ptr->id);
|
||||
@ -447,7 +470,7 @@ void delete_restriction_var_int(void *rvi)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr)
|
||||
static int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr)
|
||||
{
|
||||
xmlAttrPtr fixed, value, id;
|
||||
|
||||
@ -475,7 +498,7 @@ int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void delete_schema_restriction_var_char(void *srvc)
|
||||
static void delete_schema_restriction_var_char(void *srvc)
|
||||
{
|
||||
sdlRestrictionCharPtr ptr = *((sdlRestrictionCharPtr*)srvc);
|
||||
if(ptr->id)
|
||||
@ -502,7 +525,7 @@ From complexContent:
|
||||
Content: (annotation?, ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))
|
||||
</extension>
|
||||
*/
|
||||
int schema_extension(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type)
|
||||
static int schema_extension(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type)
|
||||
{
|
||||
xmlNodePtr content;
|
||||
xmlAttrPtr base;
|
||||
@ -548,7 +571,7 @@ int schema_extension(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr
|
||||
Content: (annotation?, element*)
|
||||
</all>
|
||||
*/
|
||||
int schema_all(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr all, sdlTypePtr cur_type)
|
||||
static int schema_all(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr all, sdlTypePtr cur_type)
|
||||
{
|
||||
xmlNodePtr element, trav;
|
||||
|
||||
@ -567,7 +590,7 @@ int schema_all(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr all, sdlTypePtr cur_type)
|
||||
Content: (annotation?, (all | choice | sequence))
|
||||
</group>
|
||||
*/
|
||||
int schema_group(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr cur_type)
|
||||
static int schema_group(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr cur_type)
|
||||
{
|
||||
xmlNodePtr content;
|
||||
xmlAttrPtr name;
|
||||
@ -609,7 +632,7 @@ int schema_group(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr c
|
||||
Content: (annotation?, (element | group | choice | sequence | any)*)
|
||||
</choice>
|
||||
*/
|
||||
int schema_choice(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr cur_type)
|
||||
static int schema_choice(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr cur_type)
|
||||
{
|
||||
xmlNodePtr trav, data;
|
||||
|
||||
@ -664,13 +687,12 @@ int schema_choice(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr
|
||||
Content: (annotation?, (element | group | choice | sequence | any)*)
|
||||
</sequence>
|
||||
*/
|
||||
int schema_sequence(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr seqType, sdlTypePtr cur_type)
|
||||
static int schema_sequence(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr seqType, sdlTypePtr cur_type)
|
||||
{
|
||||
xmlNodePtr trav;
|
||||
|
||||
trav = seqType->children;
|
||||
do
|
||||
{
|
||||
while (trav != NULL) {
|
||||
if(trav->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
if(!strcmp(trav->name, "element"))
|
||||
@ -694,13 +716,13 @@ int schema_sequence(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr seqType, sdlTypePtr
|
||||
schema_any(sdl, tsn, trav, cur_type);
|
||||
}
|
||||
}
|
||||
trav = trav->next;
|
||||
}
|
||||
while(trav = trav->next);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int schema_any(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type)
|
||||
static int schema_any(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -713,7 +735,7 @@ int schema_any(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_t
|
||||
Content: (annotation?, (restriction | extension))
|
||||
</complexContent>
|
||||
*/
|
||||
int schema_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compCont, sdlTypePtr cur_type)
|
||||
static int schema_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compCont, sdlTypePtr cur_type)
|
||||
{
|
||||
xmlNodePtr content;
|
||||
|
||||
@ -739,7 +761,7 @@ int schema_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compCont, sdlT
|
||||
Content: (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))))
|
||||
</complexType>
|
||||
*/
|
||||
int schema_complexType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compType, sdlTypePtr cur_type)
|
||||
static int schema_complexType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compType, sdlTypePtr cur_type)
|
||||
{
|
||||
xmlNodePtr content;
|
||||
xmlAttrPtr attrs, name, ns;
|
||||
@ -848,7 +870,7 @@ int schema_complexType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compType, sdlType
|
||||
Content: (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*))
|
||||
</element>
|
||||
*/
|
||||
int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr cur_type)
|
||||
static int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr cur_type)
|
||||
{
|
||||
xmlNodePtr content;
|
||||
xmlAttrPtr attrs, curattr, name, ns;
|
||||
@ -873,7 +895,7 @@ int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr c
|
||||
memset(newType, 0, sizeof(sdlType));
|
||||
newType->name = strdup(name->children->content);
|
||||
newType->namens = strdup(tsn->children->content);
|
||||
newType->nullable = FALSE;
|
||||
newType->nillable = FALSE;
|
||||
newType->min_occurs = 1;
|
||||
newType->max_occurs = 1;
|
||||
|
||||
@ -898,7 +920,7 @@ int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr c
|
||||
smart_str_0(&key);
|
||||
zend_hash_add(addHash, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), (void **)&tmp);
|
||||
cur_type = (*tmp);
|
||||
create_encoder((*sdl), cur_type, ns->children->content, name->children->content);
|
||||
// create_encoder((*sdl), cur_type, ns->children->content, name->children->content);
|
||||
smart_str_free(&key);
|
||||
}
|
||||
|
||||
@ -922,12 +944,12 @@ int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr c
|
||||
{
|
||||
if(!stricmp(curattr->children->content, "true") ||
|
||||
!stricmp(curattr->children->content, "1"))
|
||||
cur_type->nullable = TRUE;
|
||||
cur_type->nillable = TRUE;
|
||||
else
|
||||
cur_type->nullable = FALSE;
|
||||
cur_type->nillable = FALSE;
|
||||
}
|
||||
else
|
||||
cur_type->nullable = FALSE;
|
||||
cur_type->nillable = FALSE;
|
||||
|
||||
/* type = QName */
|
||||
curattr = get_attribute(attrs, "type");
|
||||
@ -939,10 +961,10 @@ int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr c
|
||||
xmlNsPtr nsptr;
|
||||
|
||||
parse_namespace(curattr->children->content, &cptype, &str_ns);
|
||||
if(str_ns)
|
||||
// if(str_ns)
|
||||
nsptr = xmlSearchNs(element->doc, element, str_ns);
|
||||
else
|
||||
nsptr = xmlSearchNsByHref(element->doc, element, ns->children->content);
|
||||
// else
|
||||
// nsptr = xmlSearchNsByHref(element->doc, element, ns->children->content);
|
||||
|
||||
cur_type->encode = get_create_encoder((*sdl), cur_type, (char *)nsptr->href, (char *)cptype);
|
||||
if(str_ns) efree(str_ns);
|
||||
@ -977,7 +999,7 @@ int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr c
|
||||
Content: (annotation?, (simpleType?))
|
||||
</attribute>
|
||||
*/
|
||||
int schema_attribute(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type)
|
||||
static int schema_attribute(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type)
|
||||
{
|
||||
xmlAttrPtr attr;
|
||||
sdlAttributePtr newAttr;
|
||||
@ -1077,4 +1099,4 @@ int schema_attribute(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePt
|
||||
|
||||
zend_hash_next_index_insert(cur_type->attributes, &newAttr, sizeof(sdlAttributePtr), NULL);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -2,27 +2,5 @@
|
||||
#define PHP_SCHEMA_H
|
||||
|
||||
int load_schema(sdlPtr *sdl,xmlNodePtr schema);
|
||||
int schema_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpleType, sdlTypePtr cur_type);
|
||||
int schema_complexType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compType, sdlTypePtr cur_type);
|
||||
int schema_sequence(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr seqType, sdlTypePtr cur_type);
|
||||
int schema_list(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr listType, sdlTypePtr cur_type);
|
||||
int schema_union(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr unionType, sdlTypePtr cur_type);
|
||||
int schema_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpCompType, sdlTypePtr cur_type);
|
||||
int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
|
||||
int schema_restriction_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
|
||||
int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
|
||||
int schema_extension(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
|
||||
int schema_all(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
|
||||
int schema_group(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr cur_type);
|
||||
int schema_choice(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr cur_type);
|
||||
int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr cur_type);
|
||||
int schema_attribute(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type);
|
||||
int schema_any(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
|
||||
|
||||
int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr);
|
||||
void delete_restriction_var_int(void *rvi);
|
||||
|
||||
int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr);
|
||||
void delete_schema_restriction_var_char(void *srvc);
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "php_soap.h"
|
||||
|
||||
encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, char *type)
|
||||
encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, const char *type)
|
||||
{
|
||||
encodePtr enc = NULL;
|
||||
TSRMLS_FETCH();
|
||||
@ -14,7 +14,7 @@ encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, char *type)
|
||||
return enc;
|
||||
}
|
||||
|
||||
encodePtr get_encoder(sdlPtr sdl, char *ns, char *type)
|
||||
encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type)
|
||||
{
|
||||
encodePtr enc = NULL;
|
||||
char *nscat;
|
||||
@ -29,7 +29,7 @@ encodePtr get_encoder(sdlPtr sdl, char *ns, char *type)
|
||||
return enc;
|
||||
}
|
||||
|
||||
encodePtr get_encoder_ex(sdlPtr sdl, char *nscat)
|
||||
encodePtr get_encoder_ex(sdlPtr sdl, const char *nscat)
|
||||
{
|
||||
encodePtr enc = NULL;
|
||||
TSRMLS_FETCH();
|
||||
@ -42,7 +42,7 @@ encodePtr get_encoder_ex(sdlPtr sdl, char *nscat)
|
||||
return enc;
|
||||
}
|
||||
|
||||
encodePtr get_create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type)
|
||||
encodePtr get_create_encoder(sdlPtr sdl, sdlTypePtr cur_type, const char *ns, const char *type)
|
||||
{
|
||||
encodePtr enc = NULL;
|
||||
smart_str nscat = {0};
|
||||
@ -63,7 +63,7 @@ encodePtr get_create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *ty
|
||||
return enc;
|
||||
}
|
||||
|
||||
encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type)
|
||||
encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, const char *ns, const char *type)
|
||||
{
|
||||
smart_str nscat = {0};
|
||||
encodePtr enc;
|
||||
@ -95,32 +95,26 @@ encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type)
|
||||
zval *sdl_guess_convert_zval(encodeType enc, xmlNodePtr data)
|
||||
{
|
||||
sdlTypePtr type;
|
||||
zval *ret;
|
||||
|
||||
type = enc.sdl_type;
|
||||
|
||||
if(type->encode)
|
||||
{
|
||||
if(type->encode) {
|
||||
if(type->encode->details.type == IS_ARRAY ||
|
||||
type->encode->details.type == SOAP_ENC_ARRAY)
|
||||
ret = to_zval_array(enc, data);
|
||||
else
|
||||
ret = master_to_zval(type->encode, data);
|
||||
}
|
||||
else if(zend_hash_num_elements(type->elements) == 1)
|
||||
{
|
||||
sdlTypePtr *t;
|
||||
zend_hash_internal_pointer_reset(type->elements);
|
||||
if(zend_hash_get_current_data(type->elements, (void **)&t) != FAILURE &&
|
||||
(*t)->max_occurs != 1)
|
||||
ret = to_zval_array(enc, data);
|
||||
}
|
||||
if(ret)
|
||||
return ret;
|
||||
else
|
||||
type->encode->details.type == SOAP_ENC_ARRAY) {
|
||||
return to_zval_array(enc, data);
|
||||
} else {
|
||||
if (memcmp(&type->encode->details,&enc,sizeof(enc))!=0) {
|
||||
return master_to_zval(type->encode, data);
|
||||
} else {
|
||||
return master_to_zval(get_conversion(UNKNOWN_TYPE), data);
|
||||
}
|
||||
}
|
||||
} else if (type->elements) {
|
||||
return to_zval_object(enc, data);
|
||||
} else {
|
||||
return guess_zval_convert(enc, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xmlNodePtr sdl_guess_convert_xml(encodeType enc, zval *data, int style)
|
||||
{
|
||||
sdlTypePtr type;
|
||||
@ -128,33 +122,63 @@ xmlNodePtr sdl_guess_convert_xml(encodeType enc, zval *data, int style)
|
||||
|
||||
type = enc.sdl_type;
|
||||
|
||||
if(type->encode)
|
||||
{
|
||||
if(type->encode) {
|
||||
if(type->encode->details.type == IS_ARRAY ||
|
||||
type->encode->details.type == SOAP_ENC_ARRAY)
|
||||
type->encode->details.type == SOAP_ENC_ARRAY) {
|
||||
ret = sdl_to_xml_array(type, data, style);
|
||||
else
|
||||
ret = master_to_xml(type->encode, data, style);
|
||||
}
|
||||
else if(type->elements)
|
||||
{
|
||||
sdlTypePtr *t;
|
||||
if(zend_hash_num_elements(type->elements) == 1)
|
||||
{
|
||||
zend_hash_internal_pointer_reset(type->elements);
|
||||
if(zend_hash_get_current_data(type->elements, (void **)&t) != FAILURE &&
|
||||
(*t)->max_occurs != 1)
|
||||
ret = sdl_to_xml_array((*t), data, style);
|
||||
} else {
|
||||
if (memcmp(&type->encode->details,&enc,sizeof(enc))!=0) {
|
||||
ret = master_to_xml(type->encode, data, style);
|
||||
} else {
|
||||
ret = master_to_xml(get_conversion(UNKNOWN_TYPE), data, style);
|
||||
}
|
||||
}
|
||||
if(!ret)
|
||||
ret = sdl_to_xml_object(type, data, style);
|
||||
}
|
||||
else
|
||||
else if(type->elements) {
|
||||
ret = sdl_to_xml_object(type, data, style);
|
||||
} else {
|
||||
ret = guess_xml_convert(enc, data, style);
|
||||
|
||||
/*
|
||||
}
|
||||
set_ns_and_type(ret, enc);
|
||||
*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
zval* sdl_to_zval_object(sdlTypePtr type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
xmlNodePtr trav;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
|
||||
MAKE_STD_ZVAL(ret);
|
||||
FIND_XML_NULL(data, ret);
|
||||
|
||||
if (data) {
|
||||
object_init(ret);
|
||||
trav = data->children;
|
||||
|
||||
while (trav != NULL) {
|
||||
if(trav->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
sdlTypePtr *element;
|
||||
encodePtr enc = NULL;
|
||||
zval *tmpVal;
|
||||
if (trav->name != NULL &&
|
||||
zend_hash_find(type->elements, (char*)trav->name, strlen(trav->name)+1,(void **)&element) == SUCCESS) {
|
||||
enc = (*element)->encode;
|
||||
}
|
||||
if (enc == NULL) {
|
||||
enc = get_conversion(UNKNOWN_TYPE);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@ -164,6 +188,7 @@ xmlNodePtr sdl_to_xml_object(sdlTypePtr type, zval *data, int style)
|
||||
sdlTypePtr *t, tmp;
|
||||
|
||||
ret = xmlNewNode(NULL, "BOGUS");
|
||||
FIND_ZVAL_NULL(data, ret, style);
|
||||
|
||||
zend_hash_internal_pointer_reset(type->elements);
|
||||
while(zend_hash_get_current_data(type->elements, (void **)&t) != FAILURE)
|
||||
@ -172,14 +197,20 @@ xmlNodePtr sdl_to_xml_object(sdlTypePtr type, zval *data, int style)
|
||||
tmp = *t;
|
||||
if(zend_hash_find(Z_OBJPROP_P(data), tmp->name, strlen(tmp->name) + 1, (void **)&prop) == FAILURE)
|
||||
{
|
||||
if(tmp->nullable == FALSE)
|
||||
if(tmp->nillable == FALSE)
|
||||
php_error(E_ERROR, "Error encoding object to xml missing property \"%s\"", tmp->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlNodePtr newNode;
|
||||
|
||||
newNode = master_to_xml(tmp->encode, (*prop), style);
|
||||
encodePtr enc;
|
||||
|
||||
if (tmp->encode) {
|
||||
enc = tmp->encode;
|
||||
} else {
|
||||
enc = get_conversion((*prop)->type);
|
||||
}
|
||||
newNode = master_to_xml(enc, (*prop), style);
|
||||
xmlNodeSetName(newNode, tmp->name);
|
||||
xmlAddChild(ret, newNode);
|
||||
}
|
||||
@ -189,16 +220,52 @@ xmlNodePtr sdl_to_xml_object(sdlTypePtr type, zval *data, int style)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void add_xml_array_elements(xmlNodePtr xmlParam,
|
||||
sdlTypePtr type,
|
||||
encodePtr enc,
|
||||
int dimension ,
|
||||
int* dims,
|
||||
zval* data,
|
||||
int style)
|
||||
{
|
||||
int j;
|
||||
|
||||
if (Z_TYPE_P(data) == IS_ARRAY) {
|
||||
zend_hash_internal_pointer_reset(data->value.ht);
|
||||
for (j=0; j<dims[0]; j++) {
|
||||
zval **zdata;
|
||||
zend_hash_get_current_data(data->value.ht, (void **)&zdata);
|
||||
if (dimension == 1) {
|
||||
xmlNodePtr xparam;
|
||||
if (enc == NULL) {
|
||||
xparam = master_to_xml(get_conversion((*zdata)->type), (*zdata), style);
|
||||
} else {
|
||||
xparam = master_to_xml(enc, (*zdata), style);
|
||||
}
|
||||
|
||||
xmlNodeSetName(xparam, type->name);
|
||||
xmlAddChild(xmlParam, xparam);
|
||||
} else {
|
||||
add_xml_array_elements(xmlParam, type, enc, dimension-1, dims+1, *zdata, style);
|
||||
}
|
||||
zend_hash_move_forward(data->value.ht);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xmlNodePtr sdl_to_xml_array(sdlTypePtr type, zval *data, int style)
|
||||
{
|
||||
smart_str array_type_and_size = {0}, array_type = {0};
|
||||
int i;
|
||||
int dimension = 1;
|
||||
int* dims;
|
||||
xmlNodePtr xmlParam;
|
||||
encodePtr enc = NULL;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
xmlParam = xmlNewNode(NULL,"BOGUS");
|
||||
|
||||
FIND_ZVAL_NULL(data, xmlParam);
|
||||
FIND_ZVAL_NULL(data, xmlParam, style);
|
||||
|
||||
if(Z_TYPE_P(data) == IS_ARRAY)
|
||||
{
|
||||
@ -207,65 +274,93 @@ xmlNodePtr sdl_to_xml_array(sdlTypePtr type, zval *data, int style)
|
||||
|
||||
if(style == SOAP_ENCODED)
|
||||
{
|
||||
xmlAttrPtr *wsdl;
|
||||
if(type->attributes &&
|
||||
zend_hash_find(type->attributes, SOAP_ENC_NAMESPACE":arrayType",
|
||||
sizeof(SOAP_ENC_NAMESPACE":arrayType"),
|
||||
(void **)&arrayType) == SUCCESS)
|
||||
{
|
||||
xmlAttrPtr *wsdl;
|
||||
if(zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arrayType", sizeof(WSDL_NAMESPACE":arrayType"), (void **)&wsdl) == SUCCESS)
|
||||
{
|
||||
char *ns = NULL, *value;
|
||||
smart_str *prefix = encode_new_ns();
|
||||
smart_str smart_ns = {0};
|
||||
xmlNsPtr myNs;
|
||||
zend_hash_find(type->attributes, SOAP_ENC_NAMESPACE":arrayType",
|
||||
sizeof(SOAP_ENC_NAMESPACE":arrayType"),
|
||||
(void **)&arrayType) == SUCCESS &&
|
||||
zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arrayType", sizeof(WSDL_NAMESPACE":arrayType"), (void **)&wsdl) == SUCCESS) {
|
||||
|
||||
char *ns = NULL, *value, *end;
|
||||
smart_str *prefix = encode_new_ns();
|
||||
smart_str smart_ns = {0};
|
||||
xmlNsPtr myNs;
|
||||
zval** el;
|
||||
|
||||
parse_namespace((*wsdl)->children->content, &value, &ns);
|
||||
myNs = xmlSearchNs((*wsdl)->doc, (*wsdl)->parent, ns);
|
||||
parse_namespace((*wsdl)->children->content, &value, &ns);
|
||||
myNs = xmlSearchNs((*wsdl)->doc, (*wsdl)->parent, ns);
|
||||
|
||||
smart_str_appendl(&smart_ns, "xmlns:", sizeof("xmlns:") - 1);
|
||||
smart_str_appendl(&smart_ns, prefix->c, prefix->len);
|
||||
smart_str_0(&smart_ns);
|
||||
|
||||
xmlSetProp(xmlParam, smart_ns.c, myNs->href);
|
||||
smart_str_appends(&array_type_and_size, prefix->c);
|
||||
smart_str_appendc(&array_type_and_size, ':');
|
||||
smart_str_appends(&array_type_and_size, value);
|
||||
smart_str_0(&array_type_and_size);
|
||||
|
||||
smart_str_free(prefix);
|
||||
efree(prefix);
|
||||
end = strrchr(value,'[');
|
||||
if (end) {
|
||||
*end = '\0';
|
||||
end++;
|
||||
while (*end != ']' && *end != '\0') {
|
||||
if (*end == ',') {
|
||||
dimension++;
|
||||
}
|
||||
end++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(myNs != NULL) {
|
||||
enc = get_encoder(SOAP_GLOBAL(sdl), myNs->href, 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_appendl(&smart_ns, "xmlns:", sizeof("xmlns:") - 1);
|
||||
smart_str_appendl(&smart_ns, prefix->c, prefix->len);
|
||||
smart_str_0(&smart_ns);
|
||||
xmlSetProp(xmlParam, smart_ns.c, myNs->href);
|
||||
smart_str_free(&smart_ns);
|
||||
|
||||
smart_str_appends(&array_type_and_size, prefix->c);
|
||||
smart_str_appendc(&array_type_and_size, ':');
|
||||
smart_str_appends(&array_type_and_size, value);
|
||||
smart_str_appendc(&array_type_and_size, '[');
|
||||
smart_str_append_long(&array_type_and_size, dims[0]);
|
||||
for (i=1; i<dimension; i++) {
|
||||
smart_str_appendc(&array_type_and_size, ',');
|
||||
smart_str_append_long(&array_type_and_size, dims[i]);
|
||||
}
|
||||
smart_str_appendc(&array_type_and_size, ']');
|
||||
smart_str_0(&array_type_and_size);
|
||||
|
||||
smart_str_free(prefix);
|
||||
efree(prefix);
|
||||
efree(value);
|
||||
if (ns) efree(ns);
|
||||
} else {
|
||||
smart_str_appends(&array_type_and_size, type->name);
|
||||
smart_str_appendc(&array_type_and_size, '[');
|
||||
smart_str_append_long(&array_type_and_size, i);
|
||||
smart_str_appendc(&array_type_and_size, ']');
|
||||
smart_str_0(&array_type_and_size);
|
||||
dims = emalloc(sizeof(int)*dimension);
|
||||
dims[0] = i;
|
||||
}
|
||||
xmlSetProp(xmlParam, SOAP_ENC_NS_PREFIX":arrayType", array_type_and_size.c);
|
||||
|
||||
smart_str_free(&array_type_and_size);
|
||||
smart_str_free(&array_type);
|
||||
}
|
||||
} else {
|
||||
dims = emalloc(sizeof(int)*dimension);
|
||||
dims[0] = i;
|
||||
}
|
||||
|
||||
zend_hash_internal_pointer_reset(data->value.ht);
|
||||
for(;i > 0;i--)
|
||||
{
|
||||
xmlNodePtr xparam;
|
||||
zval **zdata;
|
||||
encodePtr enc;
|
||||
zend_hash_get_current_data(data->value.ht, (void **)&zdata);
|
||||
|
||||
enc = get_conversion((*zdata)->type);
|
||||
xparam = master_to_xml(enc, (*zdata), style);
|
||||
|
||||
xmlNodeSetName(xparam, type->name);
|
||||
xmlAddChild(xmlParam, xparam);
|
||||
zend_hash_move_forward(data->value.ht);
|
||||
}
|
||||
add_xml_array_elements(xmlParam, type, enc, dimension, dims, data, style);
|
||||
efree(dims);
|
||||
}
|
||||
|
||||
if(style == SOAP_ENCODED)
|
||||
@ -273,31 +368,6 @@ xmlNodePtr sdl_to_xml_array(sdlTypePtr type, zval *data, int style)
|
||||
return xmlParam;
|
||||
}
|
||||
|
||||
zval *sdl_convert_zval(encodeType enc, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
MAKE_STD_ZVAL(ret);
|
||||
ZVAL_STRING(ret, "blah", 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
zval *sdl_convert_zval(xmlNodePtr data, sdlTypePtr type)
|
||||
{
|
||||
found = zend_hash_find(EG(class_table), class_name, class_name_len + 1, (void **)&ce);
|
||||
if(found != FAILURE)
|
||||
{
|
||||
service->type = SOAP_CLASS;
|
||||
service->soap_class.ce = ce;
|
||||
}
|
||||
}
|
||||
// this function will take a zval and apply all attributes of sldTypePtr
|
||||
zval *sdl_convert_zval_to_zval(zval *data, sdlTypePtr type)
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
sdlPtr get_sdl(char *uri)
|
||||
{
|
||||
sdlPtr tmp, *hndl;
|
||||
@ -323,7 +393,7 @@ sdlBindingPtr get_binding_from_type(sdlPtr sdl, int type)
|
||||
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))
|
||||
@ -568,7 +638,7 @@ sdlPtr load_wsdl(char *struri, sdlPtr parent)
|
||||
}
|
||||
ENDFOREACH(trav);
|
||||
}
|
||||
|
||||
|
||||
trav = definitions->children;
|
||||
FOREACHNODE(trav, "import", import)
|
||||
{
|
||||
@ -629,7 +699,7 @@ sdlPtr load_wsdl(char *struri, sdlPtr parent)
|
||||
|
||||
if(!binding)
|
||||
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No binding element with name \"%s\"", ctype);
|
||||
|
||||
|
||||
if(ns) efree(ns); if(ctype) efree(ctype);
|
||||
|
||||
if(tmpbinding->bindingType == BINDING_SOAP)
|
||||
@ -637,7 +707,7 @@ sdlPtr load_wsdl(char *struri, sdlPtr parent)
|
||||
sdlSoapBindingPtr soapBinding;
|
||||
xmlNodePtr soapBindingNode;
|
||||
xmlAttrPtr tmp;
|
||||
|
||||
|
||||
soapBinding = malloc(sizeof(sdlSoapBinding));
|
||||
memset(soapBinding, 0, sizeof(sdlSoapBinding));
|
||||
|
||||
@ -655,7 +725,7 @@ sdlPtr load_wsdl(char *struri, sdlPtr parent)
|
||||
{
|
||||
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;
|
||||
@ -824,7 +894,7 @@ sdlPtr load_wsdl(char *struri, sdlPtr parent)
|
||||
|
||||
|
||||
function->responseName = malloc(strlen(function->functionName) + strlen("Response") + 1);
|
||||
sprintf(function->responseName, "%sResponse\0", function->functionName);
|
||||
sprintf(function->responseName, "%sResponse", function->functionName);
|
||||
function->responseParameters = malloc(sizeof(HashTable));
|
||||
zend_hash_init(function->responseParameters, 0, NULL, delete_paramater, 1);
|
||||
|
||||
|
@ -100,7 +100,7 @@ struct _sdlType
|
||||
{
|
||||
char *name;
|
||||
char *namens;
|
||||
int nullable;
|
||||
int nillable;
|
||||
int min_occurs;
|
||||
int max_occurs;
|
||||
HashTable *elements; /* array of sdlTypePtr */
|
||||
@ -145,11 +145,11 @@ sdlPtr load_wsdl(char *struri, sdlPtr parent);
|
||||
int load_sdl(char *struri, int force_load);
|
||||
int load_ms_sdl(char *struri, int force_load);
|
||||
|
||||
encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, char *type);
|
||||
encodePtr get_encoder(sdlPtr sdl, char *ns, char *type);
|
||||
encodePtr get_encoder_ex(sdlPtr sdl, char *nscat);
|
||||
encodePtr get_create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type);
|
||||
encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type);
|
||||
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);
|
||||
@ -163,5 +163,3 @@ xmlNodePtr sdl_to_xml_object(sdlTypePtr type, zval *data, int style);
|
||||
void delete_type(void *type);
|
||||
void delete_attribute(void *attribute);
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -141,6 +141,8 @@ ZEND_BEGIN_MODULE_GLOBALS(soap)
|
||||
HashTable *services;
|
||||
HashTable *overrides;
|
||||
int cur_uniq_ns;
|
||||
sdlPtr sdl;
|
||||
zend_bool use_soap_error_handler;
|
||||
ZEND_END_MODULE_GLOBALS(soap)
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_SOAP_API __declspec(dllexport)
|
||||
@ -159,73 +161,6 @@ ZEND_EXTERN_MODULE_GLOBALS(soap);
|
||||
# define SOAP_GLOBAL(v) (soap_globals.v)
|
||||
#endif
|
||||
|
||||
#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"
|
||||
|
||||
|
||||
extern zend_module_entry soap_module_entry;
|
||||
#define soap_module_ptr & soap_module_entry
|
||||
|
||||
PHP_MINIT_FUNCTION(soap);
|
||||
PHP_MSHUTDOWN_FUNCTION(soap);
|
||||
PHP_MINFO_FUNCTION(soap);
|
||||
|
||||
/*
|
||||
Registry Functions
|
||||
TODO: this!
|
||||
*/
|
||||
PHP_FUNCTION(load_sdl);
|
||||
PHP_FUNCTION(unload_sdl);
|
||||
PHP_FUNCTION(unload_all_sdls);
|
||||
PHP_FUNCTION(get_available_sdls);
|
||||
PHP_FUNCTION(get_available_functions);
|
||||
PHP_FUNCTION(get_function_parameters);
|
||||
PHP_FUNCTION(soap_encode_to_xml);
|
||||
PHP_FUNCTION(soap_encode_to_zval);
|
||||
|
||||
|
||||
/* Server Functions */
|
||||
PHP_FUNCTION(soapserver);
|
||||
PHP_FUNCTION(setclass);
|
||||
PHP_FUNCTION(addfunction);
|
||||
PHP_FUNCTION(getfunctions);
|
||||
PHP_FUNCTION(handle);
|
||||
PHP_FUNCTION(setpersistence);
|
||||
PHP_FUNCTION(bind);
|
||||
#ifdef HAVE_PHP_DOMXML
|
||||
PHP_FUNCTION(map);
|
||||
#endif
|
||||
|
||||
/* Client Functions */
|
||||
PHP_FUNCTION(soapobject);
|
||||
PHP_FUNCTION(__use);
|
||||
PHP_FUNCTION(__style);
|
||||
PHP_FUNCTION(__isfault);
|
||||
PHP_FUNCTION(__getfault);
|
||||
PHP_FUNCTION(__call);
|
||||
PHP_FUNCTION(__parse);
|
||||
PHP_FUNCTION(__generate);
|
||||
PHP_FUNCTION(__trace);
|
||||
PHP_FUNCTION(__getfunctions);
|
||||
PHP_FUNCTION(__gettypes);
|
||||
PHP_FUNCTION(__getlastresponse);
|
||||
PHP_FUNCTION(__getlastrequest);
|
||||
PHP_FUNCTION(__headerclass);
|
||||
PHP_FUNCTION(__headerfunction);
|
||||
|
||||
/* SoapVar Functions */
|
||||
PHP_FUNCTION(soapvar);
|
||||
|
||||
/* SoapFault Functions */
|
||||
PHP_FUNCTION(soapfault);
|
||||
|
||||
/* SoapParam Functions */
|
||||
PHP_FUNCTION(soapparam);
|
||||
|
||||
|
||||
#define DECLARE_TRACE(file) \
|
||||
FILE *trace_fp; \
|
||||
char *trace_file = file;
|
||||
@ -235,13 +170,13 @@ PHP_FUNCTION(soapparam);
|
||||
fwrite(place, strlen(place), 1, trace_fp); \
|
||||
fclose(trace_fp);
|
||||
|
||||
extern zend_class_entry soap_var_class_entry;
|
||||
extern zend_class_entry* soap_var_class_entry;
|
||||
|
||||
PS_SERIALIZER_FUNCS(soap);
|
||||
|
||||
void clear_soap_fault(zval *obj);
|
||||
void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC);
|
||||
void add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC);
|
||||
zval* add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC);
|
||||
|
||||
sdlParamPtr get_param(sdlFunctionPtr function, char *param_name, int index, int);
|
||||
sdlFunctionPtr get_function(sdlBindingPtr sdl, char *function_name);
|
||||
@ -256,17 +191,18 @@ void delete_http_socket(void *handle);
|
||||
void delete_url(void *handle);
|
||||
void delete_mapping(void *data);
|
||||
|
||||
#ifndef ZEND_ENGINE_2
|
||||
void soap_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
|
||||
zval soap_get_property_handler(zend_property_reference *property_reference);
|
||||
int soap_set_property_handler(zend_property_reference *property_reference, zval *value);
|
||||
void soap_destructor(void *jobject);
|
||||
#endif
|
||||
|
||||
void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *function_name, int *num_params, zval **parameters[] TSRMLS_DC);
|
||||
xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_name,char *uri,zval *ret TSRMLS_DC);
|
||||
xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function, char *function_name, char *uri, zval **arguments, int arg_count TSRMLS_DC);
|
||||
xmlNodePtr seralize_parameter(sdlParamPtr param,zval *param_val,int index,char *name, int style TSRMLS_DC);
|
||||
xmlNodePtr seralize_zval(zval *val, sdlParamPtr param, char *paramName, int style TSRMLS_DC);
|
||||
zval *desearlize_zval(sdlPtr sdl, xmlNodePtr data, sdlParamPtr param TSRMLS_DC);
|
||||
|
||||
void soap_error_handler(int error_num, const char *error_filename, const uint error_lineno, const char *format, va_list args);
|
||||
#ifndef ZEND_ENGINE_2
|
||||
@ -278,10 +214,11 @@ int my_call_user_function(HashTable *function_table, zval **object_pp, zval *fun
|
||||
#define HTTP_RAW_POST_DATA "HTTP_RAW_POST_DATA"
|
||||
|
||||
#define SOAP_SERVER_BEGIN_CODE() \
|
||||
zend_error_cb = soap_error_handler
|
||||
zend_bool old_handler = SOAP_GLOBAL(use_soap_error_handler);\
|
||||
SOAP_GLOBAL(use_soap_error_handler) = 1;
|
||||
|
||||
#define SOAP_SERVER_END_CODE() \
|
||||
zend_error_cb = old_handler
|
||||
SOAP_GLOBAL(use_soap_error_handler) = old_handler
|
||||
|
||||
|
||||
#define FOREACHATTRNODE(n,c,i) \
|
||||
|
@ -7,13 +7,12 @@ 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(filename, "rb", ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
|
||||
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)
|
||||
@ -91,31 +90,29 @@ int node_is_equal_ex(xmlNodePtr node, char *name, char *ns)
|
||||
xmlAttrPtr get_attribute_ex(xmlAttrPtr node, char *name, char *ns)
|
||||
{
|
||||
xmlAttrPtr trav = node;
|
||||
if(node == NULL) return NULL;
|
||||
do {
|
||||
while (trav!=NULL) {
|
||||
if(attr_is_equal_ex(trav, name, ns))
|
||||
return trav;
|
||||
} while(trav = trav->next);
|
||||
trav = trav->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xmlNodePtr get_node_ex(xmlNodePtr node, char *name, char *ns)
|
||||
{
|
||||
xmlNodePtr trav = node;
|
||||
if(node == NULL) return NULL;
|
||||
do {
|
||||
while (trav!=NULL) {
|
||||
if(node_is_equal_ex(trav, name, ns))
|
||||
return trav;
|
||||
} while(trav = trav->next);
|
||||
trav = trav->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xmlNodePtr get_node_recurisve_ex(xmlNodePtr node, char *name, char *ns)
|
||||
{
|
||||
xmlNodePtr trav = node;
|
||||
if(node == NULL) return NULL;
|
||||
do
|
||||
{
|
||||
while (trav != NULL) {
|
||||
if(node_is_equal_ex(trav, name, ns))
|
||||
return trav;
|
||||
else
|
||||
@ -128,7 +125,8 @@ xmlNodePtr get_node_recurisve_ex(xmlNodePtr node, char *name, char *ns)
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
} while(trav = trav->next);
|
||||
trav = trav->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -137,9 +135,7 @@ xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, char *name_ns
|
||||
xmlNodePtr trav = node, cur = NULL;
|
||||
xmlAttrPtr attr;
|
||||
|
||||
if(node == NULL) return NULL;
|
||||
do
|
||||
{
|
||||
while (trav != NULL) {
|
||||
if(name != NULL)
|
||||
{
|
||||
cur = get_node_ex(trav, name, name_ns);
|
||||
@ -162,7 +158,8 @@ xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, char *name_ns
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
}while(trav = trav->next);
|
||||
trav = trav->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -171,9 +168,7 @@ xmlNodePtr get_node_with_attribute_recursive_ex(xmlNodePtr node, char *name, cha
|
||||
xmlNodePtr trav = node, cur;
|
||||
xmlAttrPtr attr;
|
||||
|
||||
if(node == NULL) return NULL;
|
||||
do
|
||||
{
|
||||
while (trav != NULL) {
|
||||
if(name != NULL)
|
||||
{
|
||||
cur = get_node_recurisve_ex(trav, name, name_ns);
|
||||
@ -196,7 +191,8 @@ xmlNodePtr get_node_with_attribute_recursive_ex(xmlNodePtr node, char *name, cha
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
}while(trav = trav->next);
|
||||
trav = trav->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -222,11 +218,11 @@ xmlNodePtr check_and_resolve_href(xmlNodePtr data)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int parse_namespace(char *inval, char **value, char **namespace)
|
||||
int parse_namespace(const char *inval, char **value, char **namespace)
|
||||
{
|
||||
char *found = strchr(inval, ':');
|
||||
|
||||
if(found != NULL)
|
||||
if(found != NULL && found != inval)
|
||||
{
|
||||
(*namespace) = estrndup(inval, found - inval);
|
||||
(*value) = estrdup(++found);
|
||||
@ -239,4 +235,3 @@ int parse_namespace(char *inval, char **value, char **namespace)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ xmlNodePtr get_node_ex(xmlNodePtr node,char *name, char *ns);
|
||||
xmlNodePtr get_node_recurisve_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(char *inval,char **value,char **namespace);
|
||||
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);
|
||||
|
1001
ext/soap/soap.c
1001
ext/soap/soap.c
File diff suppressed because it is too large
Load Diff
33
ext/soap/tests/server001.phpt
Normal file
33
ext/soap/tests/server001.phpt
Normal file
@ -0,0 +1,33 @@
|
||||
--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:ns1="http://testuri.org" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 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"><SOAP-ENV:Body><ns1:testResponse xmlns="http://testuri.org"><return xsi:type="xsd:string">Hello World</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
ok
|
37
ext/soap/tests/server002.phpt
Normal file
37
ext/soap/tests/server002.phpt
Normal file
@ -0,0 +1,37 @@
|
||||
--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:ns1="http://testuri.org" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 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"><SOAP-ENV:Body><ns1:AddResponse xmlns="http://testuri.org"><return xsi:type="xsd:int">55</return></ns1:AddResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
ok
|
32
ext/soap/tests/server003.phpt
Normal file
32
ext/soap/tests/server003.phpt
Normal file
@ -0,0 +1,32 @@
|
||||
--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:ns1="http://testuri.org" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 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"><SOAP-ENV:Body><ns1:strlenResponse xmlns="http://testuri.org"><return xsi:type="xsd:int">11</return></ns1:strlenResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
ok
|
40
ext/soap/tests/server004.phpt
Normal file
40
ext/soap/tests/server004.phpt
Normal file
@ -0,0 +1,40 @@
|
||||
--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:ns1="http://testuri.org" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 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"><SOAP-ENV:Body><ns1:AddResponse xmlns="http://testuri.org"><return xsi:type="xsd:int">55</return></ns1:AddResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
ok
|
36
ext/soap/tests/server005.phpt
Normal file
36
ext/soap/tests/server005.phpt
Normal file
@ -0,0 +1,36 @@
|
||||
--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:ns1="http://testuri.org" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 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"><SOAP-ENV:Body><ns1:testResponse xmlns="http://testuri.org"><return xsi:type="xsd:string">Hello World</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
ok
|
42
ext/soap/tests/server006.phpt
Normal file
42
ext/soap/tests/server006.phpt
Normal file
@ -0,0 +1,42 @@
|
||||
--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:ns1="http://testuri.org" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 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"><SOAP-ENV:Body><ns1:testResponse xmlns="http://testuri.org"><return xsi:type="xsd:string">Hello World</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
ok
|
26
ext/soap/tests/server007.phpt
Normal file
26
ext/soap/tests/server007.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--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
|
29
ext/soap/tests/server008.phpt
Normal file
29
ext/soap/tests/server008.phpt
Normal file
@ -0,0 +1,29 @@
|
||||
--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
|
61
ext/soap/tests/server009.phpt
Normal file
61
ext/soap/tests/server009.phpt
Normal file
@ -0,0 +1,61 @@
|
||||
--TEST--
|
||||
SOAP Server 9: setclass and setpersistence(SOAP_PERSISTENCE_SESSION)
|
||||
--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_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:ns1="http://testuri.org" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 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"><SOAP-ENV:Body><ns1:SumResponse xmlns="http://testuri.org"><return xsi:type="xsd:int">8</return></ns1:SumResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
ok
|
61
ext/soap/tests/server010.phpt
Normal file
61
ext/soap/tests/server010.phpt
Normal file
@ -0,0 +1,61 @@
|
||||
--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:ns1="http://testuri.org" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 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"><SOAP-ENV:Body><ns1:SumResponse xmlns="http://testuri.org"><return xsi:type="xsd:int">3</return></ns1:SumResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
ok
|
26
ext/soap/tests/server011.phpt
Normal file
26
ext/soap/tests/server011.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--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("test.wsdl");
|
||||
ob_start();
|
||||
$server->handle();
|
||||
$wsdl = ob_get_contents();
|
||||
ob_end_clean();
|
||||
if ($wsdl == file_get_contents("test.wsdl")) {
|
||||
echo "ok\n";
|
||||
} else {
|
||||
echo "fail\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
18
ext/soap/tests/server012.phpt
Normal file
18
ext/soap/tests/server012.phpt
Normal file
@ -0,0 +1,18 @@
|
||||
--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--
|
44
ext/soap/tests/server013.phpt
Normal file
44
ext/soap/tests/server013.phpt
Normal file
@ -0,0 +1,44 @@
|
||||
--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:ns1="http://testuri.org" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 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"><SOAP-ENV:Body><ns1:sumResponse xmlns="http://testuri.org"><return xsi:type="xsd:int">8</return></ns1:sumResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
ok
|
37
ext/soap/tests/server014.phpt
Normal file
37
ext/soap/tests/server014.phpt
Normal file
@ -0,0 +1,37 @@
|
||||
--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/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 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"><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>
|
3
ext/soap/tests/skipif.inc
Normal file
3
ext/soap/tests/skipif.inc
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
if (!extension_loaded('soap')) die('skip soap extension not available');
|
||||
?>
|
55
ext/soap/tests/test.wsdl
Normal file
55
ext/soap/tests/test.wsdl
Normal file
@ -0,0 +1,55 @@
|
||||
<?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>
|
Loading…
Reference in New Issue
Block a user