Export (0) Print
Expand All
DOM
Expand Minimize

open Method (ServerXMLHTTP/IServerXMLHTTPRequest)

Initializes a request and specifies the method, URL, and authentication information for the request.

oServerXMLHTTPRequest.open(bstrMethod, bstrUrl, bAsync, bstrUser, 
bstrPassword);

Parameters

bstrMethod

The HTTP method used to open the connection, such as PUT or PROPFIND. For ServerXMLHTTP, this parameter is case-sensitive and the method name must be entered in all upper-case letters.

bstrUrl

The requested URL. This can be either an absolute URL, such as "http://Myserver/Mypath/Myfile.asp", or a relative URL, such as "../MyPath/MyFile.asp".

bAsync(optional)

Boolean. Indicator as to whether the call is asynchronous. The default is False (the call does not return immediately).

bstrUser(optional)

The name of the user for authentication.

bstrPassword(optional)

The password for authentication. This parameter is ignored if the user parameter is Null or missing.

Example

The following JScript example creates an XMLHTTP object, and then uses the open method to get a copy of books.xml at the IIS Web server running locally. The code then selects the author and title information for the <book id="bk101"> element to display as output.

<%@language=JScript%>
<%
var srvXmlHttp
srvXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0");
srvXmlHttp.open ("GET", "http://localhost/books.xml", false);
srvXmlHttp.send();
var catalog = srvXmlHttp.responseXML;
var author = catalog.selectSingleNode("//book[@id='bk101']/author");
var title = catalog.selectSingleNode("//book[@id='bk101']/title");
%>
<html>
<body>
<pre><code>
<%Response.Write("<p>BOOK SEARCH RESULTS:</p>");%>
<%Response.Write("Author:  " + author.text + "<br>");%>
<%Response.Write("Title:   " + title.text + "<br>");%>
</code></pre>
</body>
</html>


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

Parameters

bstrMethod[in]

The HTTP method used to open the connection, such as PUT or PROPFIND. For ServerXMLHTTP, this parameter is case-sensitive and the method name must be entered in all upper-case letters.

bstrUrl[in]

The requested URL. This can be either an absolute URL, such as "http://Myserver/Mypath/Myfile.asp", or a relative URL, such as "../MyPath/MyFile.asp".

bAsync[in, optional]

Boolean. Indicator as to whether the call is asynchronous. The default is False (the call does not return immediately).

bstrUser[in, optional]

The 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]

The password for authentication. This parameter is ignored if the user parameter is Null or missing.

Return Values

S_OK

The value returned if successful.

After calling this method you must call the send method to send the request and data (if any) to the server. Each send method must have a corresponding open method.

Implemented in: MSXML 3.0 and MSXML 6.0

Show:
© 2015 Microsoft