Here is my code
Code: Select all
<?php
class AmazonMerchant
{
public $merchantIdentifier ;
public $merchantName ;
}
class AmazonDocumentInfoCollection implements IteratorAggregate
{
public $MerchantDocumentInfo = array() ;
public function getIterator()
{
return new ArrayIterator($this->MerchantDocumentInfo) ;
}
}
class AmazonDocumentInfo
{
public $documentID ;
public $generatedDateTime ;
}
$classmap = array(
'Merchant' => 'AmazonMerchant',
'MerchantDocumentInfo' => 'AmazonDocumentInfo',
'ArrayOfMerchantDocumentInfo' => 'AmazonDocumentInfoCollection'
) ;
$merchant = new AmazonMerchant() ;
$merchant->merchantIdentifier = 'M_DISEASETEE_544913' ;
$merchant->merchantName = 'Disease Tees' ;
$params = array(
'classmap' => $classmap,
'login' => 'mylogin',
'password' => 'mypassword',
'trace' => 1,
'exceptions' => 1
) ;
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient('wsdl/amazon_merchant-interface-mime.wsdl', $params) ;
try
{
// Works fine and returns an ArrayOfMerchantDocumentInfo
$docs = $client->getAllPendingDocumentInfo($merchant, '_GET_ORDERS_DATA_') ;
}
catch(SoapFault $fault)
{
print_r($fault) ;
}
try
{
// This passes an id from the DocumentInfo array object
/* THIS IS THE CALL THAT ALWAYS FAILS */
$response = $client->getDocument($merchant, '369767253') ;
}
catch(SoapFault $fault)
{
print_r($fault) ;
}
// nada
print_r($response) ;
// Debug stuff, this prints out the response from amazon which appears to be correct.
print "<pre>\n";
print "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n";
print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";
print "Headers:\n".htmlspecialchars($client->__getLastResponseHeaders()."\n") ;
print "</pre>";
?>The response returned from Amazon appears to be OK from looking at it, I do not know how I can verify if there is invalid UTF-8 though. I also ran tcpdump and have a dump of the response. I can post that if you like, but its pretty big.
Anybody know what I can do next to analyze the response to try and figure out how to deterimine if that is the problem, or does anyone see any other possible problems with my code?