I made a web service with ASP.NET WorkFlow Foundation and I want to consume it with PHP. I used EasyWSDL2PHP to generated the php reference file for calling the web service. Here is a sample of an UpdateObject method:
function UpdateObject($UpdateObject)
{
$int = $this->soapClient->UpdateObject($UpdateObject);
return $int;
}
So I can call this method with an $UpdateObject
object which is defined in another place of the ref. file:
class UpdateObject{
var $objList;//ArrayOfObjectStore
var $by;//string
var $dt;//string
}
The $objList
is a List of ObjectStore which I have defined in .NET. The ref class file has also describe it like this:
class ArrayOfObjectStore{
var $ObjectStore;//ObjectStore
}
And of course the ObjectStore is an object with some properties like this:
class ObjectStore{
var $category;//string
var $code;//string
var $create_by;//string
var $create_datetime;//dateTime
var $description;//string
var $modify_by;//string
var $modify_datetime;//dateTime
var $name;//string
}
For you reference, the signature of this method in .NET is :
Public Function UpdateObject(objList As List(Of ObjectStore),
by As String, dt As String) As Integer
OK. I tried to call the web service by having one ObjectStore object in the list and it works good. However I don't know how to put more than one object into the list.
For your reference, here is how I make the call successfully with 1 object in the list:
$test = new MyClass();
$obj = new ObjectStore();
$obj->category = 'test';
$obj->code = 'test';
$obj->description='test';
$obj->modify_by='test';
$obj->name='test';
$obj->sys_abbr='test';
$obj->sys_code='test';
$objList = new ArrayOfObjectStore();
$objList->ObjectStore = $obj;
$updateObj = new UpdateObject();
$updateObj->objList = $array;
$updateObj->by = 'test';
$updateObj->dt = '2014-2-22 22:22:22';
$result = $test->UpdateObject($updateObj);
echo $result;
How do I make multiple objects into the list? I have tried array_push()
and $updateObj->objList->append()
but they both not working. Please give me some suggestion. Thank you for your help.