Example #1
0
                $uniqueHeaders = ZuoraAPIHelper::getCSVHeaders($xml_obj);

	        ZuoraAPIHelper::getCSVData($xml_obj, $uniqueHeaders, true, true);
       	    } else {
       	    	$responseString = xml_pretty_printer($xml, true);
       	    }

	    $queryLocator = ZuoraAPIHelper::getQueryLocator($xml);
	    while ($outputQM && $queryLocator) {
	        $payload = "<ns1:queryMore><ns1:queryLocator>" . $queryLocator . "</ns1:queryLocator></ns1:queryMore>";
       	    	$soapRequest = ZuoraAPIHelper::createRequestAndHeadersWithNS($header->data["session"], $_SESSION['api-batchSize'], $callOptions, $payload, $_SESSION['api-ns'], $_SESSION['object-ns']);

                $timeBefore = microtime(true);
	    	$xml = ZuoraAPIHelper::callAPIWithClient($client, $header, $soapRequest, $debug);
                $timings[] = microtime(true) - $timeBefore;
	        $queryLocator = ZuoraAPIHelper::getQueryLocator($xml);

       	    	if ($outputCSV) {
	    	    $xml_obj = ZuoraAPIHelper::getElementFromXML($xml);
		    ZuoraAPIHelper::getCSVData($xml_obj, $uniqueHeaders, true, false);
       	    	} else {
       	    	    $responseString .= "\n" . xml_pretty_printer($xml, true);
       	    	    $requestString .= "\n" . xml_pretty_printer($soapRequest, true);
       	    	}
	    }
       	    if ($outputCSV) {
	        exit;
            }
       	} catch (Exception $e) {
       	   $errorString = $e->getMessage();
       	}
Example #2
0
 public static function queryMoreAPIWithSession($body, $debug, $wsdl = "", $username = "", $password = "")
 {
     global $defaultApiNamespace;
     global $defaultApiNamespaceURL;
     $resultRecords = array();
     $payload = "<ns1:query><ns1:queryString>" . $body . "</ns1:queryString></ns1:query>";
     if (strlen($wsdl) > 0) {
         ZuoraAPIHelper::checkLogin($wsdl, $username, $password, $debug);
     }
     $xml = ZuoraAPIHelper::callAPIWithSession($payload, $debug);
     $queryLocator = ZuoraAPIHelper::getQueryLocator($xml);
     $xml_obj = new SimpleXMLElement($xml);
     $xml_obj->registerXPathNamespace($defaultApiNamespace, $defaultApiNamespaceURL);
     $records = $xml_obj->xpath("//" . $defaultApiNamespace . ":records");
     foreach ($records as $record) {
         $resultRecords[] = $record;
     }
     while ($queryLocator) {
         $payload = "<ns1:queryMore><ns1:queryLocator>" . $queryLocator . "</ns1:queryLocator></ns1:queryMore>";
         if (strlen($wsdl) > 0) {
             ZuoraAPIHelper::checkLogin($wsdl, $username, $password, $debug);
         }
         $xml = ZuoraAPIHelper::callAPIWithSession($payload, $debug);
         $queryLocator = ZuoraAPIHelper::getQueryLocator($xml);
         $xml_obj = new SimpleXMLElement($xml);
         $xml_obj->registerXPathNamespace($defaultApiNamespace, $defaultApiNamespaceURL);
         $records = $xml_obj->xpath("//" . $defaultApiNamespace . ":records");
         foreach ($records as $record) {
             $resultRecords[] = $record;
         }
     }
     return $resultRecords;
 }