Share via


open Method (IXMLHTTPRequest)

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

Initializes an MSXML2.XMLHTTP request and specifies the method, URL, and authentication information for the request.

Script Syntax

oXMLHttpRequest.open(bstrMethod, bstrUrl, varAsync, bstrUser, bstrPassword);

Remarks

Script Parameters

  • bstrMethod
    String. HTTP method used to open the connection, such as GET, POST, PUT, or PROPFIND.
  • bstrUrl
    String. Requested URL. This must be an absolute URL, such as "https://Myserver/Mypath/Myfile.asp".
  • varAsync
    [optional] Boolean. Indicator of whether the call is asynchronous. The default is True (the call returns immediately). If set to True, attach an onreadystatechange Property (IXMLHTTPRequest) callback so that you can tell when the send call has completed.
  • bstrUser
    [optional] Name of the user for authentication. If this parameter is Null ("") or missing and the site requires authentication, the component displays a logon window.
  • bstrPassword
    [optional] Password for authentication. This parameter is ignored if the user parameter is Null ("") or missing.

Script Return Value

None.

C/C++ Syntax

HRESULT open(
  BSTR bstrMethod, 
  BSTR bstrUrl, 
  VARIANT varAsync,
  VARIANT bstrUser, 
  VARIANT bstrPassword
);

Remarks

C/C++ Parameters

  • bstrMethod
    [in] HTTP method used to open the connection, such as PUT or PROPFIND.
  • bstrUrl
    [in] Requested URL. This must be an absolute URL, such as "https://Myserver/Mypath/Myfile.asp".
  • varAsync
    [in, optional] Boolean. Indicator as to whether the call is asynchronous. The default is True (the call returns immediately). If set to True, attach an onreadystatechange Property (IXMLHTTPRequest) callback so that you can tell when the send call has completed.
  • bstrUser
    [in, optional] Name of the user for authentication. If this parameter is Null ("") or missing and the site requires authentication, the component displays a logon window.
  • bstrPassword
    [in, optional] Password for authentication. This parameter is ignored if the user parameter is Null or missing.

C/C++ Return Values

  • S_OK
    Value returned if successful.
  • E_FAIL
    Value returned if an error occurs.
  • E_INVALIDARG
    Value returned if bstrUrl or bstrMethod are NULL
  • E_OUTOFMEMORY
    Value returned if bstrMethod is unable to open connection.
  • E_ACCESSDENIED
    Value returned if bstrPassword is invalid.

Requirements

Header msxml2.h, msxml2.idl
Library uuid.lib
Windows Embedded CE Windows CE .NET 4.0 and later

General Remarks

The values of the request headers, request body, response headers, and response body must be cleared before calling this method.

After calling this method, you must call send to send the request and data, if any, to the server.

This method applies to the following interface:

IXMLHTTPRequest

See Also

Concepts

onreadystatechange Property (IXMLHTTPRequest)

Other Resources