问题
I am struggling with the Amazon API at this point! I am trying to Create Fulfillment Orders, send orders to Amazon for them to fulfill.
I first need to create the XML which I have used the documentation @ http://www.jyi.org/wp-content/uploads/Amazon-xml.pdf Page 42 (labelled 38). This bit is fine, the XML is great..
I then need to submit this to Amazon, as always I would go down the route of using there API, the PHP Fulfilment Api is available here... https://developer.amazonservices.com/doc/fba/outbound/v20101001/php.html
In the 'Samples' folder Amazon have created a 'CreateFulfillmentOrderSample.php' which sounds exactly what I would like to do.
Now when I look at this file I can see what is going on however I cannot see where it wants the XML file to send to Amazon.
Any pointers or alternative methods would be greatly appreciated!!
回答1:
The samples provided with that code are not what it says on the tin. They are not samples, they are scaffolds to play with - meaning: without changes they don't do a thing. In your case, look at lines 70+ in Samples/CreateFulfillmentOrderSample.php
:
// @TODO: set request. Action can be passed as FBAOutboundServiceMWS_Model_CreateFulfillmentOrderRequest
$request = new FBAOutboundServiceMWS_Model_CreateFulfillmentOrderRequest();
// $request->setSellerId(SELLER_ID);
// invokeCreateFulfillmentOrder($service, $request);
If you run it, you should get an error message "Unable to construct from provided data. Please be sure to pass associative array or DOMElement".
In your case, the XML should be passed as a DOMElement class parameter, so change above code to pass that parameter:
$request = new FBAOutboundServiceMWS_Model_CreateFulfillmentOrderRequest($DOMElement);
来源:https://stackoverflow.com/questions/21987663/how-submit-amazon-create-fulfilment-order-xml-using-php-api