1--TEST-- 2SOAP handling of <any> 3--SKIPIF-- 4<?php require_once('skipif.inc'); ?> 5--INI-- 6precision=14 7soap.wsdl_cache_enabled=0 8--FILE-- 9<?php 10class SOAPComplexType { 11 function __construct($s, $i, $f) { 12 $this->varString = $s; 13 $this->varInt = $i; 14 $this->varFloat = $f; 15 } 16} 17$struct = new SOAPComplexType('arg',34,325.325); 18 19function echoAnyElement($x) { 20 global $g; 21 22 $g = $x; 23 $struct = $x->inputAny->any["SOAPComplexType"]; 24 if ($struct instanceof SOAPComplexType) { 25 return array("return" => array("any" => array("SOAPComplexType"=>new SoapVar($struct, SOAP_ENC_OBJECT, "SOAPComplexType", "http://soapinterop.org/xsd", "SOAPComplexType", "http://soapinterop.org/")))); 26 } else { 27 return "?"; 28 } 29} 30 31class TestSoapClient extends SoapClient { 32 function __construct($wsdl, $options) { 33 parent::__construct($wsdl, $options); 34 $this->server = new SoapServer($wsdl, $options); 35 $this->server->addFunction('echoAnyElement'); 36 } 37 38 function __doRequest($request, $location, $action, $version, $one_way = 0) { 39 ob_start(); 40 $this->server->handle($request); 41 $response = ob_get_contents(); 42 ob_end_clean(); 43 return $response; 44 } 45} 46 47$client = new TestSoapClient(dirname(__FILE__)."/interop/Round4/GroupI/round4_groupI_xsd.wsdl", 48 array("trace"=>1,"exceptions"=>0, 49 'classmap' => array('SOAPComplexType'=>'SOAPComplexType'))); 50$ret = $client->echoAnyElement( 51 array( 52 "inputAny"=>array( 53 "any"=>new SoapVar($struct, SOAP_ENC_OBJECT, "SOAPComplexType", "http://soapinterop.org/xsd", "SOAPComplexType", "http://soapinterop.org/") 54 ))); 55var_dump($g); 56var_dump($ret); 57?> 58--EXPECT-- 59object(stdClass)#5 (1) { 60 ["inputAny"]=> 61 object(stdClass)#6 (1) { 62 ["any"]=> 63 array(1) { 64 ["SOAPComplexType"]=> 65 object(SOAPComplexType)#7 (3) { 66 ["varInt"]=> 67 int(34) 68 ["varString"]=> 69 string(3) "arg" 70 ["varFloat"]=> 71 float(325.325) 72 } 73 } 74 } 75} 76object(stdClass)#8 (1) { 77 ["return"]=> 78 object(stdClass)#9 (1) { 79 ["any"]=> 80 array(1) { 81 ["SOAPComplexType"]=> 82 object(SOAPComplexType)#10 (3) { 83 ["varInt"]=> 84 int(34) 85 ["varString"]=> 86 string(3) "arg" 87 ["varFloat"]=> 88 float(325.325) 89 } 90 } 91 } 92} 93