Passing Arrays Of Objects in a Webservice Using PHP - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Passing Arrays Of Objects in a Webservice Using PHP

bl651bl651 Posts: 2Member
Any help on this problem would be much appreciated as I'm out of ideas. Basically, I need to pass an array of objects from the client php page to the web service. Whenever I try this I get the following error: Object of class stdClass could not be converted to string.
I stripped out all of the code that's not relevant to the problem. Basically, I just need to know how to get the array of objects passed correctly to php server page.

Here's the code I have.

First, here's the class I'm using for the object:
class LicenseInformation {
public $AssigneeId;
public $ToolVersion;
public $Count;
public $Duration;
public $AutoRenewal;
public $IsFloating;

Next, here's the client php with only the relevant code in it:
$wsdl = '';
$client = new SoapClient($wsdl, array('trace'=>true));

$count = 0;
$License = new LicenseInformation();
$License->AssigneeId = 'bl651';
$License->Count = '4';
$Licenses[] = $License;

try {
$result = $client->CreateOrder('bl651', 'INSITE', $Licenses, 1);
} catch (SoapFault $e) {
$result = new stdClass;
$result->Return_Code = '2';
$result->Return_Message = $e->getMessage();
$result->SoapFault = TRUE;
echo $result;

Finally, here's the service side php page with only the relevant code:

class EtoService {
* Creates New ETO Licenses.
* @param string $RequesterId
* @param string $ToolName
* @param LicenseInformation[] LicenseOrders
* @param int $RecordCount
* @return string
public function CreateOrder($RequesterId, $ToolName,$LicenseOrders, $RecordCount) {
for ($i = 0; $i <= $RecordCount; $i++) {
$AssigneeId = $LicenseOrders[$i]->AssigneeId;
$Count = $LicenseOrders[$i]->Count;
Sign In or Register to comment.