getHTTPBasicAuthentication()

The serviceLib.getHTTPBasicAuthentication() system function provides simple HTTP header authentication that uses 64bit encryption.

HTTP Basic Authentication is a transport layer protocol that is used when invoking a web service over HTTP. The key-value pair in the HTTP request header consists of the following parts:
  • The key "Authorization"
  • The value, a string composed of "Basic" + base64Encrypt(userid:password).

The serviceLib.getHTTPBasicAuthentication() function is available for the following subset of EGL-generated code:

  • Java™ services

Syntax

 serviceLib.getHTTPBasicAuthentication( 
  userID STRING out,
  password STRING out)
userID
The ID that was used to access the service
password
The password that was used to access the service

Example

The following example shows the getHTTPBasicAuthentication() function in context:

try
  userID String; //string to hold the returned user id
  password String; //string to hold the returned password
  serviceLib.getHTTPBasicAuthentication(userID,password);
onException(sbe ServiceBindingException)
  sysLib.setError(sbe.message);
end

Compatibility

Platform Issue
COBOL generation The getHTTPBasicAuthentication() function is not supported.