Package DE_EPAGES::Core::API::Object::RestClient
base class for rest clients
Base |
DE_EPAGES::Core::API::Object::BaseObject |
Functions
getBaseURL
Returns the rest service base URL like http://localhost:8088/rs/. This
lookup method first checks epages.conf section [REST_SERVICE] key $Alias
after that key 'default'. If both keys are not found in epages.conf this
method checks the enviroment EPAGESJ_PORT and EPAGESJ_HOST to build an URI
or use thier respective defaults. Default: http://localhost:8088/rs/.
optinal entries epages.conf
[REST_SERVICE]
; is used if service name is not known default to
default=http://localhost:8088/rs/
; dedicated host for pdf creating
pdf=http://otherhost:8099/rs/
It is also possible to overwrite this value with constructor parameter
BaseURL. See new
Syntax |
my $URI = $Client->getBaseURL(); |
Return |
|
getServiceURL
Returns the url for a service. (e.g. 'http://localhost:8088/rs/pdf')
Syntax |
my $Url = $Client->getServiceURL(); |
Return |
|
logger
Prints output to a file for logging and debugging purposes. Log4Perl Category is REST_SERVICE. e.g. "REST_SERVICE::pdf"
Syntax |
$Client->logger($Type, $Status, $Content); |
Input |
|
new
Create a new rest-client object. Options Alias and Header are requiered. The provided Alias will be used as of part of request URL and some config lookups. Currently only 'pdf' service is compatible with this client (Other values will most likely yield a 404). RestClient
Syntax |
my $Client = DE_EPAGES::Core::API::Object::RestClient->new( 'Alias' => 'pdf', 'Header' => { 'Content_Type'=>'text/html', }, ); |
Example |
my $Client = DE_EPAGES::Core::API::Object::RestClient->new( 'Alias' => 'pdf', 'Header' => { 'Content_Type'=>'text/html', }, 'UserAgent' => $TestUserAgent, 'BaseURL' => 'http://qa-test-vm:8088/rs/'; ); |
Input |
|
Return |
|
sendRequest
Send a request to the service provider and return the answer.
Syntax |
my $Answer = $Client->sendRequest( $Content ); |
Input |
|
Return |
|