PHP

Moderators: None (Apply to moderate this forum)
Number of threads: 1848
Number of posts: 5016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Passing Arrays Of Objects in a Webservice Using PHP Posted by bl651 on 31 Jan 2012 at 11:23 AM
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:
<?php
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:
<?php
include_once('LicenseInformation.class.php');
$wsdl = 'http://fspqs13.fs.cummins.com/services/server/oms?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:
<?php
include_once('LicenseInformation.class.php');

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;
}
}
?>



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.