cvs: pear /SOAP Parser.php /SOAP/interop client_params.php client_round2_base.php /SOAP/test 5.2.1.simpletypes.multiref.php test.utility.php

From: Date: Mon, 25 Feb 2002 06:14:33 +0000
Subject: cvs: pear /SOAP Parser.php /SOAP/interop client_params.php client_round2_base.php /SOAP/test 5.2.1.simpletypes.multiref.php test.utility.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-2608@lists.php.net to get a copy of this message
shane Mon Feb 25 01:14:33 2002 EDT Modified files: /pear/SOAP Parser.php /pear/SOAP/interop client_params.php client_round2_base.php /pear/SOAP/test 5.2.1.simpletypes.multiref.php test.utility.php Log: more multi-reference work interop test tweaking for functions that do not echo exactly what we send result, we now pass GroupB tests pretty well.

Index: pear/SOAP/Parser.php diff -u pear/SOAP/Parser.php:1.4 pear/SOAP/Parser.php:1.5 --- pear/SOAP/Parser.php:1.4 Mon Feb 25 00:06:36 2002 +++ pear/SOAP/Parser.php Mon Feb 25 01:14:32 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Parser.php,v 1.4 2002/02/25 05:06:36 shane Exp $ +// $Id: Parser.php,v 1.5 2002/02/25 06:14:32 shane Exp $ // require_once("SOAP/globals.php"); require_once("SOAP/Value.php"); @@ -29,7 +29,7 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Parser.php,v 1.4 2002/02/25 05:06:36 shane Exp $ +* @version $Id: Parser.php,v 1.5 2002/02/25 06:14:32 shane Exp $ * @package SOAP::Parser * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -53,12 +53,14 @@ var $previous_element = ""; var $soapresponse = NULL; var $parent = 0; - var $root_struct_name = ""; + var $root_struct_name = array(); + var $curent_root_struct_name = ""; var $entities = array ( "&" => "&amp;", "<" => "&lt;", ">" => "&gt;", "'" => "&apos;", '"' => "&quot;" ); var $xml = ""; var $xml_encoding = ""; - var $root_struct = ""; + var $root_struct = array(); + var $curent_root_struct = 0; var $references = array(); var $need_references = array(); var $XMLSchemaVersion; @@ -97,7 +99,7 @@ $this->fault = true; } else { // get final value - $this->soapresponse = $this->buildResponse($this->root_struct); + $this->soapresponse = $this->buildResponse($this->root_struct[0]); } xml_parser_free($parser); } else { @@ -221,11 +223,11 @@ $this->status = "method"; if ($can_root) { if (strpos($name,":") !== false) { - $this->root_struct_name = substr(strrchr($name,":"),1); + $this->root_struct_name[] = $this->curent_root_struct_name = substr(strrchr($name,":"),1); } else { - $this->root_struct_name = $name; + $this->root_struct_name[] = $this->curent_root_struct_name = $name; } - $this->root_struct = $pos; + $this->root_struct[] = $this->curent_root_struct = $pos; $this->message[$pos]["type"] = "struct"; } } @@ -254,7 +256,7 @@ } $this->namespaces[substr(strrchr($key,":"),1)] = $value; // set method namespace - if ($name == $this->root_struct_name) { + if ($name == $this->curent_root_struct_name) { $this->methodNamespace = $value; } // if it's a type declaration, set type @@ -321,7 +323,7 @@ } // set eval str start if it has a valid type and is inside the method - if ($pos >= $this->root_struct) { + if ($pos >= $this->curent_root_struct) { $this->message[$pos]["inval"] = "true"; } @@ -330,7 +332,7 @@ $this->message[$pos]["inval"] == "false"; } // if tag we are currently closing is the method wrapper - if ($pos == $this->root_struct) { + if ($pos == $this->curent_root_struct) { $this->status = "body"; } elseif (stristr($name,":Body")) { $this->status = "header"; Index: pear/SOAP/interop/client_params.php diff -u pear/SOAP/interop/client_params.php:1.2 pear/SOAP/interop/client_params.php:1.3 --- pear/SOAP/interop/client_params.php:1.2 Mon Feb 25 00:06:37 2002 +++ pear/SOAP/interop/client_params.php Mon Feb 25 01:14:33 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: client_params.php,v 1.2 2002/02/25 05:06:37 shane Exp $ +// $Id: client_params.php,v 1.3 2002/02/25 06:14:33 shane Exp $ // require_once("SOAP/Value.php"); @@ -134,6 +134,13 @@ new SOAP_Value("varFloat","float",325.325) ) ); +$method_expect["echoStructAsSimpleTypes"] = + array( + "outputString"=>"arg", + "outputInteger"=>34, + "outputFloat"=>325.325 + ); + $method_params["GroupB"]['php']["echoSimpleTypesAsStruct"] = array( "inputString"=>"arg", @@ -146,6 +153,12 @@ new SOAP_Value("inputInteger","int",34), new SOAP_Value("inputFloat","float",325.325) ); +$method_expect["echoSimpleTypesAsStruct"] = + array( + "varString"=>"arg", + "varInt"=>34, + "varFloat"=>325.325 + ); # XXX I know this isn't quite right, need to deal with this better function make_2d($x, $y) Index: pear/SOAP/interop/client_round2_base.php diff -u pear/SOAP/interop/client_round2_base.php:1.6 pear/SOAP/interop/client_round2_base.php:1.7 --- pear/SOAP/interop/client_round2_base.php:1.6 Mon Feb 25 00:11:06 2002 +++ pear/SOAP/interop/client_round2_base.php Mon Feb 25 01:14:33 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: client_round2_base.php,v 1.6 2002/02/25 05:11:06 shane Exp $ +// $Id: client_round2_base.php,v 1.7 2002/02/25 06:14:33 shane Exp $ // require_once("SOAP/Client.php"); require_once("client_params.php"); @@ -26,14 +26,14 @@ error_reporting(E_ALL ^ E_NOTICE); $localonly = 0; // set to 1 to test only your local server -$usebuiltin = 1; // use builtin list of endpoints +$usebuiltin = 0; // use builtin list of endpoints $test = 'GroupB'; // which test to do: base, GroupB, GroupC $parm = 'soapval'; // use base types: php, soapval $show = 1; $debug = 0; $numservers = 0; // zero for all of them $testfunc = ""; // test a single function -$specificendpoint = "http://soap.4s4c.com/ilab/soap.asp"; //"http://63.142.188.184:1122/"; // endpoint url +$specificendpoint = ""; //"http://63.142.188.184:1122/"; // endpoint url if ($localonly) { # define your test servers endpointURL here @@ -65,11 +65,13 @@ if ($localonly || $usebuiltin || getInteropEndpoints($test) ) { + print "Got ".count($endpoints)." endpoints\n"; do_interopTest($method_params[$test][$parm], $testfunc, $numservers); } function getInteropEndpoints($base = "base") { global $endpoints; + $endpoints = array(); // get other interop endpoints $soapclient = new SOAP_Client("http://www.whitemesa.net/interopInfo"); if($endpointArray = $soapclient->call("GetEndpointInfo",array("groupName"=>$base),"http://soapinterop.org/info/","http://soapinterop.org/info/")){ @@ -104,8 +106,22 @@ return $val; } +function test_result($expect, $result) +{ + $ok = 0; + $expect_type = gettype($expect); + $result_type = gettype($result); + if ($expect_type == "array" && $result_type == "array") { + # compare arrays + $ok = array_compare($expect, $result); + } else { + $ok = string_compare($expect, $result); + } + return $ok; +} + function do_endpoint_method($endpoint, $method, $method_params, $show = 0, $debug = 0) { - global $endpoints; + global $endpoints, $method_expect; $success = FALSE; if ($debug) $show = 1; @@ -138,14 +154,9 @@ # we need to decode what we sent so we can compare! $sent = decode_soapval($sent); - $ok = 0; - $sent_type = gettype($sent); - $return_type = gettype($return); - if ($sent_type == "array" && $return_type == "array") { - # compare arrays - $ok = array_compare($sent, $return); - } else { - $ok = string_compare($sent, $return); + $ok = test_result($sent,$return); + if (!$ok && array_key_exists($method,$method_expect)) { + $ok = test_result($method_expect[$method],$return); } if($ok){ @@ -161,6 +172,10 @@ print_r($sent); print "]<br>\nRECEIVED: ["; print_r($return); + if (array_key_exists($method,$method_expect)) { + print "]<br>\nEXPECTED: ["; + print_r($method_expect[$method]); + } print "]<br></pre>\n"; } } Index: pear/SOAP/test/5.2.1.simpletypes.multiref.php diff -u pear/SOAP/test/5.2.1.simpletypes.multiref.php:1.1 pear/SOAP/test/5.2.1.simpletypes.multiref.php:1.2 --- pear/SOAP/test/5.2.1.simpletypes.multiref.php:1.1 Sun Feb 24 21:55:13 2002 +++ pear/SOAP/test/5.2.1.simpletypes.multiref.php Mon Feb 25 01:14:33 2002 @@ -70,4 +70,40 @@ print "$prefix Forward Reference root decode FAILED\n"; } +$msg = '<?xml version="1.0"?> + +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> +<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:NS2="http://soapinterop.org/xsd"> +<NS1:echoNestedStructResponse xmlns:NS1="http://soapinterop.org/"> +<return href="#1"/> +</NS1:echoNestedStructResponse> +<NS2:SOAPStructStruct id="1" xsi:type="NS2:SOAPStructStruct"> +<varString xsi:type="xsd:string"> +arg</varString> +<varInt xsi:type="xsd:int"> +34</varInt> +<varFloat xsi:type="xsd:float"> +325.325012207031</varFloat> +<varStruct href="#2"/> +</NS2:SOAPStructStruct> +<varStruct id="2" xsi:type="NS2:SOAPStruct"> +<varString xsi:type="xsd:string"> +arg</varString> +<varInt xsi:type="xsd:int"> +34</varInt> +<varFloat xsi:type="xsd:float"> +325.325012207031</varFloat> +</varStruct> +</SOAP-ENV:Body> +</SOAP-ENV:Envelope> +'; + +$expect = array('varString' => 'arg', 'varInt' => 34, 'varFloat' => 325.325, 'varStruct' => array('varString' => 'arg', 'varInt' => 34, 'varFloat' => 325.325)); +$val = parseMessage($msg); +if (array_compare($val, $expect)) { + print "$prefix Forward Reference root decode OK\n"; +} else { + print "$prefix Forward Reference root decode FAILED\n"; +} + ?> Index: pear/SOAP/test/test.utility.php diff -u pear/SOAP/test/test.utility.php:1.1 pear/SOAP/test/test.utility.php:1.2 --- pear/SOAP/test/test.utility.php:1.1 Sun Feb 24 21:55:13 2002 +++ pear/SOAP/test/test.utility.php Mon Feb 25 01:14:33 2002 @@ -36,6 +36,7 @@ { if (gettype($ar1) != 'array' || gettype($ar2) != 'array') return FALSE; # first a shallow diff + if (count($ar1) != count($ar2)) return FALSE; $diff = array_diff($ar1, $ar2); if (count($diff) == 0) return TRUE;
« previous php.pear.cvs (#2608) next »