XMLHttp object - multiple line header RRS feed

  • Question

  • ACCESS 2000 Vba Win XP

    I want to use the XMLHttp Object to POST to a REST API.

    Using the Winsock control I can send:-

    POST /services/rest/sms HTTP/1.0
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 132 [Note - this is correct but does not match the message length below becuase I have altered values of username and Pw.]


    AND get an appropriate response

    HOWEVER - I need to do thsi many times quickly and to avoid the "address in use" error need to reset the port to port = 0 each time and run the danger of running out of ports

    SO:- I want to try using the XMLHttp object as an alternative.

    I can open the object and send the host address username and password fine.

    BUT:- I have a problem with defining the Header. It is required by the REST Api that the Header has to include 2 lines:-

    Content-Type: application/x-www-form-urlencoded
    Content-Length: 132

    I have looked at

    It says (section 4.7.2) that "Content-Length" is not allowed [and my app reports this when I try to add it!]

    The article above says that this addition is "left up to the user agent" -



    a. am I barking up the wrong tree trying to use the HTPPHtml object OR

    b. Is there a way for me to add the second line of the header required using vba OR

    c. is there some other alternative object I can use in vba as an alternative to the Winsock control

    Jim Bunton


    Jim Bunton

    Wednesday, March 28, 2012 11:06 PM