Example #1
0
 function invokeGetReport(MarketplaceWebService_Interface $service, $request)
 {
     try {
         $response = $service->getReport($request);
         return stream_get_contents($request->getReport());
     } catch (MarketplaceWebService_Exception $ex) {
         $message = 'MWS Report API : Caught Exception : ' . $ex->getMessage() . "\n";
         $message .= "Response Status Code: " . $ex->getStatusCode() . "\n";
         $message .= "Error Code: " . $ex->getErrorCode() . "\n";
         $message .= "Error Type: " . $ex->getErrorType() . "\n";
         $param['message'] = $message;
         $this->generate_log($param);
     }
 }
/**
 * Get Report Action Sample
 * The GetReport operation returns the contents of a report. Reports can potentially be
 * very large (>100MB) which is why we only return one report at a time, and in a
 * streaming fashion.
 *   
 * @param MarketplaceWebService_Interface $service instance of MarketplaceWebService_Interface
 * @param mixed $request MarketplaceWebService_Model_GetReport or array of parameters
 */
function invokeGetReport(MarketplaceWebService_Interface $service, $request)
{
    try {
        $response = $service->getReport($request);
        echo "Service Response\n";
        echo "=============================================================================\n";
        echo "        GetReportResponse\n";
        if ($response->isSetGetReportResult()) {
            $getReportResult = $response->getGetReportResult();
            echo "            GetReport";
            if ($getReportResult->isSetContentMd5()) {
                echo "                ContentMd5";
                echo "                " . $getReportResult->getContentMd5() . "\n";
            }
        }
        if ($response->isSetResponseMetadata()) {
            echo "            ResponseMetadata\n";
            $responseMetadata = $response->getResponseMetadata();
            if ($responseMetadata->isSetRequestId()) {
                echo "                RequestId\n";
                echo "                    " . $responseMetadata->getRequestId() . "\n";
            }
        }
        echo "        Report Contents\n";
        echo stream_get_contents($request->getReport()) . "\n";
    } catch (MarketplaceWebService_Exception $ex) {
        echo "Caught Exception: " . $ex->getMessage() . "\n";
        echo "Response Status Code: " . $ex->getStatusCode() . "\n";
        echo "Error Code: " . $ex->getErrorCode() . "\n";
        echo "Error Type: " . $ex->getErrorType() . "\n";
        echo "Request ID: " . $ex->getRequestId() . "\n";
        echo "XML: " . $ex->getXML() . "\n";
    }
}
/**
 * Get Report Action Sample
 * The GetReport operation returns the contents of a report. Reports can potentially be
 * very large (>100MB) which is why we only return one report at a time, and in a
 * streaming fashion.
 *   
 * @param MarketplaceWebService_Interface $service instance of MarketplaceWebService_Interface
 * @param mixed $request MarketplaceWebService_Model_GetReport or array of parameters
 */
function invokeGetReport(MarketplaceWebService_Interface $service, $request)
{
    global $reportId;
    try {
        $response = $service->getReport($request);
        echo "Service Response\n";
        echo "=============================================================================\n";
        echo "        GetReportResponse\n";
        if ($response->isSetGetReportResult()) {
            $getReportResult = $response->getGetReportResult();
            echo "            GetReport";
            if ($getReportResult->isSetContentMd5()) {
                echo "                ContentMd5";
                echo "                " . $getReportResult->getContentMd5() . "\n";
            }
        }
        if ($response->isSetResponseMetadata()) {
            echo "            ResponseMetadata\n";
            $responseMetadata = $response->getResponseMetadata();
            if ($responseMetadata->isSetRequestId()) {
                echo "                RequestId\n";
                echo "                    " . $responseMetadata->getRequestId() . "\n";
            }
        }
        echo "        Report Contents\n";
        // echo (stream_get_contents($request->getReport()) . "\n");
        file_put_contents('/tmp/_GET_FLAT_FILE_ALL_ORDERS_DATA_BY_LAST_UPDATE_' . $reportId . '.txt', stream_get_contents($request->getReport()));
    } catch (MarketplaceWebService_Exception $ex) {
        echo "Caught Exception: " . $ex->getMessage() . "\n";
        echo "Response Status Code: " . $ex->getStatusCode() . "\n";
        echo "Error Code: " . $ex->getErrorCode() . "\n";
        echo "Error Type: " . $ex->getErrorType() . "\n";
        echo "Request ID: " . $ex->getRequestId() . "\n";
        echo "XML: " . $ex->getXML() . "\n";
    }
}
Example #4
0
/**
 * Retrieves and return the actual report.
 *
 * @param MarketplaceWebService_Interface $service instance of MarketplaceWebService_Interface
 * @param mixed $request MarketplaceWebService_Model_GetReport or array of parameters
 * @return string
 */
function Get_Report(MarketplaceWebService_Interface $Service, $Request)
{
    try {
        $Res = $Service->getReport($Request);
        if ($Res->isSetGetReportResult()) {
            $Res = $Res->getGetReportResult();
            if ($Res->isSetContentMd5()) {
                $Res->getContentMd5();
            }
        }
        return stream_get_contents($Request->getReport());
    } catch (MarketplaceWebService_Exception $ex) {
        echo <<<OutEx
<pre>
Function: Get_Report ()
Caught Exception: {$ex->getMessage()}
Response Status Code: {$ex->getStatusCode()}
Error Code: {$ex->getErrorCode()}
Error Type: {$ex->getErrorType()}
Request ID: {$ex->getRequestId()}
XML: {$ex->getXML()}
ResponseHeaderMetadata: {$ex->getResponseHeaderMetadata()}
OutEx;
        die;
    }
}