send Method (ServerXMLHTTP/IServerXMLHTTPRequest)
Sends an HTTP request to the server and receives a response.
Script Syntax
oServerXMLHttpRequest.send(varBody);
Parameters
- varBody
- The body of the message being sent with the request.
Example
<%@language=JScript%> <% var srvXmlHttp srvXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.5.0"); srvXmlHttp.open ("GET", "http://myserver/myresponse.asp", false); srvXmlHttp.send(); newsElement = srvXmlHttp.responseXML.selectSingleNode("/news/story1"); %> <html> <body> <p>Top News Story<p> <%Response.write(newsElement.text);%> </body> </html>
Visual Basic Syntax
oServerXMLHttpRequest.send(varBody)
Parameters
- varBody
- The body of the message being sent with the request.
Example
Dim xmlServerHttp As New Msxml2.ServerXMLHTTP50 xmlServerHttp.open "GET", "http://localhost/sample.xml", False xmlServerHttp.send MsgBox xmlServerHttp.responseXML.xml
C/C++ Syntax
HRESULT send(VARIANT varBody);
Parameters
- varBody [in, optional]
- The body of the message being sent with the request.
C/C++ Return Values
- S_OK
- The value returned if successful.
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 only use 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 XMLDOM object, the response is encoded according to the encoding attribute on the <? XML declaration in the document. If there is no XML declaration or encoding attribute, UTF-8 is assumed.
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.
Important You cannot call multiplesend
methods for a singleopen
method. Instead, for eachsend
method, you must call a correspondingopen
method. For example:
osrvXmlHttp.open()
osrvXmlHttp.send()
osrvXmlHttp.open()
osrvXmlHttp.send()
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button in the upper-left corner of the page.
See Also
Applies to: IServerXMLHTTPRequest/ServerXMLHTTP