mydoghasworms
mydoghasworms

Reputation: 18613

Is there and automation (OLE2)-enabled HTTP Client that ships with Windows?

Is there an automation-enabled HTTP client (i.e. something I can control with an OLE client) that ships with Windows, and which I can assume is present on most versions of Windows?

I intend to use this in an SAP ABAP program from where I want to give the user an option to download data via their desktop connection rather than initiating the request from the SAP server.

I was thinking of seeing whether I can make OLE calls to Internet Explorer in this case (though I am not sure whether I can retrieve the response of an HTTP request), but I somehow think that such a client would somehow be 'cleaner'.

Upvotes: 1

Views: 484

Answers (3)

Denis Muzhzhukhin
Denis Muzhzhukhin

Reputation: 109

use HTTP_POST or HTTP_GET functions. there is a RFC_DESTINATION parameter. use value SAPHTTP to access site via user's desktop SAPHTTPA to do so via SAP server.

Upvotes: 0

zhaow
zhaow

Reputation: 83

Doesn't class CL_HTTP_CLIENT work for your case? Using OLE Automation makes your program not very stable to my experience.

Upvotes: 0

mydoghasworms
mydoghasworms

Reputation: 18613

OK, while typing this question, I Googled for "vbscript http request" and the following Stack Overflow question answers my question by pointing to MSXML2.XMLHTTP as the object I would instantiate via OLE: HTTP GET in VBS

Using this answer, we can write some ABAP code as follows:

data: httpclient type ole2_object.
data: response type string.

create object httpclient 'MSXML2.XMLHTTP' no flush.

call method of httpclient 'open' no flush
  exporting
    #1         = 'GET'
    #2         = 'http://www.google.co.za'
    #3         = 0.
call method of httpclient 'send'.

get property of httpclient 'responseText' = response.

After the last GET PROPERTY, the response string variable contains the body of the HTTP response.

Upvotes: 1

Related Questions