diff options
author | Shane Caraveo <shane@php.net> | 2002-07-14 22:14:38 +0000 |
---|---|---|
committer | Shane Caraveo <shane@php.net> | 2002-07-14 22:14:38 +0000 |
commit | eaf442b97fd6fa399920c6b94f6e92992c00043c (patch) | |
tree | 4c2d6d567f228bdf33cf99697a1e85ce88cdc1b8 /ext/soap | |
parent | 7b68f5108acb970609842318edc68b10573867c6 (diff) | |
download | php-git-eaf442b97fd6fa399920c6b94f6e92992c00043c.tar.gz |
A start towards porting interop tests to php-soap
Diffstat (limited to 'ext/soap')
21 files changed, 2647 insertions, 0 deletions
diff --git a/ext/soap/interop/base.php b/ext/soap/interop/base.php new file mode 100644 index 0000000000..435d9aa6f0 --- /dev/null +++ b/ext/soap/interop/base.php @@ -0,0 +1,25 @@ +<?php +// +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 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 +{ +} + +?>
\ No newline at end of file diff --git a/ext/soap/interop/client_round2.php b/ext/soap/interop/client_round2.php new file mode 100644 index 0000000000..5583bb6c17 --- /dev/null +++ b/ext/soap/interop/client_round2.php @@ -0,0 +1,102 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> + +<html> +<head> + <title>Round 2 Interop Client Tests</title> +</head> + +<body> +<a href="index.php">Back to Interop Index</a><br> +<p> </p> +<?php +require_once 'SOAP/interop/client_round2_interop.php'; + +$iop = new Interop_Client(); + +function endpointList($test,$sel_endpoint) +{ + global $iop; + $iop->getEndpoints($test); + echo "<select name='endpoint'>\n"; + foreach ($iop->endpoints as $epname => $epinfo) { + $selected = ''; + if ($sel_endpoint == $epname) $selected = ' SELECTED'; + echo "<option value='$epname'$selected>$epname</option>\n"; + } + echo "</select>\n"; +} +function methodList($test,$sel_method) +{ + global $iop; + + $ml = $iop->getMethodList($test); + 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"; + echo "</select>\n"; +} + +function endpointTestForm($test, $endpoint, $method, $paramType, $useWSDL) +{ + global $PHP_SELF; + if (!$test) $test = 'base'; + echo "Round 2 '$test' Selected<br>\n"; + echo "Select endpoint and method to run:<br>\n"; + echo "<form action='$PHP_SELF' method='post'>\n"; + echo "<input type='hidden' name='test' value='$test'>\n"; + endpointList($test, $endpoint); + methodList($test, $method); + echo "<select name='paramType'><option value='soapval'>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 "<input type='submit' value='Go'>\n"; + echo "</form><br>\n"; +} + +function testSelectForm($selected_test = NULL) +{ + global $iop, $PHP_SELF; + echo "Select a Round 2 test case to run:<br>\n"; + echo "<form action='$PHP_SELF' method='post'>\n"; + echo "<select name='test'>\n"; + foreach ($iop->tests as $test) { + $selected = ''; + if ($selected_test == $test) $selected = ' SELECTED'; + echo "<option value='$test'$selected>$test</option>\n"; + } + echo "</select>\n"; + echo "<input type='submit' value='Go'>\n"; + echo "</form><br>\n"; +} + +testSelectForm($_POST['test']); +endpointTestForm($_POST['test'],$_POST['endpoint'],$_POST['method'],$_POST['paramType'],$_POST['useWSDL']); + +if ($_POST['test'] && array_key_exists('endpoint', $_POST) && array_key_exists('method', $_POST)) { + // here we execute the orders + echo "<h2>Calling {$_POST['method']} at {$_POST['endpoint']}</h2>\n"; + echo "NOTE: wire's are slightly modified to display better in web browsers.<br>\n"; + + $iop->currentTest = $_POST['test']; // see $tests above + $iop->paramType = $_POST['paramType']; // 'php' or 'soapval' + $iop->useWSDL = $_POST['useWSDL']; // 1= do wsdl tests + $iop->numServers = 0; // 0 = all + $iop->specificEndpoint = $_POST['endpoint']; // test only this endpoint + $iop->testMethod = $_POST['method']=='ALL'?'':$_POST['method']; // test only this method + $iop->skipEndpointList = array(); // endpoints to skip + $this->nosave = 0; // 1= disable saving results to database + // debug output + $iop->show = 1; + $iop->debug = 1; + $iop->showFaults = 0; // used in result table output + echo '<pre>'; + $iop->doTest(); // run a single set of tests using above options + echo '</pre>'; +} +?> +</body> +</html> diff --git a/ext/soap/interop/client_round2_interop.php b/ext/soap/interop/client_round2_interop.php new file mode 100644 index 0000000000..bc06434742 --- /dev/null +++ b/ext/soap/interop/client_round2_interop.php @@ -0,0 +1,787 @@ +<?php +// +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 The PHP Group | +// +----------------------------------------------------------------------+ +// | This source file is subject to version 2.02 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | license@php.net so we can mail you a copy immediately. | +// +----------------------------------------------------------------------+ +// | Authors: Shane Caraveo <Shane@Caraveo.com> | +// +----------------------------------------------------------------------+ +// +// $Id$ +// +require_once 'DB.php'; // PEAR/DB +require_once 'base.php'; +require_once 'client_round2_params.php'; +require_once 'test.utility.php'; + +error_reporting(E_ALL ^ E_NOTICE); + +class Interop_Client extends Interop_Base +{ + // database DNS + var $DSN = 'mysql://user@localhost/interop2'; + + // our central interop server, where we can get the list of endpoints + var $interopServer = "http://www.whitemesa.net/interopInfo"; + + // our local endpoint, will always get added to the database for all tests + var $localEndpoint; + + // specify testing + var $currentTest = 'base'; // see $tests above + var $paramType = 'php'; // 'php' or 'soapval' + var $useWSDL = 0; // 1= do wsdl tests + var $numServers = 0; // 0 = all + var $specificEndpoint = ''; // test only this endpoint + var $testMethod = ''; // test only this method + var $skipEndpointList = array(); // endpoints to skip + var $nosave = 0; + var $startAt = ''; // start in list at this endpoint + // debug output + var $show = 1; + var $debug = 0; + var $showFaults = 0; // used in result table output + + // PRIVATE VARIABLES + var $dbc = NULL; + var $totals = array(); + var $tests = array('base','GroupB', 'GroupC'); + var $paramTypes = array('php', 'soapval'); + var $endpoints = array(); + + function Interop_Client() { + // set up the database connection + $this->dbc = DB::connect($this->DSN, true); + // if it errors out, just ignore it and rely on regular methods + if (DB::isError($this->dbc)) { + echo $this->dbc->getMessage(); + $this->dbc = NULL; + } + // set up local endpoint + $this->localEndpoint['base'] = array( + 'endpointName'=>'PEAR SOAP', + 'endpointURL'=>'http://localhost/soap_interop/server_round2.php', + 'wsdlURL'=>'http://localhost/soap_interop/interop.wsdl' + ); + $this->localEndpoint['GroupB'] = array( + 'endpointName'=>'PEAR SOAP', + 'endpointURL'=>'http://localhost/soap_interop/server_round2.php', + 'wsdlURL'=>'http://localhost/soap_interop/interopB.wsdl' + ); + $this->localEndpoint['GroupC'] = array( + 'endpointName'=>'PEAR SOAP', + 'endpointURL'=>'http://localhost/soap_interop/server_round2.php', + 'wsdlURL'=>'http://localhost/soap_interop/echoheadersvc.wsdl' + ); + } + + function _fetchEndpoints(&$soapclient, $test) { + $this->_getEndpoints($test, 1); + + // retreive endpoints from the endpoint server + $endpointArray = $soapclient->call("GetEndpointInfo",array("groupName"=>$test),"http://soapinterop.org/info/","http://soapinterop.org/info/"); + if (PEAR::isError($endpointArray)) { + print $soapclient->wire; + print_r($endpointArray); + return; + } + + // add our local endpoint + if ($this->localEndpoint[$test]) { + array_push($endpointArray, $this->localEndpoint[$test]); + } + + if (!$endpointArray) return; + + // reset the status to zero + $res = $this->dbc->query("update endpoints set status = 0 where class='$test'"); + if (DB::isError($res)) { + die ($res->getMessage()); + } + if (is_object($res)) $res->free(); + // save new endpoints into database + foreach($endpointArray as $k => $v){ + if (array_key_exists($v['endpointName'],$this->endpoints)) { + $res = $this->dbc->query("update endpoints set endpointURL='{$v['endpointURL']}', wsdlURL='{$v['wsdlURL']}', status=1 where id={$this->endpoints[$v['endpointName']]['id']}"); + } else { + $res = $this->dbc->query("insert into endpoints (endpointName,endpointURL,wsdlURL,class) values('{$v['endpointName']}','{$v['endpointURL']}','{$v['wsdlURL']}','$test')"); + } + if (DB::isError($res)) { + die ($res->getMessage()); + } + if (is_object($res)) $res->free(); + } + } + + /** + * fetchEndpoints + * retreive endpoints interop server + * + * @return boolean result + * @access private + */ + function fetchEndpoints($test = NULL) { + // fetch from the interop server + $soapclient = new SoapObject($this->interopServer); + + if ($test) { + $this->_fetchEndpoints($soapclient, $test); + } else { + foreach ($this->tests as $test) { + $this->_fetchEndpoints($soapclient, $test); + } + $test = 'base'; + } + + // retreive all endpoints now + $this->currentTest = $test; + return $this->_getEndpoints($test); + } + + /** + * getEndpoints + * retreive endpoints from either database or interop server + * + * @param string base (see local var $tests) + * @param boolean all (if false, only get valid endpoints, status=1) + * @return boolean result + * @access private + */ + function getEndpoints($base = 'base', $all = 0) { + if (!$this->_getEndpoints($base, $all)) { + return $this->fetchEndpoints($base); + } + return TRUE; + } + + /** + * _getEndpoints + * retreive endpoints from database + * + * @param string base (see local var $tests) + * @param boolean all (if false, only get valid endpoints, status=1) + * @return boolean result + * @access private + */ + function _getEndpoints($base = "", $all = 0) { + $this->endpoints = array(); + + // build sql + $sql = "select * from endpoints "; + if ($base) { + $sql .= "where class='$base' "; + if (!$all) $sql .= "and status=1"; + } else + if (!$all) $sql .= "where status=1"; + + $db_ep = $this->dbc->getAll($sql,NULL, DB_FETCHMODE_ASSOC ); + if (DB::isError($db_ep)) { + echo $sql."\n"; + echo $db_ep->getMessage(); + return FALSE; + } + // rearange the array + foreach ($db_ep as $entry) { + $this->endpoints[$entry['endpointName']] = $entry; + } + if (count($this->endpoints) > 0) { + $this->currentTest = $base; + return TRUE; + } + return FALSE; + } + + /** + * getResults + * retreive results from the database, stuff them into the endpoint array + * + * @access private + */ + function getResults($test = 'base', $type = 'php', $wsdl = 0) { + // be sure we have the right endpoints for this test result + $this->getEndpoints($test); + + // retreive the results and put them into the endpoint info + $sql = "select * from results where class='$test' and type='$type' and wsdl=$wsdl"; + $results = $this->dbc->getAll($sql,NULL, DB_FETCHMODE_ASSOC ); + foreach ($results as $result) { + // find the endpoint + foreach ($this->endpoints as $epn => $epi) { + if ($epi['id'] == $result['endpoint']) { + // store the info + $this->endpoints[$epn]['methods'][$result['function']] = $result; + break; + } + } + } + } + + /** + * saveResults + * save the results of a method test into the database + * + * @access private + */ + function _saveResults($endpoint_id, &$soap_test) { + if ($this->nosave) return; + + $result = $soap_test->result; + $wire = $result['wire']; + if ($result['success']) { + $success = 'OK'; + $error = ''; + } else { + $success = $result['fault']->faultcode; + $error = $result['fault']->faultstring; + if (!$wire) $wire= $result['fault']->detail; + } + + $test_name = $soap_test->test_name; + // add header info to the test name + if ($soap_test->headers) { + foreach ($soap_test->headers as $h) { + $destination = 0; + if (get_class($h) == 'soap_header') { + if ($h->attributes['SOAP-ENV:actor'] == 'http://schemas.xmlsoap.org/soap/actor/next') $destination = 1; + $test_name .= ":{$h->name},$destination,{$h->attributes['SOAP-ENV:mustUnderstand']}"; + } else { + if (!$h[3] || $h[3] == 'http://schemas.xmlsoap.org/soap/actor/next') $destination = 1; + if (!$h[2]) $h[2] = 0; + $qn = new QName($h[0]); + $test_name .= ":{$qn->name},$destination,".(int)$h[2]; + } + } + } + + $sql = "delete from results where endpoint=$endpoint_id ". + "and class='$this->currentTest' and type='$this->paramType' ". + "and wsdl=$this->useWSDL and function=". + $this->dbc->quote($test_name); + #echo "\n".$sql; + $res = $this->dbc->query($sql); + if (DB::isError($res)) { + die ($res->getMessage()); + } + if (is_object($res)) $res->free(); + + $sql = "insert into results (endpoint,stamp,class,type,wsdl,function,result,error,wire) ". + "values($endpoint_id,".time().",'$this->currentTest',". + "'$this->paramType',$this->useWSDL,". + $this->dbc->quote($test_name).",". + $this->dbc->quote($success).",". + $this->dbc->quote($error).",". + ($wire?$this->dbc->quote($wire):"''").")"; + #echo "\n".$sql; + $res = $this->dbc->query($sql); + + if (DB::isError($res)) { + die ($res->getMessage()); + } + if (is_object($res)) $res->free(); + } + + /** + * decodeSoapval + * decodes a soap value to php type, used for test result comparisions + * + * @param SOAP_Value soapval + * @return mixed result + * @access public + */ + function decodeSoapval($soapval) + { + if (gettype($soapval) == "object" && + (strcasecmp(get_class($soapval),"soapparam") == 0 || + strcasecmp(get_class($soapval),"soapvar") == 0)) { + if (strcasecmp(get_class($soapval),"soapparam") == 0) + $val = $soapval->param_data->enc_value; + else + $val = $soapval->enc_value; + } else { + $val = $soapval; + } + if (is_array($val)) { + foreach($val as $k => $v) { + if (gettype($v) == "object" && + (strcasecmp(get_class($soapval),"soapparam") == 0 || + strcasecmp(get_class($soapval),"soapvar") == 0)) { + $val[$k] = $this->decodeSoapval($v); + } + } + } + return $val; + } + + /** + * compareResult + * compare two php types for a match + * + * @param string expect + * @param string test_result + * @return boolean result + * @access public + */ + function compareResult($expect, $result, $type = NULL) + { + $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; + } + + + /** + * doEndpointMethod + * run a method on an endpoint and store it's results to the database + * + * @param array endpoint_info + * @param SOAP_Test test + * @return boolean result + * @access public + */ + function doEndpointMethod(&$endpoint_info, &$soap_test) { + $ok = FALSE; + + // prepare a holder for the test results + $soap_test->result['class'] = $this->currentTest; + $soap_test->result['type'] = $this->paramType; + $soap_test->result['wsdl'] = $this->useWSDL; + + if ($this->useWSDL) { + if (array_key_exists('wsdlURL',$endpoint_info)) { + if (!array_key_exists('client',$endpoint_info)) { + $endpoint_info['client'] = new SoapObject($endpoint_info['wsdlURL']); + } + $soap = $endpoint_info['client']; + + # XXX how do we determine a failure on retreiving/parsing wsdl? + if ($soap->wsdl->fault) { + $fault = $soap->wsdl->fault->getFault(); + $soap_test->setResult(0,'WSDL', + $fault->faultstring."\n\n".$fault->detail, + $fault->faultstring, + $fault + ); + return FALSE; + } + } else { + $fault = new SoapFault('WSDL',"no WSDL defined for $endpoint"); + $soap_test->setResult(0,'WSDL', + $fault->faultstring, + $fault->faultstring, + $fault + ); + return FALSE; + } + $namespace = false; + $soapaction = false; + } else { + $namespace = $soapaction = 'http://soapinterop.org/'; + // hack to make tests work with MS SoapToolkit + // it's the only one that uses this soapaction, and breaks if + // it isn't right. Can't wait for soapaction to be fully depricated + if ($this->currentTest == 'base' && + strstr($endpoint_info['endpointName'],'MS SOAP ToolKit 2.0')) { + $soapaction = 'urn:soapinterop'; + } + if (!array_key_exists('client',$endpoint_info)) { + $endpoint_info['client'] = new SoapObject($endpoint_info['endpointURL'],$soapaction); + } + $soap = $endpoint_info['client']; + } + // add headers to the test + if ($soap_test->headers) { + // $header is already a SOAP_Header class + foreach ($soap_test->headers as $header) { + $soap->addHeader($header); + } + } + // XXX no way to set encoding + // this lets us set UTF-8, US-ASCII or other + //$soap->setEncoding($soap_test->encoding); + + $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); + } else { + $sent = $soap_test->method_params; + } + + // compare header results + $header_result = array(); + $headers_ok = TRUE; + + # XXX need to implement header support! + # + #if ($soap_test->headers) { + # // $header is already a SOAP_Header class + # foreach ($soap_test->headers as $header) { + # if (get_class($header) != 'soap_header') { + # // assume it's an array + # $header = new SOAP_Header($header[0], NULL, $header[1], $header[2], $header[3], $header[4]); + # } + # $expect = $soap_test->headers_expect[$header->name]; + # $header_result[$header->name] = array(); + # // XXX need to fix need_result to identify the actor correctly + # $need_result = $hresult || + # ($header->attributes['SOAP-ENV:actor'] == 'http://schemas.xmlsoap.org/soap/actor/next' + # && $header->attributes['SOAP-ENV:mustUnderstand']); + # if ($expect) { + # $hresult = $soap->headers[key($expect)]; + # $ok = !$need_result || $this->compareResult($hresult ,$expect[key($expect)]); + # } else { + # $hresult = $soap->headers[$header->name]; + # $expect = $this->decodeSoapval($header); + # $ok = !$need_result || $this->compareResult($hresult ,$expect); + # } + # $header_result[$header->name]['ok'] = $ok; + # if (!$ok) $headers_ok = FALSE; + # } + #} + + # we need to decode what we sent so we can compare! + $sent_d = $this->decodeSoapval($sent); + + $soap_test->result['sent'] = $sent; + $soap_test->result['return'] = $return; + // compare the results with what we sent + $ok = $this->compareResult($sent_d,$return, $sent->type); + if (!$ok && $soap_test->expect) { + $ok = $this->compareResult($soap_test->expect,$return); + } + + if($ok){ + if (!$headers_ok) { + $fault = new SoapFault('HEADER','The returned result did not match what we expected to receive'); + $soap_test->setResult(0,$fault->faultcode, + $wire, + $fault->faultstring, + $fault + ); + } else { + $soap_test->setResult(1,'OK',$wire); + $success = TRUE; + } + } else { + $fault = new SoapFault('RESULT','The returned result did not match what we expected to receive'); + $soap_test->setResult(0,$fault->faultcode, + $wire, + $fault->faultstring, + $fault + ); + } + } else { + $fault = $soap->__getfault(); + if ($soap_test->expect_fault) { + $ok = 1; + $res = 'OK'; + } else { + $ok = 0; + $res =$fault->faultcode; + } + $soap_test->setResult($ok,$res, $wire,$fault->faultstring, $fault); + } + return $ok; + } + + + /** + * doTest + * run a single round of tests + * + * @access public + */ + function doTest() { + global $soap_tests; + // get endpoints for this test + $this->getEndpoints($this->currentTest); + #clear totals + $this->totals = array(); + + $i = 0; + foreach($this->endpoints as $endpoint => $endpoint_info){ + + // if we specify an endpoint, skip until we find it + if ($this->specificEndpoint && $endpoint != $this->specificEndpoint) continue; + if ($this->useWSDL && !$endpoint_info['endpointURL']) continue; + + $skipendpoint = FALSE; + $this->totals['servers']++; + #$endpoint_info['tests'] = array(); + + if ($this->show) print "Processing $endpoint at {$endpoint_info['endpointURL']}<br>\n"; + + foreach($soap_tests[$this->currentTest] as $soap_test) { + //foreach(array_keys($method_params[$this->currentTest][$this->paramType]) as $method) + + // only run the type of test we're looking for (php or soapval) + if ($soap_test->type != $this->paramType) continue; + + // if we haven't reached our startpoint, skip + if ($this->startAt && $this->startAt != $endpoint_info['endpointName']) continue; + $this->startAt = ''; + + // if this is in our skip list, skip it + if (in_array($endpoint, $this->skipEndpointList)) { + $skipendpoint = TRUE; + $skipfault = new SoapFault('SKIP','endpoint skipped'); + $soap_test->setResult(0,$fault->faultcode, '', + $skipfault->faultstring, + $skipfault + ); + #$endpoint_info['tests'][] = &$soap_test; + #$soap_test->showTestResult($this->debug); + #$this->_saveResults($endpoint_info['id'], $soap_test->method_name); + $soap_test->result = NULL; + continue; + } + + // if we're looking for a specific method, skip unless we have it + if ($this->testMethod && !strstr($this->testMethod,$soap_test->test_name)) continue; + if ($this->testMethod && $this->currentTest == 'GroupC') { + // we have to figure things out now + if (!preg_match('/(.*):(.*),(\d),(\d)/',$this->testMethod, $m)) continue; + + // is the header in the headers list? + $gotit = FALSE; + foreach ($soap_test->headers as $header) { + if (get_class($header) == 'soap_header') { + if ($header->name == $m[2]) { + $gotit = $header->attributes['SOAP-ENV:actor'] == ($m[3]?SOAP_TEST_ACTOR_NEXT:SOAP_TEST_ACTOR_OTHER); + $gotit = $gotit && $header->attributes['SOAP-ENV:mustUnderstand'] == $m[4]; + } + } else { + if ($header[0] == $m[2]) { + $gotit = $gotit && $header[3] == ($m[3]?SOAP_TEST_ACTOR_NEXT:SOAP_TEST_ACTOR_OTHER); + $gotit = $gotit && $header[4] == $m[4]; + } + } + } + if (!$gotit) continue; + } + + // if we are skipping the rest of the tests (due to error) note a fault + if ($skipendpoint) { + $soap_test->setResult(0,$fault->faultcode, '', + $skipfault->faultstring, + $skipfault + ); + #$endpoint_info['tests'][] = &$soap_test; + $this->totals['fail']++; + } else { + // run the endpoint test + if ($this->doEndpointMethod($endpoint_info, $soap_test)) { + $this->totals['success']++; + } else { + $skipendpoint = $soap_test->result['fault']->faultcode=='HTTP' + && strstr($soap_test->result['fault']->faultstring,'Connect Error'); + $skipfault = $soap_test->result['fault']; + $this->totals['fail']++; + } + #$endpoint_info['tests'][] = &$soap_test; + } + $soap_test->showTestResult($this->debug); + $this->_saveResults($endpoint_info['id'], $soap_test); + $soap_test->result = NULL; + $this->totals['calls']++; + } + if ($this->numservers && ++$i >= $this->numservers) break; + } + } + + function doGroupTests() { + $dowsdl = array(0,1); + foreach($dowsdl as $usewsdl) { + $this->useWSDL = $usewsdl; + foreach($this->paramTypes as $ptype) { + // skip a pointless test + if ($usewsdl && $ptype == 'soapval') break; + $this->paramType = $ptype; + $this->doTest(); + } + } + } + + /** + * doTests + * go all out. This takes time. + * + * @access public + */ + function doTests() { + // the mother of all interop tests + $dowsdl = array(0,1); + foreach($this->tests as $test) { + $this->currentTest = $test; + foreach($dowsdl as $usewsdl) { + $this->useWSDL = $usewsdl; + foreach($this->paramTypes as $ptype) { + // skip a pointless test + if ($usewsdl && $ptype == 'soapval') break; + $this->paramType = $ptype; + $this->doTest(); + } + } + } + } + + // *********************************************************** + // output functions + + /** + * getResults + * retreive results from the database, stuff them into the endpoint array + * + * @access private + */ + function getMethodList($test = 'base') { + // retreive the results and put them into the endpoint info + $sql = "select distinct(function) from results where class='$test' order by function"; + $results = $this->dbc->getAll($sql); + $ar = array(); + foreach($results as $result) { + $ar[] = $result[0]; + } + return $ar; + } + + function outputTable() + { + $methods = $this->getMethodList($this->currentTest); + if (!$methods) return; + $this->getResults($this->currentTest,$this->paramType,$this->useWSDL); + + echo "<b>Testing $this->currentTest "; + if ($this->useWSDL) echo "using WSDL "; + else echo "using Direct calls "; + echo "with $this->paramType values</b><br>\n"; + + // calculate totals for this table + $this->totals['success'] = 0; + $this->totals['fail'] = 0; + $this->totals['servers'] = 0; #count($this->endpoints); + foreach ($this->endpoints as $endpoint => $endpoint_info) { + if (count($endpoint_info['methods']) > 0) { + $this->totals['servers']++; + foreach ($methods as $method) { + $r = $endpoint_info['methods'][$method]['result']; + if ($r == 'OK') $this->totals['success']++; + else $this->totals['fail']++; + } + } else { + unset($this->endpoints[$endpoint]); + } + } + $this->totals['calls'] = count($methods) * $this->totals['servers']; + + if ($this->totals['fail'] == $this->totals['calls']) { + // assume tests have not run, skip outputing table + print "No Data Available<br>\n"; + return; + } + + echo "\n\n<b>Servers: {$this->totals['servers']} Calls: {$this->totals['calls']} Success: {$this->totals['success']} Fail: {$this->totals['fail']}</b><br>\n"; + + echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\">\n"; + echo "<tr><td class=\"BLANK\">Endpoint</td>\n"; + foreach ($methods as $method) { + $info = split(':', $method); + echo "<td class='BLANK' valign='top'>"; + foreach ($info as $m) { + $hi = split(',',$m); + echo '<b>'.$hi[0]."</b><br>\n"; + if (count($hi) > 1) { + echo " Actor=".($hi[1]?'Target':'Not Target')."<br>\n"; + echo " MustUnderstand=$hi[2]<br>\n"; + } + } + echo "</td>\n"; + } + echo "</tr>\n"; + $faults = array(); + $fi = 0; + foreach ($this->endpoints as $endpoint => $endpoint_info) { + if (array_key_exists('wsdlURL',$endpoint_info)) { + echo "<tr><td class=\"BLANK\"><a href=\"{$endpoint_info['wsdlURL']}\">$endpoint</a></td>\n"; + } else { + echo "<tr><td class=\"BLANK\">$endpoint</td>\n"; + } + foreach ($methods as $method) { + $id = $endpoint_info['methods'][$method]['id']; + $r = $endpoint_info['methods'][$method]['result']; + $e = $endpoint_info['methods'][$method]['error']; + if ($e) { + $faults[$fi++] = $e; + } + if ($r) { + echo "<td class='$r'><a href='$PHP_SELF?wire=$id'>$r</a></td>\n"; + } else { + echo "<td class='untested'>untested</td>\n"; + } + } + echo "</tr>\n"; + } + echo "</table><br>\n"; + if ($this->showFaults && count($faults) > 0) { + echo "<b>ERROR Details:</b><br>\n<ul>\n"; + # output more error detail + foreach ($faults as $fault) { + echo '<li>'.HTMLSpecialChars($fault)."</li>\n"; + } + } + echo "</ul><br><br>\n"; + } + + function outputTables() { + // the mother of all interop tests + $dowsdl = array(0,1); + foreach($this->tests as $test) { + $this->currentTest = $test; + foreach($dowsdl as $usewsdl) { + $this->useWSDL = $usewsdl; + foreach($this->paramTypes as $ptype) { + // skip a pointless test + if ($usewsdl && $ptype == 'soapval') break; + $this->paramType = $ptype; + $this->outputTable(); + } + } + } + } + + function showWire($id) { + $results = $this->dbc->getAll("select * from results where id=$id",NULL, DB_FETCHMODE_ASSOC ); + #$wire = preg_replace("/>/",">\n",$results[0]['wire']); + $wire = $results[0]['wire']; + echo "<pre>\n".HTMLSpecialChars($wire)."</pre>\n"; + } + +} + +?>
\ No newline at end of file diff --git a/ext/soap/interop/client_round2_params.php b/ext/soap/interop/client_round2_params.php new file mode 100644 index 0000000000..aa50edb763 --- /dev/null +++ b/ext/soap/interop/client_round2_params.php @@ -0,0 +1,636 @@ +<?php +// +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 The PHP Group | +// +----------------------------------------------------------------------+ +// | This source file is subject to version 2.02 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | license@php.net so we can mail you a copy immediately. | +// +----------------------------------------------------------------------+ +// | Authors: Shane Caraveo <Shane@Caraveo.com> | +// +----------------------------------------------------------------------+ +// +// $Id$ +// + +define('SOAP_TEST_ACTOR_NEXT','http://schemas.xmlsoap.org/soap/actor/next'); +define('SOAP_TEST_ACTOR_OTHER','http://some/other/actor'); + +class SOAP_Test { + var $type = 'php'; + var $test_name = NULL; + var $method_name = NULL; + var $method_params = NULL; + var $expect = NULL; + var $expect_fault = FALSE; + var $headers = NULL; + var $headers_expect = NULL; + var $result = array(); + var $show = 1; + var $debug = 0; + var $encoding = 'UTF-8'; + + function SOAP_Test($methodname, $params, $expect = NULL) { + # XXX we have to do this to make php-soap happy with NULL params + if (!$params) $params = array(); + + if (strchr($methodname,'(')) { + preg_match('/(.*)\((.*)\)/',$methodname,$matches); + $this->test_name = $methodname; + $this->method_name = $matches[1]; + } else { + $this->test_name = $this->method_name = $methodname; + } + $this->method_params = $params; + $this->expect = $expect; + + // determine test type + if ($params) { + $v = array_values($params); + if (gettype($v[0]) == 'object' && + (get_class($v[0]) == 'soapvar' || get_class($v[0]) == 'soapparam')) + $this->type = 'soapval'; + } + } + + function setResult($ok, $result, $wire, $error = '', $fault = NULL) + { + $this->result['success'] = $ok; + $this->result['result'] = $result; + $this->result['error'] = $error; + $this->result['wire'] = $wire; + $this->result['fault'] = $fault; + } + + /** + * showMethodResult + * print simple output about a methods result + * + * @param array endpoint_info + * @param string method + * @access public + */ + function showTestResult($debug = 0) { + // debug output + if ($debug) $this->show = 1; + if ($debug) { + echo str_repeat("-",50)."<br>\n"; + } + + echo "testing $this->test_name : "; + if ($this->headers) { + foreach ($this->headers as $h) { + if (get_class($h) == 'soap_header') { + + echo "\n {$h->name},{$h->attributes['SOAP-ENV:actor']},{$h->attributes['SOAP-ENV:mustUnderstand']} : "; + } else { + if (!$h[4]) $h[4] = SOAP_TEST_ACTOR_NEXT; + if (!$h[3]) $h[3] = 0; + echo "\n $h[0],$h[4],$h[3] : "; + } + } + } + + if ($debug) { + print "method params: "; + print_r($this->params); + print "\n"; + } + + $ok = $this->result['success']; + if ($ok) { + print "SUCCESS\n"; + } else { + $fault = $this->result['fault']; + if ($fault) { + print "FAILED: {$fault->faultcode} {$fault->faultstring}\n"; + } else { + print "FAILED: ".$this->result['result']."\n"; + } + } + if ($debug) { + echo "<pre>\n".htmlentities($this->result['wire'])."</pre>\n"; + } + } +} + +# XXX I know this isn't quite right, need to deal with this better +function make_2d($x, $y) +{ + for ($_x = 0; $_x < $x; $_x++) { + for ($_y = 0; $_y < $y; $_y++) { + $a[$_x][$_y] = "x{$_x}y{$_y}"; + } + } + return $a; +} + +function soap_value($name, $value, $type) { + return new soapparam(new soapvar($value,$type),$name); +} + +class SOAPStruct { + var $varString; + var $varInt; + var $varFloat; + function SOAPStruct($s, $i, $f) { + $this->varString = $s; + $this->varInt = $i; + $this->varFloat = $f; + } +} + +//*********************************************************** +// Base echoString + +$soap_tests['base'][] = new SOAP_Test('echoString', array('inputString' => 'hello world!')); +$soap_tests['base'][] = new SOAP_Test('echoString', array('inputString' => soap_value('inputString','hello world',XSD_STRING))); +$soap_tests['base'][] = new SOAP_Test('echoString(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))); +$test = new SOAP_Test('echoString(utf-8)', array('inputString' => utf8_encode('ỗÈéóÒ₧⅜ỗỸ'))); +$test->encoding = 'UTF-8'; +$soap_tests['base'][] = $test; +$test = new SOAP_Test('echoString(utf-8)', array('inputString' => soap_value('inputString',utf8_encode('ỗÈéóÒ₧⅜ỗỸ'),XSD_STRING))); +$test->encoding = 'UTF-8'; +$soap_tests['base'][] = $test; + +//*********************************************************** +// Base echoStringArray + +$soap_tests['base'][] = new SOAP_Test('echoStringArray', + array('inputStringArray' => array('good','bad'))); +$soap_tests['base'][] = new SOAP_Test('echoStringArray', + array('inputStringArray' => + soap_value('inputStringArray',array('good','bad'),SOAP_ENC_ARRAY))); + +// null array test +# 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))); + +//*********************************************************** +// Base echoInteger + +$soap_tests['base'][] = new SOAP_Test('echoInteger', array('inputInteger' => 34345)); +$soap_tests['base'][] = new SOAP_Test('echoInteger', array('inputInteger' => soap_value('inputInteger',12345,XSD_INT))); + +//*********************************************************** +// Base echoIntegerArray + +$soap_tests['base'][] = new SOAP_Test('echoIntegerArray', array('inputIntegerArray' => array(1,234324324,2))); +$soap_tests['base'][] = new SOAP_Test('echoIntegerArray', + array('inputIntegerArray' => + soap_value('inputIntegerArray', + array(new soapvar(12345,XSD_INT),new soapvar(654321,XSD_INT)), + SOAP_ENC_ARRAY))); +# +#// 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 + +$soap_tests['base'][] = new SOAP_Test('echoFloat', array('inputFloat' => 342.23)); +$soap_tests['base'][] = new SOAP_Test('echoFloat', array('inputFloat' => soap_value('inputFloat',123.45,XSD_FLOAT))); + +//*********************************************************** +// Base echoFloatArray + +$soap_tests['base'][] = new SOAP_Test('echoFloatArray', array('inputFloatArray' => array(1.3223,34.2,325.325))); +$soap_tests['base'][] = new SOAP_Test('echoFloatArray', + array('inputFloatArray' => + soap_value('inputFloatArray', + array(new soapvar(123.45,XSD_FLOAT),new soapvar(654.321,XSD_FLOAT)), + SOAP_ENC_ARRAY))); +//*********************************************************** +// Base echoStruct + +$soapstruct = new SOAPStruct('arg',34,325.325); +# XXX no way to set a namespace!!! +$soapsoapstruct = soap_value('inputStruct',$soapstruct,SOAP_ENC_OBJECT); +$soap_tests['base'][] = new SOAP_Test('echoStruct', array('inputStruct' =>$soapstruct)); +$soap_tests['base'][] = new SOAP_Test('echoStruct', array('inputStruct' =>$soapsoapstruct)); + +//*********************************************************** +// Base echoStructArray + +$soap_tests['base'][] = new SOAP_Test('echoStructArray', array('inputStructArray' => array( + $soapstruct,$soapstruct,$soapstruct))); +$soap_tests['base'][] = new SOAP_Test('echoStructArray', array('inputStructArray' => + soap_value('inputStructArray',array($soapstruct,$soapstruct,$soapstruct),SOAP_ENC_ARRAY))); + + +//*********************************************************** +// Base echoVoid + +$soap_tests['base'][] = new SOAP_Test('echoVoid', NULL); +$test = new SOAP_Test('echoVoid', NULL); +$test->type = 'soapval'; +$soap_tests['base'][] = $test; + +//*********************************************************** +// Base echoBase64 + +$soap_tests['base'][] = new SOAP_Test('echoBase64', array('inputBase64' => 'TmVicmFza2E=')); +$soap_tests['base'][] = new SOAP_Test('echoBase64', array('inputBase64' => + soap_value('inputBase64','TmVicmFza2E=',XSD_BASE64BINARY))); + +//*********************************************************** +// Base echoHexBinary + +$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' => '736F61707834')); +$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))); + +//*********************************************************** +// 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_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_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_value('inputBoolean',FALSE,XSD_BOOLEAN))); + +# +# +#//*********************************************************** +#// 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 +# +#//*********************************************************** +#// echoMeStringRequest php val tests +# +#// echoMeStringRequest with endpoint as header destination, doesn't have to understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 0,SOAP_TEST_ACTOR_NEXT); +#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world'); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeStringRequest with endpoint as header destination, must understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 1,SOAP_TEST_ACTOR_NEXT); +#$this->type = 'soapval'; // force a soapval version of this test +#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world'); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeStringRequest with endpoint NOT header destination, doesn't have to understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 0, SOAP_TEST_ACTOR_OTHER); +#$test->headers_expect['echoMeStringRequest'] = array(); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeStringRequest with endpoint NOT header destination, must understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 1, SOAP_TEST_ACTOR_OTHER); +#$test->headers_expect['echoMeStringRequest'] = array(); +#$soap_tests['GroupC'][] = $test; +# +#//*********************************************************** +#// echoMeStringRequest soapval tests +# +#// echoMeStringRequest with endpoint as header destination, doesn't have to understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->type = 'soapval'; +#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world'); +#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world'); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeStringRequest with endpoint as header destination, must understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->type = 'soapval'; +#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1); +#$this->type = 'soapval'; // force a soapval version of this test +#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world'); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeStringRequest with endpoint NOT header destination, doesn't have to understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->type = 'soapval'; +#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 0, SOAP_TEST_ACTOR_OTHER); +#$test->headers_expect['echoMeStringRequest'] = array(); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeStringRequest with endpoint NOT header destination, must understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->type = 'soapval'; +#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1, SOAP_TEST_ACTOR_OTHER); +#$test->headers_expect['echoMeStringRequest'] = array(); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeStringRequest with endpoint header destination, must understand, +#// invalid namespace, should recieve a fault +##$test = new SOAP_Test('echoVoid', NULL); +##$test->type = 'soapval'; +##$test->headers[] = new SOAP_Header('{http://unknown.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1); +##$test->headers_expect['echoMeStringRequest'] = array(); +##$test->expect_fault = TRUE; +##$soap_tests['GroupC'][] = $test; +# +#//*********************************************************** +#// php val tests +#// echoMeStructRequest with endpoint as header destination, doesn't have to understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest', +# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325), +# 0,SOAP_TEST_ACTOR_NEXT); +#$test->headers_expect['echoMeStructRequest'] = +# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325)); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeStructRequest with endpoint as header destination, must understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest', +# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325), +# 1,SOAP_TEST_ACTOR_NEXT); +#$test->headers_expect['echoMeStructRequest'] = +# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325)); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeStructRequest with endpoint NOT header destination, doesn't have to understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest', +# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325), +# 0, SOAP_TEST_ACTOR_OTHER); +#$test->headers_expect['echoMeStructRequest'] = array(); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeStructRequest with endpoint NOT header destination, must understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest', +# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325), +# 1, SOAP_TEST_ACTOR_OTHER); +#$test->headers_expect['echoMeStructRequest'] = array(); +#$soap_tests['GroupC'][] = $test; +# +#//*********************************************************** +#// soapval tests +#// echoMeStructRequest with endpoint as header destination, doesn't have to understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->type = 'soapval'; +#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL, +# array( #push struct elements into one soap value +# new SOAP_Value('varString','string','arg'), +# new SOAP_Value('varInt','int',34), +# new SOAP_Value('varFloat','float',325.325) +# )); +#$test->headers_expect['echoMeStructRequest'] = +# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325)); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeStructRequest with endpoint as header destination, must understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->type = 'soapval'; +#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL, +# array( #push struct elements into one soap value +# new SOAP_Value('varString','string','arg'), +# new SOAP_Value('varInt','int',34), +# new SOAP_Value('varFloat','float',325.325) +# ), 1); +#$test->headers_expect['echoMeStructRequest'] = +# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325)); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeStructRequest with endpoint NOT header destination, doesn't have to understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->type = 'soapval'; +#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL, +# array( #push struct elements into one soap value +# new SOAP_Value('varString','string','arg'), +# new SOAP_Value('varInt','int',34), +# new SOAP_Value('varFloat','float',325.325) +# ), 0, SOAP_TEST_ACTOR_OTHER); +#$test->headers_expect['echoMeStructRequest'] = array(); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeStructRequest with endpoint NOT header destination, must understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->type = 'soapval'; +#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL, +# array( #push struct elements into one soap value +# new SOAP_Value('varString','string','arg'), +# new SOAP_Value('varInt','int',34), +# new SOAP_Value('varFloat','float',325.325) +# ), 1, SOAP_TEST_ACTOR_OTHER); +#$test->headers_expect['echoMeStructRequest'] = array(); +#$soap_tests['GroupC'][] = $test; +# +#//*********************************************************** +#// echoMeUnknown php val tests +#// echoMeUnknown with endpoint as header destination, doesn't have to understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',0,SOAP_TEST_ACTOR_NEXT); +#$test->headers_expect['echoMeUnknown'] = array(); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeUnknown with endpoint as header destination, must understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',1,SOAP_TEST_ACTOR_NEXT); +#$test->headers_expect['echoMeUnknown'] = array(); +#$test->expect_fault = TRUE; +#$soap_tests['GroupC'][] = $test; +# +#// echoMeUnknown with endpoint NOT header destination, doesn't have to understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',0, SOAP_TEST_ACTOR_OTHER); +#$test->headers_expect['echoMeUnknown'] = array(); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeUnknown with endpoint NOT header destination, must understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!', 1, SOAP_TEST_ACTOR_OTHER); +#$test->headers_expect['echoMeUnknown'] = array(); +#$soap_tests['GroupC'][] = $test; +# +#//*********************************************************** +#// echoMeUnknown soapval tests +#// echoMeUnknown with endpoint as header destination, doesn't have to understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->type = 'soapval'; +#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!'); +#$test->headers_expect['echoMeUnknown'] = array(); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeUnknown with endpoint as header destination, must understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->type = 'soapval'; +#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!',1); +#$test->headers_expect['echoMeUnknown'] = array(); +#$test->expect_fault = TRUE; +#$soap_tests['GroupC'][] = $test; +# +#// echoMeUnknown with endpoint NOT header destination, doesn't have to understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->type = 'soapval'; +#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!', 0, SOAP_TEST_ACTOR_OTHER); +#$test->headers_expect['echoMeUnknown'] = array(); +#$soap_tests['GroupC'][] = $test; +# +#// echoMeUnknown with endpoint NOT header destination, must understand +#$test = new SOAP_Test('echoVoid', NULL); +#$test->type = 'soapval'; +#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!', 1, SOAP_TEST_ACTOR_OTHER); +#$test->headers_expect['echoMeUnknown'] = array(); +#$soap_tests['GroupC'][] = $test; + + +?>
\ No newline at end of file diff --git a/ext/soap/interop/client_round2_results.php b/ext/soap/interop/client_round2_results.php new file mode 100644 index 0000000000..538513e3e0 --- /dev/null +++ b/ext/soap/interop/client_round2_results.php @@ -0,0 +1,75 @@ +<?php +// NOTE: do not run this directly under a web server, as it will take a very long +// time to execute. Run from a command line or something, and redirect output +// to an html file. +// +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 The PHP Group | +// +----------------------------------------------------------------------+ +// | This source file is subject to version 2.02 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | license@php.net so we can mail you a copy immediately. | +// +----------------------------------------------------------------------+ +// | Authors: Shane Caraveo <Shane@Caraveo.com> | +// +----------------------------------------------------------------------+ +// +// $Id$ +// +require_once 'client_round2_interop.php'; +?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> + +<html> +<head> +<style> +TD { background-color: Red; } +TD.BLANK { background-color: White; } +TD.OK { background-color: Lime; } +TD.RESULT { background-color: Green; } +TD.untested { background-color: White; } +TD.CONNECT { background-color: Yellow; } +TD.TRANSPORT { background-color: Yellow; } +TD.WSDL { background-color: Yellow; } +TD.WSDLCACHE { background-color: Yellow; } +TD.WSDLPARSER { background-color: Yellow; } +TD.HTTP { background-color: Yellow; } +TD.SMTP { background-color: Yellow; } +</style> + <title>PEAR-PHP SOAP Interop Tests</title> +</head> + +<body bgcolor="White" text="Black"> +<h2 align="center">SOAP Client Interop Test Results: Round2</h2> + +<a href="index.php">Back to Interop Index</a><br> +<p> </p> + +<?php +$iop = new Interop_Client(); + +if ($_GET['detail'] == 1) $iop->showFaults = 1; + +if ($_GET['wire']) { + $iop->showWire($_GET['wire']); +} else { + $iop->getEndpoints(); + $iop->getResults(); + + if ($_GET['test']) { + $iop->currentTest = $_GET['test']; + $iop->useWSDL = $_GET['wsdl']?$_GET['wsdl']:0; + $iop->paramType = $_GET['type']?$_GET['type']:'php'; + $iop->outputTable(); + } else { + $iop->outputTables(); + } +} +?> +</body> +</html> diff --git a/ext/soap/interop/client_round2_run.php b/ext/soap/interop/client_round2_run.php new file mode 100644 index 0000000000..3b8910e6b6 --- /dev/null +++ b/ext/soap/interop/client_round2_run.php @@ -0,0 +1,54 @@ +<?php +// this script is usefull for quickly testing stuff, use the 'pretty' file for html output +// +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 The PHP Group | +// +----------------------------------------------------------------------+ +// | This source file is subject to version 2.02 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | license@php.net so we can mail you a copy immediately. | +// +----------------------------------------------------------------------+ +// | Authors: Shane Caraveo <Shane@Caraveo.com> | +// +----------------------------------------------------------------------+ +// +// $Id$ +// +set_time_limit(0); +require_once 'client_round2_interop.php'; + +$iop = new Interop_Client(); +// force a fetch of endpoints, this happens irregardless if no endpoints in database +#$iop->fetchEndpoints(); + +// set some options +$iop->currentTest = 'base'; // see $tests above +$iop->paramType = 'php'; // 'php' or 'soapval' +$iop->useWSDL = 1; // 1= do wsdl tests +$iop->numServers = 0; // 0 = all +$iop->specificEndpoint = '4s4c'; // test only this endpoint +$iop->testMethod = 'echoString'; // test only this method + +#XXX MS SOAP ToolKit 2.0/3.0 crashes php-soap in __getfault! + +// endpoints to skip +$iop->skipEndpointList = array('Apache Axis','IONA XMLBus','IONA XMLBus (CORBA)','MS SOAP ToolKit 2.0','MS SOAP ToolKit 3.0','Spheon JSOAP','SQLData SOAP Server','WASP Advanced 3.0'); +$iop->startAt=''; +$this->nosave = 0; // 1= disable saving results to database +// debug output +$iop->show = 1; +$iop->debug = 0; +$iop->showFaults = 0; // used in result table output + +$iop->doTest(); // run a single set of tests using above options +#$iop->doGroupTests(); // run a group of tests set in $currentTest +#$iop->doTests(); // run all tests, ignore above options +#$iop->outputTables(); +echo "done"; + +?> diff --git a/ext/soap/interop/database_round2.sql b/ext/soap/interop/database_round2.sql new file mode 100644 index 0000000000..79669a04c2 --- /dev/null +++ b/ext/soap/interop/database_round2.sql @@ -0,0 +1,45 @@ +# phpMyAdmin MySQL-Dump +# version 2.2.5 +# http://phpwizard.net/phpMyAdmin/ +# http://phpmyadmin.sourceforge.net/ (download page) +# +# Host: localhost +# Generation Time: Apr 08, 2002 at 08:32 PM +# Server version: 3.23.49 +# PHP Version: 4.1.1 +# Database : `interop` +# -------------------------------------------------------- + +# +# Table structure for table `endpoints` +# + +CREATE TABLE endpoints ( + id int(11) NOT NULL auto_increment, + endpointName varchar(50) NOT NULL default '', + endpointURL varchar(255) NOT NULL default '', + wsdlURL varchar(255) NOT NULL default '', + class varchar(20) NOT NULL default '', + status int(11) NOT NULL default '1', + PRIMARY KEY (id) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `results` +# + +CREATE TABLE results ( + id int(11) NOT NULL auto_increment, + endpoint int(11) NOT NULL default '0', + stamp int(11) NOT NULL default '0', + class varchar(10) NOT NULL default '', + type varchar(10) default NULL, + wsdl int(11) NOT NULL default '0', + function varchar(255) NOT NULL default '', + result varchar(25) NOT NULL default '', + error text, + wire text NOT NULL, + PRIMARY KEY (id) +) TYPE=MyISAM; + diff --git a/ext/soap/interop/echoheadersvc.wsdl b/ext/soap/interop/echoheadersvc.wsdl new file mode 100644 index 0000000000..a279580dc3 --- /dev/null +++ b/ext/soap/interop/echoheadersvc.wsdl @@ -0,0 +1,16 @@ +<?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/InteropTest.wsdl" namespace="http://soapinterop.org/"/> + <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/xsd"/> + <import location="http://www.whitemesa.com/interop/InteropTestC.wsdl" namespace="http://soapinterop.org/"/> + + <service name="interopLabEchoHeader"> + + <port name="interopPortEchoHdr" binding="tns:InteropEchoHeaderBinding"> + <soap:address location="http://localhost/soap_interop/server_round2.php"/> + </port> + + </service> + +</definitions> diff --git a/ext/soap/interop/endpointdata.sql b/ext/soap/interop/endpointdata.sql new file mode 100644 index 0000000000..80d9d5ac9c --- /dev/null +++ b/ext/soap/interop/endpointdata.sql @@ -0,0 +1,85 @@ +# 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); + + + diff --git a/ext/soap/interop/index.php b/ext/soap/interop/index.php new file mode 100644 index 0000000000..ed222479b2 --- /dev/null +++ b/ext/soap/interop/index.php @@ -0,0 +1,70 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> + +<html> +<head> + <title>PEAR SOAP Interop</title> +</head> +<?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"; +?> +<body> + +<h2 align='center'>PEAR SOAP Interop</h2> +<p>Welcome to the PEAR SOAP Interop pages. These pages are set up for +SOAP Builder interop tests. You can find out more about the interop tests +at <a href="http://www.whitemesa.com/interop.htm">White Mesa</a>.</p> +<p>Currently Round 2 base, Group B and Group C interop tests are enabled.</p> + +<h3>Round 2 Interop Server</h3> +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> + +<h3>Interop Client</h3> + +<p> +Notes: +Tests are done both "Direct" and with "WSDL". WSDL tests use the supplied interop WSDL +to run the tests against. The Direct method uses an internal prebuilt list of methods and parameters +for the test.</p> +<p> +Tests are also run against two methods of generating method parameters. The first, 'php', attempts +to directly serialize PHP variables into soap values. The second method, 'soapval', uses a SOAP_Value +class to define what the type of the value is. The second method is more interopable than the first +by nature. +</p> + +<h3>Client Test Interface</h3> +<p>The <a href="client_round2.php">client interface</a> allows you to run the PEAR SOAP +Client against a choosen interop server. Each run updates the results database below.</p> + +<h3>Interop Client Test Results</h3> +<p>This is a database of the current test results using PEAR SOAP Clients against interop servers.</p> +<p> +More detail (wire) about errors (marked yellow or red) can be obtained by clicking on the +link in the result box. If we have an HTTP error +attempting to connect to the endpoint, we will mark all consecutive attempts as errors, and skip +testing that endpoint. This reduces the time it takes to run the tests if a server is unavailable. +WSDLCACHE errors mean we cannot retreive the WSDL file specified for the endpoint. +</p> + +<ul> +<li><a href="client_round2_results.php?test=base&type=php&wsdl=0">Base results using PHP native types</a></li> +<li><a href="client_round2_results.php?test=base&type=soapval&wsdl=0">Base results using SOAP types</a></li> +<li><a href="client_round2_results.php?test=base&type=php&wsdl=1">Base results using PHP native types with WSDL</a></li> +<li><a href="client_round2_results.php?test=GroupB&type=php&wsdl=0">Group B results using PHP native types</a></li> +<li><a href="client_round2_results.php?test=GroupB&type=soapval&wsdl=0">Group B results using SOAP types</a></li> +<li><a href="client_round2_results.php?test=GroupB&type=php&wsdl=1">Group B results using PHP native types with WSDL</a></li> +<li><a href="client_round2_results.php?test=GroupC&type=php&wsdl=0">Group C results using PHP native types</a></li> +<li><a href="client_round2_results.php?test=GroupC&type=soapval&wsdl=0">Group C results using SOAP types</a></li> +<li><a href="client_round2_results.php?test=GroupC&type=php&wsdl=1">Group C results using PHP native types with WSDL</a></li> +<li><a href="client_round2_results.php">Show All Results</a></li> +</ul> +</body> +</html> diff --git a/ext/soap/interop/info.php b/ext/soap/interop/info.php new file mode 100644 index 0000000000..147cebcdd4 --- /dev/null +++ b/ext/soap/interop/info.php @@ -0,0 +1 @@ +<?php phpinfo(); ?> diff --git a/ext/soap/interop/interop.wsdl b/ext/soap/interop/interop.wsdl new file mode 100644 index 0000000000..6a835b571f --- /dev/null +++ b/ext/soap/interop/interop.wsdl @@ -0,0 +1,18 @@ +<?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> diff --git a/ext/soap/interop/interopB.wsdl b/ext/soap/interop/interopB.wsdl new file mode 100644 index 0000000000..92301af334 --- /dev/null +++ b/ext/soap/interop/interopB.wsdl @@ -0,0 +1,13 @@ +<?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> diff --git a/ext/soap/interop/server_round2.php b/ext/soap/interop/server_round2.php new file mode 100644 index 0000000000..84a8333c7b --- /dev/null +++ b/ext/soap/interop/server_round2.php @@ -0,0 +1,35 @@ +<?php +// +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 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-->"; +?>
\ No newline at end of file diff --git a/ext/soap/interop/server_round2_base.php b/ext/soap/interop/server_round2_base.php new file mode 100644 index 0000000000..abbd9223bb --- /dev/null +++ b/ext/soap/interop/server_round2_base.php @@ -0,0 +1,184 @@ +<? +// +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 The PHP Group | +// +----------------------------------------------------------------------+ +// | This source file is subject to version 2.02 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | license@php.net so we can mail you a copy immediately. | +// +----------------------------------------------------------------------+ +// | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more | +// | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | +// +----------------------------------------------------------------------+ +// +// $Id$ +// +require_once 'SOAP/Server.php'; + +function generateFault($short, $long) +{ + $params = array( + "faultcode" => "Server", + "faultstring" => $short, + "detail" => $long + ); + + $faultmsg = new SOAP_Message("Fault",$params,"http://schemas.xmlsoap.org/soap/envelope/"); + return $faultmsg; +} + +function hex2bin($data) +{ + $len = strlen($data); + return pack("H" . $len, $data); +} + + +class SOAP_Interop_Base { + var $method_namespace = 'http://soapinterop.org/'; + + function SOAP_Interop_Base() { + #if ($server) { + # $server->addToMap("echoString",array("string"),array("string")); + # $server->addToMap("echoStringArray",array(),array()); + # $server->addToMap("echoInteger",array("int"),array("int")); + # $server->addToMap("echoIntegerArray",array(),array()); + # $server->addToMap("echoFloat",array("float"),array("float")); + # $server->addToMap("echoFloatArray",array(),array()); + # $server->addToMap("echoStruct",array(),array()); + # $server->addToMap("echoStructArray",array(),array()); + # $server->addToMap("echoVoid",array(),array()); + # $server->addToMap("echoBase64",array("base64Binary"),array("base64Binary")); + # $server->addToMap("echoDate",array("dateTime"),array("dateTime")); + # $server->addToMap("echoHexBinary",array("hexBinary"),array("hexBinary")); + # $server->addToMap("echoDecimal",array("decimal"),array("decimal")); + # $server->addToMap("echoBoolean",array("boolean"),array("boolean")); + #} + } + + function echoString($inputString) + { + return new SOAP_Value('outputString','string',$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); + } + + + function echoInteger($inputInteger) + { + return new SOAP_Value('outputInteger','int',(integer)$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); + } + + function echoFloat($inputFloat) + { + return new SOAP_Value('outputFloat','float',(FLOAT)$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); + } + + 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']) + )); + } + + 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; + } + + function echoVoid() + { + return NULL; + } + + function echoBase64($b_encoded) + { + return new SOAP_Value('return','base64Binary',base64_encode(base64_decode($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"); + } + } + + function echoHexBinary($hb) + { + return new SOAP_Value('return','hexBinary',bin2hex(hex2bin($hb))); + } + + function echoDecimal($dec) + { + return new SOAP_Value('return','decimal',(FLOAT)$dec); + } + + function echoBoolean($boolean) + { + return new SOAP_Value('return','boolean',$boolean); + } + + function echoMimeAttachment($stuff) + { + return new SOAP_Attachment('return','application/octet-stream',NULL,$stuff); + } +} + +$base = new SOAP_Interop_Base(); +$server->addObjectMap($base); +?>
\ No newline at end of file diff --git a/ext/soap/interop/server_round2_groupB.php b/ext/soap/interop/server_round2_groupB.php new file mode 100644 index 0000000000..cf28f58de1 --- /dev/null +++ b/ext/soap/interop/server_round2_groupB.php @@ -0,0 +1,87 @@ +<? +// +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 The PHP Group | +// +----------------------------------------------------------------------+ +// | This source file is subject to version 2.02 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | license@php.net so we can mail you a copy immediately. | +// +----------------------------------------------------------------------+ +// | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more | +// | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | +// +----------------------------------------------------------------------+ +// +// $Id$ +// +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()); + } + 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); + } + + 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; + } + + function echoNestedStruct($struct) + { + return $struct; + } + + function echo2DStringArray($ary) + { + $ret = new SOAP_Value('return','Array',$ary); + $ret->options['flatten'] = TRUE; + return $ret; + } + + function echoNestedArray($ary) + { + return $ary; + } +} + +$groupb = new SOAP_Interop_GroupB(); +$server->addObjectMap($groupb); + +?>
\ No newline at end of file diff --git a/ext/soap/interop/server_round2_groupC.php b/ext/soap/interop/server_round2_groupC.php new file mode 100644 index 0000000000..02d9804bee --- /dev/null +++ b/ext/soap/interop/server_round2_groupC.php @@ -0,0 +1,41 @@ +<? +// +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 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'; +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); + } + + function echoMeStructRequest($struct) + { + return new SOAP_Value('{'.$this->method_namespace.'}echoMeStructResponse','SOAPStruct',$struct); + } +} + +$groupc = new SOAP_Interop_GroupC(); +$server->addObjectMap($groupc); + +?>
\ No newline at end of file diff --git a/ext/soap/interop/server_round2_test.php b/ext/soap/interop/server_round2_test.php new file mode 100644 index 0000000000..1158abe563 --- /dev/null +++ b/ext/soap/interop/server_round2_test.php @@ -0,0 +1,258 @@ +<?php +// +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 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; +?>
\ No newline at end of file diff --git a/ext/soap/interop/test.utility.php b/ext/soap/interop/test.utility.php new file mode 100644 index 0000000000..9af61c22fb --- /dev/null +++ b/ext/soap/interop/test.utility.php @@ -0,0 +1,81 @@ +<?php +require_once("SOAP/Parser.php"); +require_once("SOAP/Value.php"); + +function number_compare($f1, $f2) +{ + # figure out which has the least fractional digits + preg_match('/.*?\.(.*)/',$f1,$m1); + preg_match('/.*?\.(.*)/',$f2,$m2); + #print_r($m1); + # always use at least 2 digits of precision + $d = max(min(strlen(count($m1)?$m1[1]:'0'),strlen(count($m2)?$m2[1]:'0')),2); + $f1 = round($f1, $d); + $f2 = round($f2, $d); + return bccomp($f1, $f2, $d) == 0; +} + +function boolean_compare($f1, $f2) +{ + if (($f1 == 'true' || $f1 === TRUE || $f1 != 0) && + ($f2 == 'true' || $f2 === TRUE || $f2 != 0)) return TRUE; + if (($f1 == 'false' || $f1 === FALSE || $f1 == 0) && + ($f2 == 'false' || $f2 === FALSE || $f2 == 0)) return TRUE; + return FALSE; +} + +function string_compare($e1, $e2) +{ + if (is_numeric($e1) && is_numeric($e2)) { + return number_compare($e1, $e2); + } + # handle dateTime comparison + $e1_type = gettype($e1); + $e2_type = gettype($e2); + $ok = FALSE; + if ($e1_type == "string") { + $dt = new SOAP_Type_dateTime(); + $ok = $dt->compare($e1, $e2) == 0; + } + 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; + + # 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; + } + } + return TRUE; +} + + +function parseMessage($msg) +{ + # strip line endings + #$msg = preg_replace('/\r|\n/', ' ', $msg); + $response = new SOAP_Parser($msg); + if ($response->fault) { + return $response->fault->getFault(); + } + $return = $response->getResponse(); + $v = $response->decode($return); + if (gettype($v) == 'array' && count($v)==1) { + return array_shift($v); + } + return $v; +} + + +?>
\ No newline at end of file diff --git a/ext/soap/interop/testclient.php b/ext/soap/interop/testclient.php new file mode 100644 index 0000000000..b70c628ee5 --- /dev/null +++ b/ext/soap/interop/testclient.php @@ -0,0 +1,17 @@ +<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>
\ No newline at end of file diff --git a/ext/soap/interop/testserver.php b/ext/soap/interop/testserver.php new file mode 100644 index 0000000000..03973c8863 --- /dev/null +++ b/ext/soap/interop/testserver.php @@ -0,0 +1,17 @@ +<?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 -->"; +?>
\ No newline at end of file |