I'm trying to upload data to a web server for the first time.
The VBA function I'm using is below. This is for Excel 2007.
As it is now, I get the error code 500 ("Internal Service Error") when adding msgbox XmlHttp.Status at the end of the function.
The XmlText variable I'm using can be recreated using the attached file.
I'm very confident that the URL, UserName, and Password I'm using are correct (I've successfully used the GET method for a different objective with this web server). Unfortunately, I can't post those things here due to non-disclosure issues.
Straightforward documentation from the web server is available here:
They say their service is exposed via a RESTful API. Maybe the function I'm using assumes SOAP. I don't know the difference as far as VBA is concerned.
Any suggestions greatly appreciated.
Function PostXmlData(vURL As String, UserName As String, Password As String, XmlText As String) As String
Dim XMLHttp As Object
Set XMLHttp = CreateObject("MSXML2.XMLHTTP")
XMLHttp.Open "POST", vURL, False, UserName, Password
' Not sure which 'setRequestHeader' to use, if any.
'XMLHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" ' Status error 400 returned (Bad Request)
XMLHttp.setRequestHeader "Content-Type", "text/xml;charset=utf-8" ' Status error 500 returned (Internal Service Error)
PostXmlData = XMLHttp.responseText