note 59859 deleted from ref.soap by aidan

From: Date: Sun, 25 Dec 2005 02:41:26 +0000
Subject: note 59859 deleted from ref.soap by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-100675@lists.php.net to get a copy of this message
Note Submitter: Rui Martins ---- Here's an example on how to pass ArrayOfAnyType arguments containing complex types. Suppose your WSDL file defines "http://any.url.com/" as the default namespace and a complex type "SomeComplexType". If you want to call a WebServices which takes an ArrayOfAnyType argument of "SomeComplexType"s you need to perform the following: <?php // complexTypes being an array containing several instances of SomeComplexType myWSParameter = array(); foreach (complexTypes as ct) { // Don't mispell the type or the namespace. Also note that php won't assume the default namespace defined in the WSDL file. myWSParameter []= new SoapVar(ct, 0, "SomeComplexType", "http://any.url.com/"); } ?> On the other hand, when a WebService returns an ArrayOfAnyType you have to do the following to access each of its elements. <?php // Here, we will be echoing each return item $res = $someWS->myFunction($myArgs) // If only one element is returned, an array won't be built if (is_array(myFunctionResult->anyType)) { foreach (myFunctionResult->anyType as $soapVar) { echo $soapVar->enc_value; } } else { echo myFunctionResult->anyType->enc_value; } ?> This has all been tested using a .NET WebService.

« previous php.notes (#100675) next »