I have created the following custom class in PHP:
<?php
class myClass
{
public $property1;
public $property2;
}
?>
I have a NuSoap Webservice that I want to use to return an array of these objects in XML format. I have built the following function to return the data:
foreach($response->return->object as $object)
{
$returnObject = new $myClass;
$returnObject->property1 = $object->property1;
$returnObject->property2 = $object->property2;
array_push($returnObjects, $returnObject);
}
}
$result = array_unique($returnObjects);
if (count($result) != 0){
return $result;}
When I run the method, I get the following error:
Object of class MyClass could not be converted to string
Any assistance would be greatly appreciated! Thanks in advance.
This post ended up being my solution:
Notice Array to string conversion using nusoap
Evidently there is a debugging conversion that breaks when you use complex data types. Luckily line 6132 can be commented out in the NuSoap.php without causing any issues.