473,382 Members | 1,657 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

for each\create table\webservice

1
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
Expand|Select|Wrap|Line Numbers
  1.   {
  2.         $wsdl="http://www.domain.com/WebService/WS.asmx?WSDL";
  3.         $client = new nusoapclient($wsdl, true);
  4.         $res = $client->call('GetMemberList', array());
  5.  
  6.         foreach ($hits->GetMemberListResult as $hit) {
  7.           $Company = html_entities($hit->aCompany);
  8.           $CompanyID = html_entities($hit->aCompanyID);
  9.  
  10.     print <<< _HTML_
  11.     <div style="clear:left; width: 300px; padding:5px;
  12.                 margin:5px; background:#ddd;">
  13.  
  14.     <b>$Company</b><br/>
  15.     ID: $CompanyID<br/>
  16.     Price: $hit->aFirstName<br/>
  17.     </div>
  18. _HTML_;
  19. }
  20.  
  21.  
  22.        }
  23.  
  24.  
Expand|Select|Wrap|Line Numbers
  1.   </s:element>
  2.       <s:element name="GetMemberList">
  3.         <s:complexType />
  4.       </s:element>
  5.       <s:element name="GetMemberListResponse">
  6.         <s:complexType>
  7.           <s:sequence>
  8.             <s:element minOccurs="0" maxOccurs="1" name="GetMemberListResult" type="tns:ArrayOfTMemberListRec" />
  9.           </s:sequence>
  10.         </s:complexType>
  11.       </s:element>
  12.       <s:complexType name="ArrayOfTMemberListRec">
  13.         <s:sequence>
  14.           <s:element minOccurs="0" maxOccurs="unbounded" name="TMemberListRec" type="tns:TMemberListRec" />
  15.         </s:sequence>
  16.       </s:complexType>
  17.       <s:complexType name="TMemberListRec">
  18.         <s:sequence>
  19.           <s:element minOccurs="0" maxOccurs="1" name="aContactID" type="s:string" />
  20.           <s:element minOccurs="0" maxOccurs="1" name="aFirstName" type="s:string" />
  21.           <s:element minOccurs="0" maxOccurs="1" name="aLastName" type="s:string" />
  22.           <s:element minOccurs="0" maxOccurs="1" name="aCompany" type="s:string" />
  23.         </s:sequence>
  24.       </s:complexType>
  25.     </s:schema>
Dec 4 '07 #1
1 1571
pbmods
5,821 Expert 4TB
Heya, Gah. Welcome to TSDN!

What's the full text of the error message that you're getting? Unlike .NET, PHP error messages are actually designed to be helpful :)
Dec 23 '07 #2

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.