Welcome Guest | My Membership | Login

IS.HTTPCLIENT - Using Universe and UniData HttpCall Extensions



Universe and Unidata have built in UniBASIC extensions that make the job of calling to a HTTP web server relatively easy. If you look into the UniVerse and/or UniData BASIC extension manual, you will see references to the CallHTTP functions that were added.

These functions isolate a lot of the complexity of writing the HTTP protocols by hand, but they still require you to do some work. The subroutine included with this article removes that set of complexity by creating a single subroutine that you can call.

    This is the HTTP Method you are asking the web server to process. Normally, this is either 'GET' or 'POST'
  • URL
    This is the "Http://" or "Https://" want to request data from or send data to.
  • HEADER.DATA<1,n>
    Http Request Header Name - This is the header name that the developer wants to included with the request to the server.
  • HEADER.DATA<2,n>
    Http request Header data - This is the data you want to include with this header name
  • POST.DATA<-1>
    This is the data you want to send to the web server. Each AM (Char(254)) will be converted to a CRLF.
    Http response returned by the web server. That values are between 100-500. Most successful request will return with a value of 200 or 201 as per the HTTP protocol.
    Header Names returned with the response data. This is provided by the web server, and may include important information.
    Value for the header data
  • RESP.DATA<n>
    This is the data returned by the web server based on the URL, HTTP.METHOD, and POST.DATA. Each CRLF will be converted into an AM mark (char(254))
    All other communication errors, parsing error, or anything not related to the HTTP protocol will be returned here. If there is no error, then this will return '' or '0'


CALL IS.HTTPCLIENT("GET","http://www.google.com","","",HTTP.STATUS,"",HTTP.RESP,ERROR)
CRT "Error ": ERROR

CallHTTP Extension Gotchas

Depending on the version of UniVerse or UniData there are a few gotcha. If you are running a UniVerse or UniData on a 64bit operation systems, then the access to Https may be be available. This is a common problem on some version of AIX.

Another issue you may into is trying to send anything other than a Username:password value in 'Authorization' Request header. If you add it using setRequestHeader, you will receive an error message. If you try to set the value using setHTTPDefault, you will also receive an error message.

In most causes this is not a problem, unless you are looking to use OAUTH with your web service/RESTful service call.


If you are looking for alternatives to address these short comings, then look at the HttpClient - CURL version or the HTTP client using sockets.

License Notes:

This program is free software in the public domain; you can redistribute it and/or modify it in any way you wish. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Commercial support and warranties of this software and code can be purchased through International Spectrum.

This program is not the only means to do this, but is a starting point or working sample that can be extended.


# # #          # # #          # # #


Related Articles

  • IS.HTTPCLIENT - Using UniVerse and UniData UniBASIC Sockets

    Database: UniData, UniVerse

    UniVerse and UniData includes support for both normal sockets and SSL sockets, in addition to the CallHTTP extension. The UniVerse and UniData CallHTTP UniBASIC extensions do what most developers needed when making SOAP or REST calls, but they do not support custom Authorization Headers. In order to work around this issue, a developer is requires to create the HTTP protocol manually.

  • IS.HTTPCLIENT - D3 9.1 and above

    Company: International Spectrum Database: D3

    D3 9.1 and above includes support for both normal sockets and SSL sockets. This provide this version of D3 the ability to access both Http:// and Https:// without requiring an external OS routine.


    Company: International Spectrum Database: D3, jBASE, mv*Base, OpenQM, UniData, UniVerse

    CURL is an open source tools and can be found on every version of Linux being distributed. CURL can be find as compiled binaries as well as compliable source code. Many software applications integrate CURL using the libcurl, but in this case we will be using the curl command line routine using the command-line switches, standard-in, and standard-out to transmit information between MultiValue BASIC and CURL.

  • Auditing Database Changes with UniVerse Indexing Subroutines

    Company: Modern MultiValue, LLC Database: UniVerse

    UniVerse has file triggers which can be used to call a subroutine whenever a new record is added, changed, or deleted from a file so that the change to the database can be recorded in an audit trail for IT governance and compliance requirements. But full blown triggers come with a certain amount of performance overhead. For simple auditing, using indexing suboutines with a new system variable available at release 11.1 is a lighter weight alternative.

  • Email from U2 Hold Files as PDFs

    Database: UniVerse

    Printing is only one way to share reports. Felix provides code for re-inventing hold files as PDFs and as email.

Return to top