NAME
Business::Bof::Client -- Client interface to Business Oriented Framework
SYNOPSIS
use Business::Bof::Client;
my $client = new Business::Bof::Client(server => localhost,
port => 12345,
session => myserver
);
my $sessionId = $client->login({
name => $username,
password => $password
});
my $parms = {
'!Table' => 'order, customer',
'!TabJoin' => 'order JOIN customer USING (contact_id)',
'$where' => 'ordernr = ?',
'$values' => [ $ordernr ]
};
$result = $client -> getData($parms);
$showresult = Dumper($result);
print "getData: $showresult\n";
DESCRIPTION
Business::Bof::Client is a Perl interface to the Business Oriented Framework Server. It is meant to ease the pain of accessing the server, making SOAP programming unnecessary.
Method calls
- $obj = new(server => $hostname, port => $portnr, session => $session)
-
Instantiates a new client and performs a connection to the server with the information given. Will fail if no server is active at that address.
- $sessionId = $obj -> login({name => $username, password => $password});
-
Creates a session in the server and returns an ID. This ID is for the pleasure of the user only.
name and password must be a valid pair in the Framework Database.
- $obj -> logout()
-
Will terminate the session in the server and delete all working data.
- $obj -> getClientdata()
-
Returns a hash ref with
a) The data provided in the configuration file under the section
ClientSettings
.b) Some data from the current session to be used by the client.
- $obj -> getData($parms);
-
The purpose of getData is to request a set of data from the server. The format of the request is the same as is used by DBIx::Recordset. E.g.:
my $parms = { '!Table' => 'order, customer', '!TabJoin' => 'order JOIN customer USING (contact_id)', '$where' => 'ordernr = ?', '$values' => [ $ordernr ] };
- $obj -> cacheData($cachename, $somedata);
-
cacheData will let the server save some data for the client. It is very useful in a web environment, where the client is stateless. E.g.:
my $data = { foo => 'bar', this => 'that' }; $obj -> cacheData('some data', $data);
- $obj -> getCachedata($cachename);
-
getCachedata retrieves the cached data, given the right key. E.g.:
$thedata = $obj -> getCachedata('some data');
- $obj -> getTask($sessionId, $taskId);
-
The server returns the task with the given taskId.
- $obj -> getTasklist($sessionId);
-
The server returns the list of tasks.
- $obj -> printFile
-
printFile will print a file from Bof's queue system. The given parameter indicates which file is to be printed.
It looks like this:
$parms = { type => 'doc' or 'print', file => $filename, queue => $queuename };
- $obj -> getPrintfile
-
getPrintfile works like printFile, exept it returns the file instead of printing it.
- $obj -> getPrintfilelist
-
getPrintfilelist returns an array containing information about the files in the chosen queue
$parms = { type => 'doc' or 'print', queue => $queuename };
- $obj -> getQueuelist
-
getQueuelist returns an array containing information about the available queues.
$parms = { type => 'doc' or 'print', };
- $obj -> callMethod
-
The main portion of the client call will be callMethod. It will find the class and method, produce a new instant and execute it with the given data as parameter.
It looks like this:
$parms = { class => 'myClass', data => $data, method => 'myMethod', [long => 1, task => 1 ] };
$res = $obj -> callMethod($parms);
Two modifiers will help the server determine what to do with the call.
If
long
is defined, the server will handle it as a long running task, spawning a separate process.If
task
is defined, the server will not execute the task immediately, but rather save it in the framework's task table. The server will execute it later depending on the server's configuration settings.
AUTHOR
Kaare Rasmussen <kar at kakidata.dk>