Navigation


RSS: Matt Pavey RSS Feed



Friday, March 14, 2008 @ 11:42 am,ASP,Matt Pavey

I don't get to dabble in classic ASP much anymore, which is ok with me, but for the first time in years I had to debug some ASP code this morning to figure out an error for someone who is consuming one of our webservices.
 
The code was as simple as this:
 
Set MyXmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
MyXmlHttp.open "get", "https://www.test.com/webservice.asmx/GetSites?StudyID=35", False
MyXmlHttp.setRequestHeader "Content-Type", "text/xml"
MyXmlHttp.send()
XmlData = MyXmlHttp.responseText

Response.Write(Server.HtmlEncode(XmlData))

The error was:
 
HTTP Error 403.1 - Forbidden: Execute access is denied
 
Can you spot the problem?
 
MyXmlHttp.open "GET", "https://www.test.com/webservice.asmx/GetSites?StudyID=35", False
 
It might not be obvious what I changed, but simply changing the method from "get" to "GET" fixed the problem.
 
I wondered if this was a bug but this MSDN article seems to confirm that the method is case-sensitive and must be in UPPER case.
 
 
"The HTTP method used to open the connection, such as PUT or PROPFIND. For ServerXMLHTTP, this parameter is case-sensitive and the method name must be entered in all upper-case letters."


The opinions expressed on this website are my personal opinions
and do not represent my employer's or my clients' views in any way.