|
-
Aug 24th, 2013, 01:42 AM
#1
Thread Starter
Fanatic Member
Content-Type not staying set in a MSXML2.ServerXMLHTTP object
Hi there,
I'm hoping this is fairly simple; I have a web service that I'm trying to access, and it takes form data.
For some reason I cannot set the header for content-type to x-www-form-urlencoded. The response I get from the server is a 406, unrecognized data type: text/plain. this seems to indicate that the header is not being set properly.
Even more odd, this packet isn't showing up in Fiddler (an HTTP debugger), so I can't see the raw packet.
This is from an Excel 2007 spreadsheet in VBA. Ultimately, this is going to validate a user using the sheet against their registration on my website. I will be calling other functions as well, once this begins to work.
I have tested this in a packet creator and it works fine, so I know it's not the service. Best I can tell, the header's not being set properly.
Any ideas?
vb Code:
Private Sub loginUser(ByVal pr_Username As String, ByVal pr_Password As String)
txtURL = "http://www.simplebusinesssolutions.org/xlDocs/system/connect"
Dim dataToSend As String
dataToSend = "username=" & pr_Username & "&password=" & pr_Password
Dim XMLHttp As Object: Set XMLHttp = CreateObject("MSXML2.ServerXMLHTTP")
XMLHttp.Open "POST", txtURL, False
XMLHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
XMLHttp.setRequestHeader "Accept", "*/*"
XMLHttp.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
XMLHttp.send dataToSend
Debug.Print XMLHttp.responseText
Set XMLHttp = Nothing
Exit Sub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|