Perl

The module Frontier::Client can be used for communication via XML-RPC in Perl. You can download the module from http://search.cpan.org/~rtfirefly/Frontier-RPC/lib/Frontier/Client.pm.

Here is an example of how to retrieve the key file for a given license in KA:

  1. Load required modules.

    use Frontier::Client;

    use MIME::Base64;

  2. Define variables. API login, API password, KA endpoint URL and key number. The URL for the KA endpoint must start with https://.

    $login = 'apilogin'; # username for API

    $pass = 'apipassword'; # password for API

    $url = 'https://kademo.swsoft.com:7050'; # server url

    $key = 'PLSK.00052355'; # key to retrieve

  3. Create new server Frontier::Client object.

    $server = Frontier::Client->new( 'url' => $url, 'debug' => 1 );

  4. Create named array for authInfo struct.

    %authInfo = ( login => $login,

    password => $pass);

  5. Send call with name of API method and all parameters. %authInfo is the named array (struct) and $key is the Keynumber to query as defined above. The response XML will be stored in $result.

    $results = $server->call('partner10.retrieveKey', \%authInfo, $key);

  6. Check result code. The resultCode will be an element in the returned XML response. Check if the call finished successfully or with error.

    if($results->{resultCode} != 100){

    die("\nError retrieving key: $key\n");

    }

  7. Retrieve data from XML. Extract the keynumber and the actual key file from the response XML. The key file is BASE64 encoded, it needs to be decoded.

    $key_number = $results->{keyNumber};

    $key_file = decode_base64($results->{key}->value()) . "\n";

  8. Write the key file to the file system (or database, etc).

    open(KEY, ">$key.sh");

    print KEY $key_file;

    close(KEY);

You can then try and install the Key file to the product.

Note: Your LWP::UserAgent installation needs to support https connections to be able to connect to KA Partner API.