I am getting an array of records from an asp.net webservice and wanting to display them in a dynamically created html table in the php page. I am new to php and not sure how to get the values from the array. I get an “invalid argument error in for each” error message. If I run the program and inspect the $res, I can see all the records in the TMemberListRec. I tried to use TMemberListRec in the for each to access them, but still get an error. Below is my php code and below that is the xml from the webservice. Can someone help me out with the code? If I want to password protect the webservice how do I pass the userid and passord to the webservice?
TIA
{
$wsdl=“http://www.domain.com/WebService/WS.asmx?WSDL”;
$client = new nusoapclient($wsdl, true);
$res = $client->call(‘GetMemberList’, array());
foreach ($hits->GetMemberListResult as $hit) {
$Company = html_entities($hit->aCompany);
$CompanyID = html_entities($hit->aCompanyID);
print <<< HTML
$Company
ID: $CompanyID
Price: $hit->aFirstName
}
</s:element>
<s:element name=“GetMemberList”>
<s:complexType />
</s:element>
<s:element name=“GetMemberListResponse”>
<s:complexType>
<s:sequence>
<s:element minOccurs=“0” maxOccurs=“1” name=“GetMemberListResult” type=“tns:ArrayOfTMemberListRec” />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name=“ArrayOfTMemberListRec”>
<s:sequence>
<s:element minOccurs=“0” maxOccurs=“unbounded” name=“TMemberListRec” type=“tns:TMemberListRec” />
</s:sequence>
</s:complexType>
<s:complexType name=“TMemberListRec”>
<s:sequence>
<s:element minOccurs=“0” maxOccurs=“1” name=“aContactID” type=“s:string” />
<s:element minOccurs=“0” maxOccurs=“1” name=“aFirstName” type=“s:string” />
<s:element minOccurs=“0” maxOccurs=“1” name=“aLastName” type=“s:string” />
<s:element minOccurs=“0” maxOccurs=“1” name=“aCompany” type=“s:string” />
</s:sequence>
</s:complexType>
</s:schema>