Fiddler don't show requests from MSXML2.ServerXMLHTTP.6.0 made from VBA

3,252 views
Skip to first unread message

Elena Kalinina

unread,
Apr 14, 2014, 7:48:42 AM4/14/14
to httpf...@googlegroups.com
I have a code in VBA Excel which make HTTP requests by using MSXML2.ServerXMLHTTP.6.0

It looks like
    authHeader = "Basic " & Base64Encode("login:password")
    
    Set XMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
    XMLHTTP.setTimeOuts 30000, 30000, 30000, 600000
    XMLHTTP.Open "POST", "http://query.kontagent.net/datamine/v2/nival/query/", False
    XMLHTTP.SetRequestHeader "Authorization", authHeader
    
    If strQuery <> "" Then
        strQuery = "query=" + Replace(strQuery, " ", "%20")
    End If
    
    'On Error Resume Next
    XMLHTTP.Send (strQuery)
    
    SendHTTPRequest = Err.Number
    strQueryResult = XMLHTTP.ResponseText
    queryStatus = XMLHTTP.Status
    
    Set XMLHTTP = Nothing

After     XMLHTTP.Send (strQuery)
BAD REQUEST returns

but Fiddler do not show this request

How can I see it through Fiddler?

EricLaw

unread,
Apr 15, 2014, 12:28:45 PM4/15/14
to httpf...@googlegroups.com

asd...@googlemail.com

unread,
Jul 11, 2014, 10:26:43 PM7/11/14
to httpf...@googlegroups.com
I have the same problem as Elena.

Looking at ServerXMLHTTP, it doesn't seem to have a setProxy method. Also, like Elena, I'm not sending to localhost, so I'm not sure if the link you give above is valid for my situation Eric?

Can anyone give me some pointers to be able to view requests from an MS Access database using ServerXMLHTTP?

regards

Steve

EricLaw

unread,
Jul 13, 2014, 8:27:26 AM7/13/14
to
Without sharing your code, it's harder to help. For instance, what does "requests from an MS Access database" mean?

I don't know what you mean when you say "looking at ServerXMLHTTP"? The setProxy method is described here: http://msdn.microsoft.com/en-us/library/ms760236(v=vs.85).aspx

asd...@googlemail.com

unread,
Jul 14, 2014, 12:53:52 AM7/14/14
to httpf...@googlegroups.com
Hi Eric

I'm sorry about that. I do have everything working now though.

The issue was that for some reason I can't use the setProxy method on MSXML2.ServerXMLHTTP. When I swapped to MSXML2.ServerXMLHTTP.6.0 (as below), then everything works great.. One thing to note that may be obvious is that when using ssl, you need to use https in the setProxy method

    Dim objXMLHTTP
    Dim objXMLDocument
    Dim sDataToPost
   
    sDataToPost = "<soapenv:Envelope><soapenv:Header/><soapenv:Body><web:ping/></soapenv:Body></soapenv:Envelope>"
   
    Set objXMLDocument = New MSXML2.DOMDocument
    objXMLDocument.loadXML sDataToPost
   
    Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
    objXMLHTTP.Open "POST", "https://websiteurl/training/services", False, "MyUsername", "MyPassword"
    objXMLHTTP.setProxy 2, "https=localhost:8888", ""
    objXMLHTTP.send objXMLDocument

cheers

Steve

EricLaw

unread,
Jul 14, 2014, 10:04:28 AM7/14/14
to httpf...@googlegroups.com
Yes, you always want to use a ProgID containing a version number: http://msdn.microsoft.com/en-us/library/ms761415.aspx

When you use older versions ServerXMLHTTP, you need to use a different method to set the proxy. In particular, I think you'd set the global WinHTTP proxy from the command line, which is tricky because prior to Win8, you had to do so for each bitness of WinHTTP (32bit and 64bit command lines).
Reply all
Reply to author
Forward
0 new messages