Creating object/array to method in request based on __gettypes in PHP
Posted
by
LochNess
on Stack Overflow
See other posts from Stack Overflow
or by LochNess
Published on 2011-01-03T22:51:33Z
Indexed on
2011/01/03
22:53 UTC
Read the original article
Hit count: 210
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.
© Stack Overflow or respective owner