Example #1
0
         } catch (SoapFault $soapfault) {
             $creditType = null;
         }
         if ($creditType != null) {
             $i = array($item->id, $item->name, $item->description, $item->type, $price, $creditType->name, $item->active, $item->creationdate);
             array_push($formattedInventory, $i);
         }
     }
     //print_r($inventory);
     //print_r($formattedInventory);
     echo json_encode($formattedInventory);
 } else {
     if ($action == "getReferences") {
         try {
             $client = new SoapClient(WSDL_QS, array('location' => LOCATION_QS));
             $references = $client->getAssignableCreditTypes();
             $creditTypes = $references->creditType;
             $policies = $references->policy;
             if (!is_array($policies)) {
                 $policies_arr = array($policies);
             } else {
                 $policies_arr = $policies;
             }
             if (!is_array($creditTypes)) {
                 addPolicyToCreditType($policies_arr, $creditTypes);
                 $result = array('references' => array($creditTypes));
             } else {
                 foreach ($creditTypes as $creditType) {
                     addPolicyToCreditType($policies_arr, $creditType);
                 }
                 $result = array('references' => $creditTypes);