Creating object/array to method in request based on __gettypes in PHP
- by LochNess
I'm having trouble with the array or object that should be passed based on the response from __gettypes.
The __gettypes response:
[0] => struct CDataWrapper { schema;any; }
[1] => struct NewMember { MemberDetail MemberDetails;ArrayOfHobby Hobbies; }
[2] => struct MemberDetail { string Name; string Age; string Sex; }
[3] => struct ArrayOfHobby { Hobby Hobby; }
[4] => struct Hobby { string Name; string HoursUsedOnHobbyWeekly;boolean Favourite; }
... etc.
The methods are:
[0] => ReceiveMemberResponse ReceiveMember(ReceiveMember $parameters)
[1] => ReturnMemberResponse ReturnMember(ReturnMember $parameters)
So far I have this PHP:
$client = new SoapClient('http://domain.com?wsdl');
class MemberDetail
{
public $Name = '';
public $Age = '';
public $Sex = '';
}
$mc = new MemberDetail();
$mc->Name= 'Bob';
$mc->Age= '14';
$mc->Sex= 'Male';
$myParam = array('ReceiveMember'=>$mc);
$wcf = $client->ReceiveMember($myParam);
$wcfResult = $wcf->ReturnMember;
print_r($wcfResult)
when i call the page it returns:
Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.
I'm not really sure how to create the array or object to pass on as $myParam since im no expert with PHP either.