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.8 2003/04/14 02:12:45 shane 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. #$SOAP_RAW_CONVERT = TRUE;
  32. $INTEROP_LOCAL_SERVER = TRUE;// add local server to endpoints
  33.  
  34. $iop =new Interop_Client();
  35.  
  36. // set some defaults
  37. $iop->client_type='pear'// 'pear' or 'php-soap'
  38. $iop->currentTest = '';      // see $tests above
  39. $iop->paramType = 'php';     // 'php' or 'soapval'
  40. $iop->useWSDL = 0;           // 1= do wsdl tests
  41. $iop->numServers = 0;        // 0 = all
  42. $iop->specificEndpoint = ''// test only this endpoint
  43. $iop->testMethod = '';       // test only this method
  44. $iop->skipEndpointList = array();#array('Frontier','CapeConnect','Apache Axis','Apache SOAP 2.2'); // endpoints to skip
  45. $iop->nosave = 0; // 1= disable saving results to database
  46. // debug output
  47. $iop->show = 1;
  48. $iop->debug = 0;
  49. $iop->showFaults = 0; // used in result table output
  50. $restrict = NULL;
  51.  
  52. #$_SERVER['argv'] = array('-r', "Round 3", '-s', "Local PEAR::SOAP");
  53. $args = Console_Getopt::getopt($_SERVER['argv']'c:dehl:m:np:r:s:t:v:wq');
  54.  
  55. function help({
  56. print <<<END
  57. interop_client_run.php [options]
  58.     -c pear|php-soap        client type (not implmented yet)
  59.     -d                      turn on debug output
  60.     -e                      fetch interop test information
  61.     -h                      this help
  62.     -l list                 comma seperated list of endpoint names to skip
  63.     -m method_name          specific soap method to test
  64.     -n                      do not save results to database
  65.     -p t|e                  print list of [t]ests or [e]ndpoints
  66.     -r string               restrict tests to those whose name starts with...
  67.     -s server_name          test a specific server
  68.     -t test_name            run a specific set of tests
  69.     -v php|soapval          run tests with specific param types (requires -t)
  70.     -w                      run wsdl tests only (requires -t)
  71.     -q                      do not run tests
  72. END;
  73. }
  74.  
  75. function print_test_names()
  76. {
  77.     global $iop;
  78.     print "Interop tests supported:\n";
  79.     foreach ($iop->tests as $test{
  80.         print "  $test\n";
  81.     }
  82. }
  83.  
  84. {
  85.     global $iop;
  86.     if (!$iop->getEndpoints($iop->currentTest)) {
  87.         die("Unable to retrieve endpoints for $iop->currentTest");
  88.     }
  89.     print "Interop Servers for $iop->currentTest:\n";
  90.     foreach ($iop->endpoints as $server{
  91.         print "  $server->name\n";
  92.     }
  93. }
  94.  
  95. foreach($args[0as $arg{
  96.     switch($arg[0]{
  97.     case 'c':
  98.         $iop->client_type = $arg[1];
  99.         break;
  100.     case 'd':
  101.         $iop->debug = true;
  102.         break;
  103.     case 'e':
  104.         $iop->fetchEndpoints();
  105.         break;
  106.     case 'h':
  107.         help();
  108.         exit(1);
  109.         break;
  110.     case 'l':
  111.         $iop->skipEndpointList = split(',',$arg[1]);
  112.         break;
  113.     case 'm':
  114.         $iop->testMethod = $arg[1];
  115.         break;
  116.     case 'n':
  117.         $iop->nosave = true;
  118.         break;
  119.     case 'p':
  120.         if ($arg[1== 't'{
  121.             print_test_names();
  122.         else if ($arg[1== 'e'{
  123.             if (!$iop->currentTest{
  124.                 print "You need to specify a test with -t";
  125.                 exit(0);
  126.             }
  127.             print_endpoint_names();
  128.         else {
  129.             die("invalid print argument");
  130.         }
  131.         exit(0);
  132.         break;
  133.     case 'r':
  134.         $restrict $arg[1];
  135.         break;
  136.     case 's':
  137.         $iop->specificEndpoint = $arg[1];
  138.         break;
  139.     case 't':
  140.         $iop->currentTest = $arg[1];
  141.         break;
  142.     case 'v':
  143.         if ($arg[1]!='php' && $arg[1]!='soapval')
  144.             die('Incorrect value for argument v: '.$arg[1]);
  145.         $iop->paramType = $arg[1];
  146.         break;
  147.     case 'w':
  148.         $iop->useWSDL = true;
  149.         break;
  150.     case 'q':
  151.         exit(0);
  152.     }
  153. }
  154.  
  155. // these are endpoints that are listed in the interop
  156. // server, but do not realy exist any longer
  157. $bad = array('Spheon JSOAP','Phalanx',
  158.              'SilverStream','SOAPx4 (PHP)',
  159.              'Virtuoso (development)',
  160.              'Zolera SOAP Infrastructure');
  161. $iop->skipEndpointList = array_merge($iop->skipEndpointList$bad);
  162.  
  163. if ($restrict{
  164.     $tests $iop->tests;
  165.     $iop->tests = array();
  166.     foreach ($tests as $test{
  167.         if (stristr($test$restrict)) {
  168.             $iop->tests[$test;
  169.         }
  170.     }
  171. }
  172.  
  173. if ($iop->currentTest{
  174.     $iop->doTest();  // run a single set of tests using above options
  175. else {
  176. #$iop->doGroupTests(); // run a group of tests set in $currentTest
  177.     $iop->doTests();  // run all tests, ignore above options
  178. }
  179. echo "done";
  180. ?>

Documentation generated on Mon, 11 Mar 2019 14:54:33 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.