I’m just trying to make a SOAP call that passes one parameter (customerNumber) and prints a dropdown box, but it’s giving me an error in my source code.
[quote]
Error: Warning: Invalid argument supplied for foreach() in webservice.php on line 23
[code=php]<?
$client = new SoapClient(“http://refrigerantcompliance/RefrigerantComplianceService/Service1.asmx?wsdl”, array(‘cache_wsdl’ => 0));
$params = array(‘customerNumber’=>’2′);
$client->__soapCall(“GetWorkOrders”, $params);
$array = $result->GetWorkOrdersResult->WorkOrderDAO;
print “<select name=’CustomerName’><option>Please Select One</option>”;
foreach($array as $k=>$v){
print “<option value=””.$v->SRPWOHRID.””>”.$v->SRPWOHRID.”</option>”;
}
print “</select><br />”;
?>
WSDL File:
[code]POST /RefrigerantComplianceService/Service1.asmx HTTP/1.1
Host: refrigerantcompliance
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version=”1.0″ encoding=”utf-8″?>
<soap12:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:soap12=”http://www.w3.org/2003/05/soap-envelope”>
<soap12:Body>
<GetWorkOrders xmlns=”http://tempuri.org/”>
<customerNumber>string</customerNumber>
</GetWorkOrders>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version=”1.0″ encoding=”utf-8″?>
<soap12:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:soap12=”http://www.w3.org/2003/05/soap-envelope”>
<soap12:Body>
<GetWorkOrdersResponse xmlns=”http://tempuri.org/”>
<GetWorkOrdersResult>
<WorkOrderDAO>
<StatusCode>string</StatusCode>
<SRPWOHRID>int</SRPWOHRID>
<CompanyNumber>int</CompanyNumber>
<DivisionNumber>int</DivisionNumber>
<CustomerNumber>int</CustomerNumber>
<RequestNo>int</RequestNo>
<RequestorName>string</RequestorName>
<AreaCode>string</AreaCode>
<PhoneNo>string</PhoneNo>
<Address1>string</Address1>
<Address2>string</Address2>
<City>string</City>
<StateCode>string</StateCode>
<ZipCode>string</ZipCode>
<RequestType>string</RequestType>
<CustomerPONumber>string</CustomerPONumber>
<Description>string</Description>
</WorkOrderDAO>
<WorkOrderDAO>
<StatusCode>string</StatusCode>
<SRPWOHRID>int</SRPWOHRID>
<CompanyNumber>int</CompanyNumber>
<DivisionNumber>int</DivisionNumber>
<CustomerNumber>int</CustomerNumber>
<RequestNo>int</RequestNo>
<RequestorName>string</RequestorName>
<AreaCode>string</AreaCode>
<PhoneNo>string</PhoneNo>
<Address1>string</Address1>
<Address2>string</Address2>
<City>string</City>
<StateCode>string</StateCode>
<ZipCode>string</ZipCode>
<RequestType>string</RequestType>
<CustomerPONumber>string</CustomerPONumber>
<Description>string</Description>
</WorkOrderDAO>
</GetWorkOrdersResult>
</GetWorkOrdersResponse>
</soap12:Body>
</soap12:Envelope>