dmitry          Wed Feb 11 11:13:16 2004 EDT

  Modified files:              
    /php-src/ext/soap/interop   client_round2_interop.php 
                                client_round2_params.php 
                                client_round2_run.php config.php.dist 
  Log:
  support for command line interface was improved
  
  
http://cvs.php.net/diff.php/php-src/ext/soap/interop/client_round2_interop.php?r1=1.12&r2=1.13&ty=u
Index: php-src/ext/soap/interop/client_round2_interop.php
diff -u php-src/ext/soap/interop/client_round2_interop.php:1.12 
php-src/ext/soap/interop/client_round2_interop.php:1.13
--- php-src/ext/soap/interop/client_round2_interop.php:1.12     Wed Feb 11 08:53:49 
2004
+++ php-src/ext/soap/interop/client_round2_interop.php  Wed Feb 11 11:13:15 2004
@@ -16,7 +16,7 @@
 // | Authors: Shane Caraveo <[EMAIL PROTECTED]>                           |
 // +----------------------------------------------------------------------+
 //
-// $Id: client_round2_interop.php,v 1.12 2004/02/11 13:53:49 dmitry Exp $
+// $Id: client_round2_interop.php,v 1.13 2004/02/11 16:13:15 dmitry Exp $
 //
 require_once 'DB.php'; // PEAR/DB
 require_once 'client_round2_params.php';
@@ -30,6 +30,8 @@
     // 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 @@
     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 @@
         // 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 @@
         // 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 @@
                 $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 @@
             $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 @@
                                   $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 @@
                     }
                     #$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 @@
         $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";
     }
 
 }
http://cvs.php.net/diff.php/php-src/ext/soap/interop/client_round2_params.php?r1=1.9&r2=1.10&ty=u
Index: php-src/ext/soap/interop/client_round2_params.php
diff -u php-src/ext/soap/interop/client_round2_params.php:1.9 
php-src/ext/soap/interop/client_round2_params.php:1.10
--- php-src/ext/soap/interop/client_round2_params.php:1.9       Wed Feb  4 09:46:12 
2004
+++ php-src/ext/soap/interop/client_round2_params.php   Wed Feb 11 11:13:15 2004
@@ -16,7 +16,7 @@
 // | Authors: Shane Caraveo <[EMAIL PROTECTED]>                           |
 // +----------------------------------------------------------------------+
 //
-// $Id: client_round2_params.php,v 1.9 2004/02/04 14:46:12 dmitry Exp $
+// $Id: client_round2_params.php,v 1.10 2004/02/11 16:13:15 dmitry Exp $
 //
 
 define('SOAP_TEST_ACTOR_OTHER','http://some/other/actor');
@@ -81,11 +81,11 @@
     * @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 @@
 
         $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 @@
                 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";
+            }
         }
     }
 }
http://cvs.php.net/diff.php/php-src/ext/soap/interop/client_round2_run.php?r1=1.3&r2=1.4&ty=u
Index: php-src/ext/soap/interop/client_round2_run.php
diff -u php-src/ext/soap/interop/client_round2_run.php:1.3 
php-src/ext/soap/interop/client_round2_run.php:1.4
--- php-src/ext/soap/interop/client_round2_run.php:1.3  Mon Jan  5 11:44:00 2004
+++ php-src/ext/soap/interop/client_round2_run.php      Wed Feb 11 11:13:15 2004
@@ -1,6 +1,4 @@
 <?php
-// this script is usefull for quickly testing stuff, use the 'pretty' file for html 
output
-//
 // +----------------------------------------------------------------------+
 // | PHP Version 4                                                        |
 // +----------------------------------------------------------------------+
@@ -17,27 +15,28 @@
 // | Authors: Shane Caraveo <[EMAIL PROTECTED]>                           |
 // +----------------------------------------------------------------------+
 //
-// $Id: client_round2_run.php,v 1.3 2004/01/05 16:44:00 dmitry Exp $
+// $Id: client_round2_run.php,v 1.4 2004/02/11 16:13:15 dmitry Exp $
 //
+
 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->doGroupTests(); // run a group of tests set in $currentTest
 #$iop->doTests();  // run all tests, ignore above options
 #$iop->outputTables();
-echo "done";
+echo "done\n";
 
 ?>
http://cvs.php.net/diff.php/php-src/ext/soap/interop/config.php.dist?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/soap/interop/config.php.dist
diff -u php-src/ext/soap/interop/config.php.dist:1.1 
php-src/ext/soap/interop/config.php.dist:1.2
--- php-src/ext/soap/interop/config.php.dist:1.1        Mon Jan  5 11:44:00 2004
+++ php-src/ext/soap/interop/config.php.dist    Wed Feb 11 11:13:15 2004
@@ -1,4 +1,5 @@
 <?php
 // configuration items
 $interopConfig['DSN'] = 'mysql://[EMAIL PROTECTED]/soapinterop';
+$interopConfig['baseURL'] = 'http://localhost/soap/interop';
 ?>
\ No newline at end of file

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to