次の方法で共有


open Method (IXMLHTTPRequest) (Compact 2013)

3/26/2014

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

Syntax

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

Parameters

Script

  • 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 "http://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.

C/C++

  • 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 "http://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.

Return Value

Script

None.

C/C++

  • 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.

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

Requirements

Header

msxml2.h,
msxml2.idl

Library

uuid.lib

See Also

Reference

XML HTTP Methods
onreadystatechange Property (IXMLHTTPRequest)