SOAP_Interop
[ class tree: SOAP_Interop ] [ index: SOAP_Interop ] [ all elements ]

Source for file interop_client_run.php

Documentation is available at interop_client_run.php

  1. <?php
  2. // this script is usefull for quickly testing stuff, use the 'pretty' file for html output
  3. //
  4. // +----------------------------------------------------------------------+
  5. // | PHP Version 4                                                        |
  6. // +----------------------------------------------------------------------+
  7. // | Copyright (c) 1997-2003 The PHP Group                                |
  8. // +----------------------------------------------------------------------+
  9. // | This source file is subject to version 2.02 of the PHP license,      |
  10. // | that is bundled with this package in the file LICENSE, and is        |
  11. // | available at through the world-wide-web at                           |
  12. // | http://www.php.net/license/2_02.txt.                                 |
  13. // | If you did not receive a copy of the PHP license and are unable to   |
  14. // | obtain it through the world-wide-web, please send a note to          |
  15. // | license@php.net so we can mail you a copy immediately.               |
  16. // +----------------------------------------------------------------------+
  17. // | Authors: Shane Caraveo <Shane@Caraveo.com>                           |
  18. // +----------------------------------------------------------------------+
  19. //
  20. // $Id: interop_client_run.php,v 1.11 2007/01/26 15:03:24 yunosh Exp $
  21. //
  22.  
  23. if (isset($_SERVER['SERVER_NAME'])) {
  24.     die("full test run cannot be done via webserver.");
  25. }
  26.  
  27.  
  28. require 'Console/Getopt.php';
  29. require_once 'interop_client.php';
  30.  
  31. $INTEROP_LOCAL_SERVER = TRUE;// add local server to endpoints
  32.  
  33. $iop =new Interop_Client();
  34.  
  35. // debug output
  36. $iop->show = 1;
  37. $iop->debug = 0;
  38. $iop->showFaults = 0; // used in result table output
  39. $restrict = null;
  40.  
  41. $args = Console_Getopt::getopt($_SERVER['argv'],
  42.                                'c:dehl:m:np:r:s:t:v:wq',
  43.                                array('help'));
  44. if (PEAR::isError($args)) {
  45.     echo "\n" $args->getMessage("\n\n";
  46.     help();
  47.     exit;
  48. }
  49.  
  50. function help({
  51. print <<<END
  52. interop_client_run.php [options]
  53.     -c pear|php-soap        client type (not implemented yet)
  54.     -d                      turn on debug output
  55.     -e                      fetch interop test information
  56.     -h                      this help
  57.     -l list                 comma seperated list of endpoint names to skip
  58.     -m method_name          specific soap method to test
  59.     -n                      do not save results to database
  60.     -p t|e                  print list of [t]ests or [e]ndpoints
  61.     -r string               restrict tests to those whose name starts with...
  62.     -s server_name          test a specific server
  63.     -t test_name            run a specific set of tests
  64.     -v php|soapval          run tests with specific param types (requires -t)
  65.     -w                      run wsdl tests only (requires -t)
  66.     -q                      do not run tests
  67.  
  68. END;
  69. }
  70.  
  71. function print_test_names()
  72. {
  73.     global $iop;
  74.     print "Interop tests supported:\n";
  75.     foreach ($iop->tests as $test{
  76.         print "  $test\n";
  77.     }
  78. }
  79.  
  80. {
  81.     global $iop;
  82.     if (!$iop->getEndpoints($iop->currentTest)) {
  83.         die("Unable to retrieve endpoints for $iop->currentTest\n");
  84.     }
  85.     print "Interop Servers for $iop->currentTest:\n";
  86.     foreach ($iop->endpoints as $server{
  87.         print "  $server->name\n";
  88.     }
  89. }
  90.  
  91. foreach ($args[0as $arg{
  92.     switch($arg[0]{
  93.     case 'c':
  94.         $iop->client_type = $arg[1];
  95.         break;
  96.     case 'd':
  97.         $iop->debug = true;
  98.         break;
  99.     case 'e':
  100.         $iop->fetchEndpoints();
  101.         break;
  102.     case 'h':
  103.     case '--help':
  104.         help();
  105.         exit(0);
  106.     case 'l':
  107.         $iop->skipEndpointList = split(','$arg[1]);
  108.         break;
  109.     case 'm':
  110.         $iop->testMethod = $arg[1];
  111.         break;
  112.     case 'n':
  113.         $iop->nosave = true;
  114.         break;
  115.     case 'p':
  116.         if ($arg[1== 't'{
  117.             print_test_names();
  118.         elseif ($arg[1== 'e'{
  119.             if (!$iop->currentTest{
  120.                 print "You need to specify a test with -t\n";
  121.                 exit(0);
  122.             }
  123.             print_endpoint_names();
  124.         else {
  125.             die("invalid print argument\n");
  126.         }
  127.         exit(0);
  128.     case 'r':
  129.         $restrict $arg[1];
  130.         break;
  131.     case 's':
  132.         $iop->specificEndpoint = $arg[1];
  133.         break;
  134.     case 't':
  135.         $iop->currentTest = $arg[1];
  136.         break;
  137.     case 'v':
  138.         if ($arg[1!= 'php' && $arg[1!= 'soapval'{
  139.             die('Incorrect value for argument v: ' $arg[1"\n");
  140.         }
  141.         $iop->paramType = $arg[1];
  142.         break;
  143.     case 'w':
  144.         $iop->useWSDL = true;
  145.         break;
  146.     case 'q':
  147.         exit(0);
  148.     }
  149. }
  150.  
  151. // These are endpoints that are listed in the interop server, but do not realy
  152. // exist any longer.
  153. $bad = array('Spheon JSOAP''Phalanx''SilverStream''SOAPx4 (PHP)',
  154.              'Virtuoso (development)''Zolera SOAP Infrastructure');
  155. $iop->skipEndpointList = array_merge($iop->skipEndpointList$bad);
  156.  
  157. if ($restrict{
  158.     $tests $iop->tests;
  159.     $iop->tests = array();
  160.     foreach ($tests as $test{
  161.         if (stristr($test$restrict)) {
  162.             $iop->tests[$test;
  163.         }
  164.     }
  165. }
  166.  
  167. if ($iop->currentTest{
  168.     $iop->doTest();  // run a single set of tests using above options
  169. else {
  170.     // $iop->doGroupTests(); // run a group of tests set in $currentTest
  171.     $iop->doTests();  // run all tests, ignore above options
  172. }
  173.  
  174. echo "done\n";

Documentation generated on Mon, 11 Mar 2019 15:06:25 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.