I am using VB.net to make XML calls to the Amazon webservice, code snippet as
follows:
sContactURL =
"https://secure.amazon.d e/exec/panama/seller-admin/catalog-upload/add-modify-delete"
' Save Login and Password - Colon (:) seperated
csUserNamePassw ord = "xxx@xx.co.uk:x xxxxxxxx"
'Open the a new request
Call xmlHTTP.open(bs trmethod:="POST ", bstrurl:=sConta ctURL,
varAsync:=False )
'Set up required headers
xmlHTTP.setRequ estHeader("HTTP _USER_AGENT", "Mozilla/4.0
(compatible; MSIE 5.5; Windows 98)")
xmlHTTP.setRequ estHeader("Cont ent-Type", "text/xml")
xmlHTTP.setRequ estHeader("Auth orization", "Basic " &
bBase64.Encode( csUserNamePassw ord))
xmlHTTP.setRequ estHeader("dev-t", "token")
xmlHTTP.setRequ estHeader("Uplo adFor", "Marketplac e")
xmlHTTP.setRequ estHeader("File Format", "TabDelimit ed")
xmlHTTP.setRequ estHeader("Cook ie",
"x-main=YvjPkwfntq DKun0QEmVRPcTTZ DMe?Tn?;ubid-main=002-8989859-9917520;ubid-tacbus=019-5423258-4241018;x-tacbus=vtm4d53D vX@Sc9LxTnAnxsF L3DorwxJa;
ubid-tcmacb=087-8055947-0795529;ubid-ty2kacbus=161-5477122-2773524;
session-id=087-178254-5924832; session-id-time=950660664" )
'Send the file as the *only* thing in the body of the message
Try
Call xmlHTTP.send(va rbody:=sUploadC ontents)
'Get the server's response
sResponse = xmlHTTP.respons eText
sResponse = Trim(sResponse)
If sResponse = "<Success>SUCCE SS</Success>" Then 'It worked
mWriteMessage(" Upload of " & vsFileLocation & " Was
successful")
bOK = True
Else
mWriteMessage(" Upload of " & vsFileLocation & " Failed" &
sResponse)
'MsgBox("Error Uploading to Amazon")
bOK = False
End If
Catch err As Exception ' Error has occured in the call
mWriteMessage(" Upload Call has failed : Run Number " &
Parameters.RunN umber)
bOK = False
End Try
sUploadContents is the text from a file which can be anything between a few
hundred and a few thousand KB in size.
When running in debug, the upload happens perfectly, taking beween a few,
and a few tens of seconds depending on the size of file.
However, when running from the executable on the same machine, it gets to
the line:
Call xmlHTTP.send(va rbody:=sUploadC ontents)
and hangs. I have left it alone for 3-4 hours, yet it never completes.
Anyone got any ideas??
Gambo
follows:
sContactURL =
"https://secure.amazon.d e/exec/panama/seller-admin/catalog-upload/add-modify-delete"
' Save Login and Password - Colon (:) seperated
csUserNamePassw ord = "xxx@xx.co.uk:x xxxxxxxx"
'Open the a new request
Call xmlHTTP.open(bs trmethod:="POST ", bstrurl:=sConta ctURL,
varAsync:=False )
'Set up required headers
xmlHTTP.setRequ estHeader("HTTP _USER_AGENT", "Mozilla/4.0
(compatible; MSIE 5.5; Windows 98)")
xmlHTTP.setRequ estHeader("Cont ent-Type", "text/xml")
xmlHTTP.setRequ estHeader("Auth orization", "Basic " &
bBase64.Encode( csUserNamePassw ord))
xmlHTTP.setRequ estHeader("dev-t", "token")
xmlHTTP.setRequ estHeader("Uplo adFor", "Marketplac e")
xmlHTTP.setRequ estHeader("File Format", "TabDelimit ed")
xmlHTTP.setRequ estHeader("Cook ie",
"x-main=YvjPkwfntq DKun0QEmVRPcTTZ DMe?Tn?;ubid-main=002-8989859-9917520;ubid-tacbus=019-5423258-4241018;x-tacbus=vtm4d53D vX@Sc9LxTnAnxsF L3DorwxJa;
ubid-tcmacb=087-8055947-0795529;ubid-ty2kacbus=161-5477122-2773524;
session-id=087-178254-5924832; session-id-time=950660664" )
'Send the file as the *only* thing in the body of the message
Try
Call xmlHTTP.send(va rbody:=sUploadC ontents)
'Get the server's response
sResponse = xmlHTTP.respons eText
sResponse = Trim(sResponse)
If sResponse = "<Success>SUCCE SS</Success>" Then 'It worked
mWriteMessage(" Upload of " & vsFileLocation & " Was
successful")
bOK = True
Else
mWriteMessage(" Upload of " & vsFileLocation & " Failed" &
sResponse)
'MsgBox("Error Uploading to Amazon")
bOK = False
End If
Catch err As Exception ' Error has occured in the call
mWriteMessage(" Upload Call has failed : Run Number " &
Parameters.RunN umber)
bOK = False
End Try
sUploadContents is the text from a file which can be anything between a few
hundred and a few thousand KB in size.
When running in debug, the upload happens perfectly, taking beween a few,
and a few tens of seconds depending on the size of file.
However, when running from the executable on the same machine, it gets to
the line:
Call xmlHTTP.send(va rbody:=sUploadC ontents)
and hangs. I have left it alone for 3-4 hours, yet it never completes.
Anyone got any ideas??
Gambo