setHTTPBasicAuthentication()

The serviceLib.setHTTPBasicAuthentication() system function provides simple HTTP header authentication that uses 64–bit 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 serviceLib.setHTTPBasicAuthentication() function is available for the following subset of EGL-generated code: 

For details about the required CICS configuration, see "Deploying a web service requester to CICS."

Syntax

  serviceLib.setHTTPBasicAuthentication(variable Service | Interface in, 
  userID STRING in,
  password STRING in)

or

  serviceLib.setHTTPBasicAuthentication(
  userID STRING in,
  password STRING in)
variable
An optional variable that your code uses to access the service. This variable is a service or interface variable. EGL throws a ServiceBindingException if the variable is not a web service variable. To set the default UserID and Password for all services, use the second syntax.
userID
The ID that you use to access the service
password
The password that you use to access the service

Example

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

try
  serviceLib.setHTTPBasicAuthentication(userID,password); // set the default for all services
  serviceLib.setHTTPBasicAuthentication(accountServices, //works for accountServices only and overrides the default
      userID, password);
  onException(sbe ServiceBindingException)
    sysLib.setError(sbe.message);
end

Compatibility

Table 1. Compatibility considerations for setHTTPBasicAuthentication()
Platform Issue
COBOL generation The setHTTPBasicAuthentication() function is supported only for z/OS CICS.