xml — странный ответ от API Amazon Marketplace с использованием их библиотеки PHP

каждый. Я здесь абсолютный любитель, поэтому, пожалуйста, потерпите меня, я был бы признателен за любую помощь. Я пытаюсь работать с Amazon MWS API, используя их клиентскую библиотеку PHP. После нескольких настроек я успешно получил ответ от сервера. Ответ должен быть просто немного XML, но текст ответа — это нечто другое. Похоже, что xml ответа был преобразован в массив тегов, но ни одно из значений не присутствует. Я удалил код, который был предоставлен с библиотекой, чтобы напечатать только xml ответа, и он все еще отображает следующий текст. Это только верхняя часть текста, но это должно сработать. Если бы кто-то мог сказать мне, почему ответ находится в этом массиве без значений элементов XML, я был бы очень признателен за это.

Спасибо за ваше время.

MarketplaceWebServiceProducts_Model_GetMyPriceForSKUResponse Object ( [_fields:protected] => Array ( [GetMyPriceForSKUResult] => Array ( [FieldValue] => Array ( [0] => MarketplaceWebServiceProducts_Model_GetMyPriceForSKUResult Object ( [_fields:protected] => Array ( [Product] => Array ( [FieldValue] => MarketplaceWebServiceProducts_Model_Product Object ( [_fields:protected] => Array ( [Identifiers] => Array ( [FieldValue] => MarketplaceWebServiceProducts_Model_IdentifierType Object ( [_fields:protected] => Array ( [MarketplaceASIN] => Array ( [FieldValue] => MarketplaceWebServiceProducts_Model_ASINIdentifier Object ( [_fields:protected] => Array ( [MarketplaceId] => Array ( [FieldValue] => String [FieldType] => string ) [ASIN] => Array ( [FieldValue] => String [FieldType] => string ) ) ) [FieldType] => MarketplaceWebServiceProducts_Model_ASINIdentifier ) [SKUIdentifier] => Array ( [FieldValue] => MarketplaceWebServiceProducts_Model_SellerSKUIdentifier Object ( [_fields:protected] => Array ( [MarketplaceId] => Array ( [FieldValue] => String [FieldType] => string ) [SellerId] => Array ( [FieldValue] => String [FieldType] => string ) [SellerSKU] => Array ( [FieldValue] => String [FieldType] => string ) ) ) [FieldType] => MarketplaceWebServiceProducts_Model_SellerSKUIdentifier ) ) ) [FieldType] => MarketplaceWebServiceProducts_Model_IdentifierType ) [AttributeSets] => Array ( [FieldValue] => MarketplaceWebServiceProducts_Model_AttributeSetList Object ( [_fields:protected] => Array ( [Any] => Array ( [FieldValue] => Array ( [0] => DOMText Object ( [wholeText] => [data] => [length] => 17 [nodeName] => #text [nodeValue] => [nodeType] => 3 [parentNode] => (object value omitted) [childNodes] => [firstChild] => [lastChild] => [previousSibling] => [nextSibling] => (object value omitted) [attributes] => [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => [baseURI] => file:/C:/xampp/htdocs/mwsclient/src/MarketplaceWebServiceProducts/Samples/ [textContent] => ) [1] => DOMElement Object ( [tagName] => Any [schemaTypeInfo] => [nodeName] => Any [nodeValue] => [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted) [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => http://mws.amazonservices.com/schema/Products/2011-10-01 [prefix] => [localName] => Any [baseURI] => file:/C:/xampp/htdocs/mwsclient/src/MarketplaceWebServiceProducts/Samples/ [textContent] => ) [2] => DOMText Object ( [wholeText] => [data] => [length] => 13 [nodeName] => #text [nodeValue] => [nodeType] => 3 [parentNode] => (object value omitted) [childNodes] => [firstChild] => [lastChild] => [previousSibling] => (object value omitted) [nextSibling] => [attributes] => [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => [baseURI] => file:/C:/xampp/htdocs/mwsclient/src/MarketplaceWebServiceProducts/Samples/ [textContent] => ) ) [FieldType] => Array ( [0] => object ) ) ) ) [FieldType] => MarketplaceWebServiceProducts_Model_AttributeSetList ) [Relationships] => Array ( [FieldValue] => MarketplaceWebServiceProducts_Model_RelationshipList Object ( [_fields:protected] => Array ( [Any] => Array ( [FieldValue] => Array ( [0] => DOMText Object ( [wholeText] => [data] => [length] => 17 [nodeName] => #text [nodeValue] => [nodeType] => 3 [parentNode] => (object value omitted) [childNodes] => [firstChild] => [lastChild] => [previousSibling] => [nextSibling] => (object value omitted) [attributes] => [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => [baseURI] => file:/C:/xampp/htdocs/mwsclient/src/MarketplaceWebServiceProducts/Samples/ [textContent] => ) [1] => DOMElement Object ( [tagName] => Any [schemaTypeInfo] => [nodeName] => Any [nodeValue] => [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted)

И вот мой код:

<?php



require_once('.config.inc.php');

$serviceUrl = "https://mws.amazonservices.com/Products/2011-10-01";

$config = array (
'ServiceURL' => $serviceUrl,
'ProxyHost' => null,
'ProxyPort' => -1,
'ProxyUsername' => null,
'ProxyPassword' => null,
'MaxErrorRetry' => 3,
);

$service = new MarketplaceWebServiceProducts_Client(
AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY,
APPLICATION_NAME,
APPLICATION_VERSION,
$config);

$service = new MarketplaceWebServiceProducts_Mock();
$SKUdata = '1018564382';

$request = new MarketplaceWebServiceProducts_Model_GetMyPriceForSKURequest();
$request->setSellerId(MERCHANT_ID);
$request->setSellerSKUList($SKUdata);
// object or array of parameters
invokeGetMyPriceForSKU($service, $request);

function invokeGetMyPriceForSKU(MarketplaceWebServiceProducts_Interface $service, $request)
{
try {
$response = $service->GetMyPriceForSKU($request);

echo ("Service Response\n");
echo ("=============================================================================\n");

$dom = new DOMDocument();
$dom->loadXML($response);
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;


print_r($response);



echo("ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n");

} catch (MarketplaceWebServiceProducts_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");
echo("ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n");
}
};

?>

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]