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

Source for file interop_test.php

Documentation is available at interop_test.php

  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.02 of the PHP license,      |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Shane Caraveo <Shane@Caraveo.com>                           |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: interop_test.php,v 1.8 2004/06/10 07:54:03 arnaud Exp $
  20. //
  21. require_once 'SOAP/Value.php';
  22.  
  23. define('SOAP_TEST_ACTOR_NEXT','http://schemas.xmlsoap.org/soap/actor/next');
  24. define('SOAP_TEST_ACTOR_OTHER','http://some/other/actor');
  25.  
  26. class SOAP_Interop_Test {
  27.     var $type 'php';
  28.     var $test_name = NULL;
  29.     var $method_name = NULL;
  30.     var $method_params = NULL;
  31.     var $expect = NULL;
  32.     var $expect_fault = FALSE;
  33.     var $headers = NULL;
  34.     var $headers_expect = NULL;
  35.     var $result = array();
  36.     var $show = 1;
  37.     var $debug = 0;
  38.     var $encoding = SOAP_DEFAULT_ENCODING;
  39.     var $service = NULL; // if multiple services, this sets to a specific service
  40.     
  41.     function SOAP_Interop_Test($methodname$params$expect=NULL{
  42.         if (strchr($methodname,'(')) {
  43.             preg_match('/(.*)\((.*)\)/',$methodname,$matches);
  44.             $this->test_name $methodname;
  45.             $this->method_name $matches[1];
  46.         else {
  47.             $this->test_name $this->method_name $methodname;
  48.         }
  49.         $this->method_params =$params;
  50.         $this->expect =$expect;
  51.         
  52.         // determine test type
  53.         if ($params{
  54.         $v array_values($params);
  55.         if (gettype($v[0]== 'object' && strtolower(get_class($v[0])) == 'soap_value')
  56.             $this->type 'soapval';
  57.         }
  58.     }
  59.     
  60.     function setResult($ok$result$wire$error ''$fault = NULL)
  61.     {
  62.         $this->result['success'$ok;
  63.         $this->result['result'$result;
  64.         $this->result['error'$error;
  65.         $this->result['wire'$wire;
  66.         $this->result['fault'$fault;
  67.     }
  68.  
  69.     function reset()
  70.     {
  71.         $this->result = array();
  72.     }
  73.     
  74.     /**
  75.     *  showMethodResult
  76.     * print simple output about a methods result
  77.     *
  78.     * @param array endpoint_info
  79.     * @param string method
  80.     * @access public
  81.     */    
  82.     function showTestResult($debug = 0{
  83.         // debug output
  84.         if ($debug$this->show = 1;
  85.         if ($debug{
  86.             echo str_repeat("-",50)."<br>\n";
  87.         }
  88.         
  89.         echo "testing $this->test_name : ";
  90.         if ($this->headers{
  91.             $hc count($this->headers);
  92.             for ($i=0; $i $hc$i++{
  93.                 $h =$this->headers[$i];
  94.                 if (strtolower(get_class($h)) == 'soap_header'{
  95.                     
  96.                     echo "\n    {$h->name},{$h->attributes['SOAP-ENV:actor']},{$h->attributes['SOAP-ENV:mustUnderstand']} : ";
  97.                 else {
  98.                     if (!$h[4]$h[4SOAP_TEST_ACTOR_NEXT;
  99.                     if (!$h[3]$h[3= 0;
  100.                     echo "\n    $h[0],$h[4],$h[3] : ";
  101.                 }
  102.             }
  103.         }
  104.         
  105.         if ($debug{
  106.             print "method params: ";
  107.             print_r($this->params);
  108.             print "\n";
  109.         }
  110.         
  111.         $ok $this->result['success'];
  112.         if ($ok{
  113.             print "SUCCESS\n";
  114.         else {
  115.             $fault $this->result['fault'];
  116.             if ($fault{
  117.                 print "FAILED: [{$fault->faultcode}] {$fault->faultstring}\n";
  118.             else {
  119.                 print "FAILED: ".$this->result['result']."\n";
  120.             }
  121.         }
  122.         if ($debug{
  123.             echo "<pre>\n".htmlentities($this->result['wire'])."</pre>\n";
  124.         }
  125.     }
  126. }
  127.  
  128. ?>

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