I am not sure what I am missing. I am trying to make a call to get a token returned via API. I need this token to do further calls - like create users, etc. Anyway, if I a similar call using GET to find the status, it works. Also, if I use the same information in this code in FIDDLER, it works and returns a token. Here is the Code:
Set oWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
msgbox("body build")
sReqBody = "<Token>" &_
"<Password>password</Password>" &_
"<SiteCode>ABC1</SiteCode>" &_
"<Username>Username1</Username>" &_
"<Token>"
msgbox("Building the POST")
sWebServiceURL ="http://testapi.releasecandidate-community360.net/api/token" 'Web Service URL
sWebhost = "testapi.community360.net"
msgbox (sWebServiceURL)
msgbox (sWebHost)
'POST the URL
oWinHttp.open "POST", "http://testapi.releasecandidate-community360.net/api/token", False
msgbox ("Set header")
'Set Header
oWinHttp.setRequestHeader "Content-Type", "application/xml"
oWinHttp.setRequestHeader "Accept", "application/xml"
oWinHttp.setRequestHeader "Host", sWebHost
oWinHttp.setRequestHeader "Content-Length", ""
msgbox("sending")
oWinHttp.send sReqBody
msgbox(sReqBody)
oWinHttp.WaitForResponse(120)
sResponse = oWinHttp.ResponseText
wscript.echo sResponse
The error is 404 - File or directiry not found.
This makes no sense since I can find that directory and FIDDLER tool works fine. I am guessing I need to talk to my Dev guys about the error messages we are returning.
But, any ideas what I am doing wrong with this? Thanks.