I am testing an sample API on Amazon MWS API for PHP. as i run the codes in the GetMyPriceForASIN sample it does not return any response even an error response.
function test1(MarketplaceWebServiceProducts_Interface $service1, $request2){
try {
$response1 = $service1->GetMyPriceForASIN($request2);
$dom1 = new DOMDocument();
$dom1->loadXML($response->toXML());
$dom1->preserveWhiteSpace = false;
$dom1->formatOutput = true;
$xml2 = $dom1->saveXML();
$xml_obj = new SimpleXMLElement($x);
} catch (MarketplaceWebServiceProducts_Exception $ex1) {
echo("Caught Exception: " . $ex1->getMessage() . "\n");
echo("Response Status Code: " . $ex->getStatusCode() . "\n");
echo("Error Code: " . $ex1->getErrorCode() . "\n");
echo("Error Type: " . $ex1->getErrorType() . "\n");
echo("Request ID: " . $ex1->getRequestId() . "\n");
echo("XML: " . $ex1->getXML() . "\n");
echo("ResponseHeaderMetadata: " . $ex1->getResponseHeaderMetadata() . "\n");
}
}
as I try to debug it myself I have been stuck until this set of codes
public function getMyPriceForASIN($request){
if (!($request instanceof MarketplaceWebServiceProducts_Model_GetMyPriceForASINRequest)) {
require_once (dirname(__FILE__) . '/Model/GetMyPriceForASINRequest.php');
$request = new MarketplaceWebServiceProducts_Model_GetMyPriceForASINRequest($request);
}
$parameters = $request->toQueryParameterArray();
$parameters['Action'] = 'GetMyPriceForASIN';
$httpResponse = $this->_invoke($parameters);
require_once (dirname(__FILE__) . '/Model/GetMyPriceForASINResponse.php');
$response = MarketplaceWebServiceProducts_Model_GetMyPriceForASINResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
}
on this code I encountered an error
$parameters = $request->toQueryParameterArray();
it does not return any array and i dont know where to find the function. I also wonder that it might be that my ASIN list format was wrong, this is the format.
ASINList.ASIN.0.=000001ASS&ASINList.ASIN.1.=B00002YHY&ASINList.ASIN.2.=B01112Z4VW
I already look into the Amazon developer guide but I did not find anything. I hope someone can help me with this. thanks.
Aucun commentaire:
Enregistrer un commentaire