hi,
i am relatively new using XML/SOAP, however i am working on a project where we must create a data feed of our products and send them to Amazon to be listed on their site as an affiliate seller (please note this is different than the common project of gaining access to Amazon's RSS feed to list their products on your website, we are doing the opposite of listing our products on their website).
i believe i am supposed to use CFHTTP to send the soap request to their server:
1. Post APIs to the following address:
https://merchant-api-qa.amazon.com:443/exec/merchantdata/2.Include your username and password credentials in the http header, and include your merchant ID in the SOAP envelope.
here is a sample of the SOAP i created envelope i need to send amazon:
POST
https://MYUSERNAME:MYPASSWORD@https://merchant-api-qa.amazon.com:443/exec/merchantdata/> Accept: text/xml
Accept: multipart/*
Content-Length: 752
Content-Type: text/xml; charset=utf-8
SOAPAction: "nsMerchantDataExchange#ge
tAllPendin
gDocumentI
nfo"
<?xml version="1.0" encoding="UTF-8"?><SOAP-EN
V:Envelope
xmlns:SOAP-
ENC="
http://schemas.xmlsoap.org/soap/encoding/" SOAP-
ENV:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-
ENV="
http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"><
SOAP-
ENV:Body><ns:getAllPending
DocumentIn
fo
xmlns:ns="nsMerchantDataEx
change"><m
erchant xsi:type="ns:Merchant"><me
rchantName
xsi:type="xsd:string">****
***</merch
antName><m
erchantIde
ntifier
xsi:type="ns:MerchantIdent
ifier">***
*****</mer
chantIdent
ifi
er></merchant><messageType
xsi:type="ns:MessageType">
_GET_ORDER
S_DATA_</m
essageType
></ns:getA
llP
endingDocumentInfo></SOAP-
ENV:Body><
/SOAP-ENV:
Envelope>
here is my problem: how to i go about sending the SOAP request using coldfusion:
i tried saving the SOAP request as a variable and sending it using CFHTTP as follows:
<cfsavecontent variable="xmlSOAPcontent">
<!--- entire SOAP envelope above goes in here --->
</cfsavecontent>
<!--- Send Request --->
<cfhttp url='
https://myusername:mypassword@merchant-api-qa.amazon.com/exec/merchantData' method="POST" port="443" resolveurl="NO">
<!--- HTTP Header Values --->
<cfheader name="SOAPAction" value="">
<cfheader name="Content-Type" value="text/xml; charset=utf-8">
<!--- SOAP REQUEST CONTENT --->
<cfhttpparam type="XML" name="CGI" value="#xmlSOAPcontent#">
</cfhttp>
<!--- Assign Results --->
<cfset SOAPResponse ="#cfhttp.filecontent#">
<cfoutput>#SOAPResponse#</
cfoutput>
however, i just keep getting 'connection failure' from cfhttp.filecontent
here is the dump of #cfhttp#
struct
Charset [empty string]
ErrorDetail I/O Exception: For input string: "
https:"
Filecontent Connection Failure
Header [undefined struct element]
Mimetype Unable to determine MIME type of file.
Responseheader struct [empty]
Statuscode Connection Failure. Status code unavailable.
Text YES
requireWait Connection Failure
im not sure if this is a coldfusion error or something on amazon's SOAP server, but they assure me that everything is ok on their end.
does anyone have any experience doing something like this?
help is appreciated.
Start Free Trial