HOW? Submit Amazon Create Fulfilment Order XML using PHP API

纵饮孤独 提交于 2019-12-20 06:27:54

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!