I can´t get it to work
There must be an error with the XML/Body attachment.
Without the XML Body it does work - but i need to attach the XML.
Can someone please help me ?
My Code:
--------------------------------------------------------------------------------------------------------------
//Create a new post request
var xmlFle = new XML('<queue>test</queue>'); // -> Creating the XML Object
var client = plugins.http.createNewHttpClient(); // Creating new http client
var poster = client.createPostRequest('https://mws.amazonservices.de');
poster.addParameter('AWSAccessKeyId','AKIAIMWQ2C12345678')
poster.addParameter('Action','SubmitFeed')
poster.addParameter('Merchant','A2D9F123456789')
poster.addParameter('MWSAuthToken','A1PA6123456789')
poster.addParameter('SignatureVersion','2')
poster.addParameter('Timestamp',time) // using a time variable -> variable works ( used and tested with other requests)
poster.addParameter('Version','2009-01-01')
poster.addParameter('Signature',signature) // Signature is correct ( used and tested with other requests)
poster.addParameter('SignatureMethod','HmacSHA256')
poster.addParameter('FeedType','_POST_PRODUCT_DATA_')
poster.addParameter('PurgeAndReplace','false')
poster.addParameter('x-amazon-user-agent','AmazonJavascriptScratchpad/1.0 (Language=Javascript)')
poster.addParameter('Content-MD5','LwpPrQqp+k0hA6qImf+wdQ==') // Value is verfied and works
poster.addParameter('Content-Type','text/xml')
poster.setBodyContent(xmlFle.toString()) // !!! the error must be here !!!
poster.setCharset('UTF-8');
var response = poster.executeRequest()
//Get the content of the response as String.e
var pageData = response.getResponseBody();
application.output(pageData)
Thank you for your help !
Rainer Böhm