View Full Version : Sending a request to a web service


geno
07-20-2011, 12:19 PM
Hi,

Don't know much about web programming so I need help....
I have a client who sells parts online, the part pricing is updated through two text files which are being uploaded through FTP. After this is done I need to send a request to the web so these files are looked at.

Thanks

geno
07-21-2011, 04:19 AM
Sharing the code that worked for me:

Dim xhr As New XMLHTTP
Dim webServiceURL As String
Dim actionType As String
Dim postData As String

http://services.aonaware.com/DictService/DictService.asmx/
actionType = ""
postData = "dictId=gcide&word=baritone"
xhr.Open "POST", webServiceURL & actionType, False
xhr.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xhr.setRequestHeader "Content-Length", Len(postData)
xhr.Send postData

If xhr.Status = 200 Then
MsgBox xhr.getAllResponseHeaders
Debug.Print xhr.responseText

Else: MsgBox xhr.Status & ": " & xhr.statusText
Debug.Print xhr.responseText

End If

Set xhr = Nothing