Example #1
0
 public static function callAPIWithClient($client, $header, $soapRequest, $debug)
 {
     global $maxZObjectCount;
     try {
         $client->myRequest = $soapRequest;
         $soapMethod = ZuoraAPIHelper::getMethod($soapRequest);
         // check that we're not trying to create more than the maximum count of objects.
         $createCount = ZuoraAPIHelper::getZObjectCount($soapRequest, $soapMethod);
         if ($soapMethod == "create" && $createCount > $maxZObjectCount) {
             die("\n\nERROR: zObjects maximum count of " . $maxZObjectCount . " exceeded. Actual count found: " . $createCount . ".");
         }
         $timeBefore = microtime(true);
         $result = $client->__soapCall($soapMethod, array(), null, $header);
         $timeAfter = microtime(true);
         //echo "Request: " . $soapRequest . " Duration: " . ($timeAfter - $timeBefore)/60 . " minutes.\n";
         if ($debug) {
             print "\nResult:\n" . ZuoraAPIHelper::xml_pretty_printer($client->myResponse);
             print "\nResponse Time: " . ($timeAfter - $timeBefore);
         }
         return $client->myResponse;
     } catch (Exception $e) {
         throw $e;
     }
 }