Salesforce

HTTPCall (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

HTTPCall (Magic xpa 3.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.

Syntax:

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

Parameters:

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.

Returns:

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

Examples:

HTTPCall('Get','http://www.magicsoftware.com/index.html','', '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 'index.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.

Note:

  • 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.

  • Use the HTTP Framework setting to define the underlying infrastructure.

  • 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:*/*'

  • The URL address is automatically encoded.

  • If there is a @ character in the URL, such as 'HTTP://myser:mypassword@myserver', only the address after the @ character will be encoded.

  • If the URL contains @ and you need to encode it all (and not just the part after the @), you should add @ as the first character in the URL. For example: '@http://myserver@data'. In this case, the entire URL will be encoded and the first @ character will automatically be removed. Since version: 3.1

See also:

Using HTTP Functions with an At Sign Character in the User Name or Password

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

Since version:

1.9e

Reference
Attachment 
Attachment