diff options
author | Dmitry Stogov <dmitry@php.net> | 2004-02-11 16:13:15 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2004-02-11 16:13:15 +0000 |
commit | f3ed4a27a06e9213d6c7f8e344e0e055026c0fd3 (patch) | |
tree | 4f66a2fd039a029dda7b57f382cc831377f5180a | |
parent | f46638ae28eccc8ce4fc7dbc85d85150b5f14ccb (diff) | |
download | php-git-f3ed4a27a06e9213d6c7f8e344e0e055026c0fd3.tar.gz |
support for command line interface was improved
-rw-r--r-- | ext/soap/interop/client_round2_interop.php | 44 | ||||
-rw-r--r-- | ext/soap/interop/client_round2_params.php | 28 | ||||
-rw-r--r-- | ext/soap/interop/client_round2_run.php | 25 | ||||
-rw-r--r-- | ext/soap/interop/config.php.dist | 1 |
4 files changed, 65 insertions, 33 deletions
diff --git a/ext/soap/interop/client_round2_interop.php b/ext/soap/interop/client_round2_interop.php index 7b19e7f0de..76fe653e68 100644 --- a/ext/soap/interop/client_round2_interop.php +++ b/ext/soap/interop/client_round2_interop.php @@ -30,6 +30,8 @@ class Interop_Client // database DNS var $DSN = ""; + var $baseURL = ""; + // our central interop server, where we can get the list of endpoints var $interopServer = "http://www.whitemesa.net/wsdl/interopInfo.wsdl"; @@ -57,10 +59,13 @@ class Interop_Client var $tests = array('base','GroupB', 'GroupC'); var $paramTypes = array('php', 'soapval'); var $endpoints = array(); + var $html = 1; function Interop_Client() { global $interopConfig; $this->DSN = $interopConfig['DSN']; + $this->baseURL = $interopConfig['baseURL']; + //$this->baseURL = 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']); // set up the database connection $this->dbc = DB::connect($this->DSN, true); // if it errors out, just ignore it and rely on regular methods @@ -71,19 +76,18 @@ class Interop_Client // set up local endpoint $this->localEndpoint['base'] = (object)array( 'endpointName'=>'PHP ext/soap', - 'endpointURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/server_round2_base.php', - 'wsdlURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/interop.wsdl.php' + 'endpointURL'=>$this->baseURL.'/server_round2_base.php', + 'wsdlURL'=>$this->baseURL.'/interop.wsdl.php' ); $this->localEndpoint['GroupB'] = (object)array( 'endpointName'=>'PHP ext/soap', - 'endpointURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/server_round2_groupB.php', - 'wsdlURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/interopB.wsdl.php' + 'endpointURL'=>$this->baseURL.'/server_round2_groupB.php', + 'wsdlURL'=>$this->baseURL.'/interopB.wsdl.php' ); $this->localEndpoint['GroupC'] = (object)array( 'endpointName'=>'PHP ext/soap', - 'endpointURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/server_round2_groupC.php', - 'wsdlURL'=>'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/echoheadersvc.wsdl.php' - ); + 'endpointURL'=>$this->baseURL.'/server_round2_groupC.php', + 'wsdlURL'=>$this->baseURL.'/echoheadersvc.wsdl.php'); } function _fetchEndpoints(&$soapclient, $test) { @@ -92,9 +96,11 @@ class Interop_Client // retreive endpoints from the endpoint server $endpointArray = $soapclient->__call("GetEndpointInfo",array("groupName"=>$test),array('soapaction'=>"http://soapinterop.org/",'uri'=>"http://soapinterop.org/")); if (is_soap_fault($endpointArray) || PEAR::isError($endpointArray)) { - print "<pre>".$soapclient->wire."\n"; + if ($this->html) print "<pre>"; + print $soapclient->wire."\n"; print_r($endpointArray); - print "</pre>"; + if ($this->html) print "</pre>"; + print "\n"; return; } @@ -145,7 +151,11 @@ class Interop_Client $test = 'base'; } } catch (SoapFault $fault) { - echo "<pre>$fault</pre>"; + if ($this->html) { + echo "<pre>$fault</pre>\n"; + } else { + echo "$fault\n"; + } return NULL; } // retreive all endpoints now @@ -552,7 +562,10 @@ try { $this->totals['servers']++; #$endpoint_info['tests'] = array(); - if ($this->show) print "Processing $endpoint at {$endpoint_info['endpointURL']}<br>\n"; + if ($this->show) { + print "Processing $endpoint at {$endpoint_info['endpointURL']}"; + if ($this->html) print "<br>\n"; else print "\n"; + } foreach($soap_tests[$this->currentTest] as $soap_test) { //foreach(array_keys($method_params[$this->currentTest][$this->paramType]) as $method) @@ -573,7 +586,7 @@ try { $skipfault ); #$endpoint_info['tests'][] = &$soap_test; - #$soap_test->showTestResult($this->debug); + #$soap_test->showTestResult($this->debug, $this->html); #$this->_saveResults($endpoint_info['id'], $soap_test->method_name); $soap_test->result = NULL; continue; @@ -602,7 +615,7 @@ try { } #$endpoint_info['tests'][] = &$soap_test; } - $soap_test->showTestResult($this->debug); + $soap_test->showTestResult($this->debug, $this->html); $this->_saveResults($endpoint_info['id'], $soap_test); $soap_test->result = NULL; $this->totals['calls']++; @@ -775,7 +788,10 @@ try { $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"; + if ($this->html) print "<pre>"; + echo "\n".HTMLSpecialChars($wire); + if ($this->html) print "</pre>"; + print "\n"; } } diff --git a/ext/soap/interop/client_round2_params.php b/ext/soap/interop/client_round2_params.php index ee5aeade3a..afacec28bf 100644 --- a/ext/soap/interop/client_round2_params.php +++ b/ext/soap/interop/client_round2_params.php @@ -81,11 +81,11 @@ class SOAP_Test { * @param string method * @access public */ - function showTestResult($debug = 0) { + function showTestResult($debug = 0, $html = 0) { // debug output if ($debug) $this->show = 1; if ($debug) { - echo str_repeat("-",50)."<br>\n"; + echo str_repeat("-",50).$html?"<br>\n":"\n"; } echo "testing $this->test_name : "; @@ -98,7 +98,11 @@ class SOAP_Test { $ok = $this->result['success']; if ($ok) { - print "<font color=\"#00cc00\">SUCCESS</font>\n"; + if ($html) { + print "<font color=\"#00cc00\">SUCCESS</font>\n"; + } else { + print "SUCCESS\n"; + } } else { $fault = $this->result['fault']; if ($fault) { @@ -107,13 +111,25 @@ class SOAP_Test { if ($pos !== false) { $res = substr($res,$pos+1); } - print "<font color=\"#ff0000\">FAILED: [$res] {$fault->faultstring}</font>\n"; + if ($html) { + print "<font color=\"#ff0000\">FAILED: [$res] {$fault->faultstring}</font>\n"; + } else { + print "FAILED: [$res] {$fault->faultstring}\n"; + } } else { - print "<font color=\"#ff0000\">FAILED: ".$this->result['result']."</font>\n"; + if ($html) { + print "<font color=\"#ff0000\">FAILED: ".$this->result['result']."</font>\n"; + } else { + print "FAILED: ".$this->result['result']."\n"; + } } } if ($debug) { - echo "<pre>\n".htmlentities($this->result['wire'])."</pre>\n"; + if ($html) { + echo "<pre>\n".htmlentities($this->result['wire'])."</pre>\n"; + } else { + echo "\n".htmlentities($this->result['wire'])."\n"; + } } } } diff --git a/ext/soap/interop/client_round2_run.php b/ext/soap/interop/client_round2_run.php index d879353694..1a1f9a8ea4 100644 --- a/ext/soap/interop/client_round2_run.php +++ b/ext/soap/interop/client_round2_run.php @@ -1,6 +1,4 @@ <?php -// this script is usefull for quickly testing stuff, use the 'pretty' file for html output -// // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ @@ -19,25 +17,26 @@ // // $Id$ // + set_time_limit(0); require_once 'client_round2_interop.php'; $iop = new Interop_Client(); +$iop->html = 0; + // force a fetch of endpoints, this happens irregardless if no endpoints in database -#$iop->fetchEndpoints(); +$iop->fetchEndpoints(); // set some options -$iop->currentTest = 'base'; // see $tests above -$iop->paramType = 'php'; // 'php' or 'soapval' -$iop->useWSDL = 0; // 1= do wsdl tests -$iop->numServers = 0; // 0 = all -//$iop->specificEndpoint = '4s4c'; // test only this endpoint -//$iop->testMethod = 'echoString'; // test only this method - -#XXX MS SOAP ToolKit 2.0/3.0 crashes php-soap in __getfault! +$iop->currentTest = 'GroupC'; // see $tests above +$iop->paramType = 'php'; // 'php' or 'soapval' +$iop->useWSDL = 1; // 1= do wsdl tests +$iop->numServers = 0; // 0 = all +//$iop->specificEndpoint = 'PHP ext/soap'; // test only this endpoint +//$iop->testMethod = 'echoString'; // test only this method // endpoints to skip -$iop->skipEndpointList = array('Apache Axis','IONA XMLBus','IONA XMLBus (CORBA)','MS SOAP ToolKit 2.0','MS SOAP ToolKit 3.0','Spheon JSOAP','SQLData SOAP Server','WASP Advanced 3.0'); +//$iop->skipEndpointList = array('Apache Axis','IONA XMLBus','IONA XMLBus (CORBA)','MS SOAP ToolKit 2.0','MS SOAP ToolKit 3.0','Spheon JSOAP','SQLData SOAP Server','WASP Advanced 3.0'); $iop->startAt=''; $iop->nosave = 0; // 1= disable saving results to database // debug output @@ -49,6 +48,6 @@ $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"; +echo "done\n"; ?> diff --git a/ext/soap/interop/config.php.dist b/ext/soap/interop/config.php.dist index 3e9549cdfe..afdeaf9f6c 100644 --- a/ext/soap/interop/config.php.dist +++ b/ext/soap/interop/config.php.dist @@ -1,4 +1,5 @@ <?php // configuration items $interopConfig['DSN'] = 'mysql://root@localhost/soapinterop'; +$interopConfig['baseURL'] = 'http://localhost/soap/interop'; ?>
\ No newline at end of file |