📄 client_round2_params.php
字号:
<?php//// +----------------------------------------------------------------------+// | PHP Version 4 |// +----------------------------------------------------------------------+// | Copyright (c) 1997-2003 The PHP Group |// +----------------------------------------------------------------------+// | This source file is subject to version 2.02 of the PHP license, |// | that is bundled with this package in the file LICENSE, and is |// | available through the world-wide-web at |// | http://www.php.net/license/2_02.txt. |// | If you did not receive a copy of the PHP license and are unable to |// | obtain it through the world-wide-web, please send a note to |// | license@php.net so we can mail you a copy immediately. |// +----------------------------------------------------------------------+// | Authors: Shane Caraveo <Shane@Caraveo.com> |// +----------------------------------------------------------------------+//// $Id: client_round2_params.php,v 1.13 2006/01/01 13:25:34 sniper Exp $//define('SOAP_TEST_ACTOR_OTHER','http://some/other/actor');class SOAP_Test { var $type = 'php'; var $test_name = NULL; var $method_name = NULL; var $method_params = NULL; var $cmp_func = NULL; var $expect = NULL; var $expect_fault = FALSE; var $headers = NULL; var $headers_expect = NULL; var $result = array(); var $show = 1; var $debug = 0; var $encoding = 'UTF-8'; function SOAP_Test($methodname, $params, $expect = NULL, $cmp_func = NULL) { # XXX we have to do this to make php-soap happy with NULL params if (!$params) $params = array(); if (strchr($methodname,'(')) { preg_match('/(.*)\((.*)\)/',$methodname,$matches); $this->test_name = $methodname; $this->method_name = $matches[1]; } else { $this->test_name = $this->method_name = $methodname; } $this->method_params = $params; if ($expect !== NULL) { $this->expect = $expect; } if ($cmp_func !== NULL) { $this->cmp_func = $cmp_func; } // determine test type if ($params) { $v = array_values($params); if (gettype($v[0]) == 'object' && (get_class($v[0]) == 'SoapVar' || get_class($v[0]) == 'SoapParam')) $this->type = 'soapval'; } } function setResult($ok, $result, $wire, $error = '', $fault = NULL) { $this->result['success'] = $ok; $this->result['result'] = $result; $this->result['error'] = $error; $this->result['wire'] = $wire; $this->result['fault'] = $fault; } /** * showMethodResult * print simple output about a methods result * * @param array endpoint_info * @param string method * @access public */ function showTestResult($debug = 0, $html = 0) { // debug output if ($debug) $this->show = 1; if ($debug) { echo str_repeat("-",50).$html?"<br>\n":"\n"; } echo "testing $this->test_name : "; if ($debug) { print "method params: "; print_r($this->params); print "\n"; } $ok = $this->result['success']; if ($ok) { if ($html) { print "<font color=\"#00cc00\">SUCCESS</font>\n"; } else { print "SUCCESS\n"; } } else { $fault = $this->result['fault']; if ($fault) { $res = $fault->faultcode; $pos = strpos($res,':'); if ($pos !== false) { $res = substr($res,$pos+1); } if ($html) { print "<font color=\"#ff0000\">FAILED: [$res] {$fault->faultstring}</font>\n"; } else { print "FAILED: [$res] {$fault->faultstring}\n"; } } else { if ($html) { print "<font color=\"#ff0000\">FAILED: ".$this->result['result']."</font>\n"; } else { print "FAILED: ".$this->result['result']."\n"; } } } if ($debug) { if ($html) { echo "<pre>\n".htmlentities($this->result['wire'])."</pre>\n"; } else { echo "\n".htmlentities($this->result['wire'])."\n"; } } }}# XXX I know this isn't quite right, need to deal with this betterfunction make_2d($x, $y){ for ($_x = 0; $_x < $x; $_x++) { for ($_y = 0; $_y < $y; $_y++) { $a[$_x][$_y] = "x{$_x}y{$_y}"; } } return $a;}function soap_value($name, $value, $type, $type_name=NULL, $type_ns=NULL) { return new SoapParam(new SoapVar($value,$type,$type_name,$type_ns),$name);}class SOAPStruct { var $varString; var $varInt; var $varFloat; function SOAPStruct($s, $i, $f) { $this->varString = $s; $this->varInt = $i; $this->varFloat = $f; }}//***********************************************************// Base echoString$soap_tests['base'][] = new SOAP_Test('echoString', array('inputString' => 'hello world!'));$soap_tests['base'][] = new SOAP_Test('echoString', array('inputString' => soap_value('inputString','hello world',XSD_STRING)));$soap_tests['base'][] = new SOAP_Test('echoString(empty)', array('inputString' => ''));$soap_tests['base'][] = new SOAP_Test('echoString(empty)', array('inputString' => soap_value('inputString','',XSD_STRING)));$soap_tests['base'][] = new SOAP_Test('echoString(null)', array('inputString' => NULL));$soap_tests['base'][] = new SOAP_Test('echoString(null)', array('inputString' => soap_value('inputString',NULL,XSD_STRING)));//$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => ">,<,&,\",',0:\x00",1:\x01,2:\x02,3:\x03,4:\x04,5:\x05,6:\x06,7:\x07,8:\x08,9:\x09,10:\x0a,11:\x0b,12:\x0c,13:\x0d,14:\x0e,15:\x0f,16:\x10,17:\x11,18:\x12,19:\x13,20:\x14,21:\x15,22:\x16,23:\x17,24:\x18,25:\x19,26:\x1a,27:\x1b,28:\x1c,29:\x1d,30:\x1e,31:\x1f"));//$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => soap_value('inputString',">,<,&,\",',0:\x00",1:\x01,2:\x02,3:\x03,4:\x04,5:\x05,6:\x06,7:\x07,8:\x08,9:\x09,10:\x0a,11:\x0b,12:\x0c,13:\x0d,14:\x0e,15:\x0f,16:\x10,17:\x11,18:\x12,19:\x13,20:\x14,21:\x15,22:\x16,23:\x17,24:\x18,25:\x19,26:\x1a,27:\x1b,28:\x1c,29:\x1d,30:\x1e,31:\x1f",XSD_STRING)));$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => ">,<,&,\",',\\,\n"));$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => soap_value('inputString',">,<,&,\",',\\,\n",XSD_STRING)));$test = new SOAP_Test('echoString(utf-8)', array('inputString' => utf8_encode('峄椕埫┟趁掆偋鈪溼粭峄
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -