Results 1 to 3 of 3

Thread: Problem w/ WinHTTPRequest POST request and 64-bit Windows
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular poolhall's Avatar
    Join Date
    Jan 2009
    Location
    NYC
    Posts
    350
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Problem w/ WinHTTPRequest POST request and 64-bit Windows

    Here's the description of my problem:

    I'm using a couple of VBA routines in the same Excel file in different Windows versions but getting different results, which depends it is a 64 or 32-bit Windows version.

    In the VBA project I have the following references:
    *** Microsoft WinHTTP Services, version 5.1 (C:\WINDOWS\system32\WINHTTP.dll),
    *** Microsoft XML, v6.0 (C:\WINDOWS\system32\msxml6.dll),
    *** and other standard references.

    What I am ultimately trying to do is to log into a secured website (via HTTPS), send POST request with login/password info into a webform, record session ID into a variable (Login routine) and pass this variable to the next routine, which sends POST request to fill data in another webform to send a query (SubmitQuery routine).

    I can use WinHTTPRequest object or MSXML2.XMLHTTP60 object to send those POST request. Both works fine in the Login routine as long as I am using Windows XP (32-bit), regardless of Excel version (tried 2002 and 2007). However, in 64-bit Windows versions (tested in Vista and Win 7), WinHTTPRequest doesn't work for me. It seems it incorrectly sends the POST body message.

    So for the Login routime I use MSXML2.XMLHTTP60 object to POST data, and it's fine with me.

    But in the SubmitQuery I need to POST to the server the session ID from a cookie, and this is the reason I cannot use XMLHTTP60 object here, because it doesn't support cookies. So I use WinHTTPRequest in this routine, which for me only works with 32-bit Windows versions.

    I hope this description is not too confusing.

    Is there anything I can do in this situation? I tried to add a reference to winhttp.dll, which is located in %SystemRoot%\SysWOW64 folder, to see if it makes difference, but this reference doesn't seem to appear in the references list in my VBA Project.

    Any help would be greatly appreciated. Please let me know if you need to see the actual code.
    Last edited by poolhall; Oct 26th, 2011 at 10:21 AM.

  2. #2
    Board Regular poolhall's Avatar
    Join Date
    Jan 2009
    Location
    NYC
    Posts
    350
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Problem w/ WinHTTPRequest POST request and 64-bit Windows

    Additional information.

    Since the last post in this thread, I have written a VBA program that logs into another secure website, and retrieves some data using WinHTTPRequest. The program works fine on both 32 and 64 bit Windows version.

    The only difference between the two programs is the form content type used to POST data to a web server by WinHTTPRequest.

    Application/x-www-form-urlencoded type works just fine with 64-bit Windows.

    Multipart/form-data type does not.

    If anybody ever encountered this kind of problem, please let me know. Thanks a lot.

  3. #3
    Board Regular poolhall's Avatar
    Join Date
    Jan 2009
    Location
    NYC
    Posts
    350
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Problem w/ WinHTTPRequest POST request and 64-bit Windows

    Finally found the answer: the problem solves by using MSXML2.ServerXMLHTTP60 instead of WinHTTPRequest. Simple as that.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •