HTTPCall (Magic xpa 2.x)

« Go Back


Created ByKnowledge Migration User
Approval Process StatusPublished

HTTPCall (Magic xpa 2.x)

Performs an HTTP request and returns the results. It is possible to consume REST services by using this function, which supports all verbs. This function can replace the HTTPGet and HTTPPost functions.


HTTPCall (verb, service URL, message, [header1], [header2], …)


verb: A string indicating the method. The options include GET, POST, PUT, DELETE, and HEAD.

service URL: A string that represents an HTTP address that lets you retrieve an HTTP request. When a Magic xpa client is accessing a web server that requires a user name and password, the URL should be HTTP://User:Password@[URL].

You can also support secret names using: HTTP://%user_secretname%:%pass_secretname%@[URL]

message: A string with the text of the message. There is no limitation on the message content.

headers: Optional. A string that provides additional request header information. You may specify as many header information strings as you need.


BLOB. Contains the information results from the HTTP request. If the function fails to make the connection, a blank value is returned.


HTTPCall('Get','','', 'If-Modified-Since: Tue, 7 Aug 2001 12:00:00 GMT', 'User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)')

This example requests the file 'idex.html' specified at the URL.

The first header parameter asks to retrieve the page only if it was modified after the provided date.

The second header parameter provides the server with the type of user agent that this request simulates.

HTTPCall('Post','http://localhost/Service',A,'User-Agent "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)"')

where: A is a BLOB value that contains a collection of variables.


  • Getting the Response headers – The response headers are available using the HTTPLastHeader function.

  • Authentication – The function supports the Basic and Digest authentication schemas.

  • Certificate – The function supports SSL\TLS with the client certificate password protected.

  • The function may connect through a proxy server. You can define your proxy server in the Magic.ini file or in the HTTP Proxy – Address Port environment setting.

  • The retrieval phase of the function can be set to stop by specifying the HTTP Timeout environment setting in the Magic.ini file.

  • When using this function, a Content-Type header is sent. If you do not want to send the Content-Type header, send the following header value: 'Content-Type:*/*'

See also:

The Online and Rich Client Samples projects (program EL23 and REL23)

Since version: