总算好了MSXML

open (IXMLHTTPRequest) Initializes an MSXML2.XMLHTTP request and specifies the method, URL, and authentication information for the request.
open (ServerXMLHTTP/IServerXMLHTTPRequest) Initializes a request and specifies the method, URL, and authentication information for the request.

是否同步有一个参数,描述如下:

Parameters

bstrMethod
The HTTP method used to open the connection, such as GET, POST, PUT, or PROPFIND. For XMLHTTP, this parameter is not case-sensitive.
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".
varAsync [optional]
A Boolean indicator of whether the call is asynchronous. The default is True (the call returns immediately). If set to True, attach an onreadystatechange property callback so that you can tell when the send call has completed.
bstrUser [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 [optional]
The password for authentication. This parameter is ignored if the user parameter is Null ("") or missing.

反正如果varAsync设置true, 就会即时返回, 否则就要用到onreadystatechange事件来处理不知道什么时候会到来的返回,而且,异步的时候问题好像很多,奇怪,到目前为止,我仅在非浏览器范围的测试或者程序中成功而且顺手过。而且,有时候用异步接受的时候,xml对象的编码常出问题!

Remarks

This method is synchronous or asynchronous, depending on the value of the bAsync parameter in the open method call. If open is called with bAsync == False, this call does not return until the entire response is received or the protocol stack times out. If open is called with bAsync == True, this call returns immediately.

This method takes one optional parameter, which is the requestBody to use. The acceptable VARIANT input types are BSTR, SAFEARRAY of UI1 (unsigned bytes), IDispatch to an XML Document Object Model (DOM) object, and IStream *. You can use only chunked encoding (for sending) when sending IStream * input types. The component automatically sets the Content-Length header for all but IStream * input types.

If the input type is a BSTR, the response is always encoded as UTF-8. The caller must set a Content-Type header with the appropriate content type and include a charset parameter.

If the input type is a SAFEARRAY of UI1, the response is sent as is without additional encoding. The caller must set a Content-Type header with the appropriate content type.

If the input type is an XML DOM object, the response is encoded according to the encoding attribute on the

If the input type is an IStream *, the response is sent as is without additional encoding. The caller must set a Content-Type header with the appropriate content type.

暂无评论

评论

暂无评论。

发表评论

*必填

*必填 (不会被公开)