I've been struggling with this for several weeks now trying to figure out a solution. Here is the problem:
When you attempt to create a cart using Amazon's E-Commerce Services, NuSOAP is dropping values in the request array. After trying to solve the problem with my own code, I found a sample in the NuSOAP CVS at Sourceforge that should create a cart. Unfortunately, the sample has the same problem - it won't send the quantity value and therefore is not a valid request (In fact, it doesn't send anything beyond ASIN). If you look in the CVS under samples you can download wsdlclient12.php and see what I mean (if you have an AWS subscription ID). Here is the output the code gives me:
Quote: |
Result
Array
(
[OperationRequest] => Array
(
[HTTPHeaders] => Array
(
[Header] => Array
(
[!Name] => UserAgent
[!Value] => NuSOAP/0.7.2 (1.104)
)
)
[RequestId] => 1904R8N3KNG7QGYER36S
[Arguments] => Array
(
[Argument] => Array
(
[!Name] => Service
[!Value] => AWSECommerceService
)
)
[RequestProcessingTime] => 0.00534415245056152
)
[Cart] => Array
(
[Request] => Array
(
[IsValid] => False
[CartCreateRequest] => Array
(
[Items] => Array
(
[Item] => Array
(
[0] => Array
(
[ASIN] => 0596004206
)
[1] => Array
(
[ASIN] => 0596003277
)
)
)
[ResponseGroup] => CartSimilarities
)
[Errors] => Array
(
[Error] => Array
(
[code] => AWS.MissingParameters
[Message] => Your request is missing required parameters. Required parameters include Quantity.
)
)
)
)
)
Request
POST /onca/soap?Service=AWSECommerceService HTTP/1.0
Host: soap.amazon.com
User-Agent: NuSOAP/0.7.2 (1.104)
Content-Type: text/xml; charset=UTF-8
SOAPAction: "http://soap.amazon.com"
Content-Length: 797
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns6556="http://tempuri_org"><SOAP-ENV:Body><CartCreate xmlns="http://webservices.amazon.com/AWSECommerceService/2007-05-14"><SubscriptionId>***********</SubscriptionId><Request><Items><Item xmlns="http://webservices.amazon.com/AWSECommerceService/2007-05-14"><ASIN>0596004206</ASIN></Item><Item xmlns="http://webservices.amazon.com/AWSECommerceService/2007-05-14"><ASIN>0596003277</ASIN></Item></Items><ResponseGroup>CartSimilarities</ResponseGroup></Request></CartCreate></SOAP-ENV:Body></SOAP-ENV:Envelope>
Response
HTTP/1.1 200 OK
Date: Thu, 24 May 2007 01:56:43 GMT
Server: Server
x-amz-id-1: 1904R8N3KNG7QGYER36S
x-amz-id-2: /yj0Y8zSelxheTtlZ3rgRGKvkDGGpIIYmMyRGWcxS2w=
Connection: close
Content-Type: text/xml; charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Body><CartCreateResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2007-05-14"><OperationRequest><HTTPHeaders><Header Name="UserAgent" Value="NuSOAP/0.7.2 (1.104)"></Header></HTTPHeaders><RequestId>1904R8N3KNG7QGYER36S</RequestId><Arguments><Argument Name="Service" Value="AWSECommerceService"></Argument></Arguments><RequestProcessingTime>0.00534415245056152</RequestProcessingTime></OperationRequest><Cart><Request><IsValid>False</IsValid><CartCreateRequest><Items><Item><ASIN>0596004206</ASIN></Item><Item><ASIN>0596003277</ASIN></Item></Items><ResponseGroup>CartSimilarities</ResponseGroup></CartCreateRequest><Errors><Error><Code>AWS.MissingParameters</Code><Message>Your request is missing required parameters. Required parameters include Quantity.</Message></Error></Errors></Request></Cart></CartCreateResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
Debug
|
Please note - I removed my subscription id in the code above.
Any help on this would be greatly appreciated. Thanks.