Jump to content

Returning null when there is data


Ty44ler

Recommended Posts

I have a list of job numbers with data associated with it that is discovered through a SOAP call. I can't seem to get certain job numbers to return data even though there is data associated with it.

 

I did a var_dump and can see the data associated it so there is definitely data there, but it will only return 5 blank spaces. :confused:

 

Here's my code:

$jobnumber = "000037";
$subjobnumber = "KES";

$client = new SoapClient("http://refrigerantcompliance/RefrigerantComplianceService/Service1.asmx?wsdl", array('cache_wsdl' => 0, 'trace' => 1));
$result = $client->GetWorkOrders(array("jobNumber" => "$jobnumber", 'subJobNumber' => "$subjobnumber"));

$orders = $result->GetWorkOrdersResult->WorkOrderDAO;

print "<select name='SRTicket'><option>Please Select One</option>";

foreach($orders as $k=>$v){
        print "<option value=\"".$v->RequestNo."\">".$v->RequestNo."_".$v->Description."</option>";
      }
print "</select><br />";

echo "<pre>";
var_dump($orders);
echo "</pre>";
?>

 

Here's the data from var_dump:

object(stdClass)#918 (7) {
  ["StatusCode"]=>
  string(1) "A"
  ["SRPWOHRID"]=>
  int(5204)
  ["CompanyNumber"]=>
  int(30)
  ["DivisionNumber"]=>
  int(0)
  ["CustomerNumber"]=>
  int(37)
  ["RequestNo"]=>
  int(3363)
  ["Description"]=>
  string(50) "KESSLER ELEMENTARY SCHOOL - CHILLER DOWN          "
}

 

 

I've attached a screenshot with the blanks in the dropdown and the data from the var_dump

 

Thanks for your help in advance!

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/208582-returning-null-when-there-is-data/
Share on other sites

$client = new SoapClient("http://refrigerantcompliance/RefrigerantComplianceService/Service1.asmx?wsdl", array('cache_wsdl' => 0, 'trace' => 1));
$result = $client->GetWorkOrders(array("jobNumber" => "$jobnumber", 'subJobNumber' => "$subjobnumber"));

$orders = $result->GetWorkOrdersResult->WorkOrderDAO;
if(!is_array($orders)) {
  $orders = array($orders);
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.