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 misspell 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.