[Edit: Adopting @Lankymart's comments]
Your request doesn't appear to be a pure "HTTP POST" or "HTTP GET" request.
For a "HTTP POST" request:
- Parameters shouldn't be in the URL, it should be in the body
- Seems the server is expecting a Content-Length
Example:
Option Explicit
Dim objHTTP, url, param
Set objHTTP = CreateObject("Microsoft.XMLHTTP")
url = "http://localhost:8080/xyz/processKey"
param = "key=abcd"
objHTTP.open "POST", url, False
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.send param
WScript.Echo objHTTP.responseText
For a "HTTP GET" request
- Parameters must be embedded in the URL
- Send must be blank
Example:
Option Explicit
Dim objHTTP, url, param
Set objHTTP = CreateObject("Microsoft.XMLHTTP")
url = "http://localhost:8080/xyz/processKey"
param = "key=abcd"
objHTTP.open "GET", url + "?" + param, False
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.send
WScript.Echo objHTTP.responseText
Set http = CreateObject("Microsoft.XmlHttp")? I know it's mostly case insensitive but I don't think that extends to objects. - scrappedcolaCreateObjectis not case-sensitive, butMicrosoft.XMLHTTPis outdated and should be replaced byMsxml2.XMLHttp. The code worked for me either way, though. What does the server log say about the failed requests? - Ansgar Wiecherssendmethod requires a parameter, cf. How To Submit Form Data by Using XMLHTTP or ServerXMLHTTP Object. - JosefZ