Requester#

NAME#

Kernel::GenericInterface::Requester - GenericInterface handler for sending web service requests to remote providers

PUBLIC INTERFACE#

new()#

create an object. Do not create it directly, instead use:

my $RequesterObject = $Kernel::OM->Get('Kernel::GenericInterface::Requester');

Run()#

receives the current incoming web service request, handles it, and returns an appropriate answer based on the configured requested web service.

my $Result = $RequesterObject->Run(
    WebserviceID => 1,                      # ID of the configured remote web service to use OR
    Invoker      => 'some_operation',       # Name of the Invoker to be used for sending the request
    Asynchronous => 1,                      # Optional, 1 or 0, defaults to 0
    Data         => {                       # Data payload for the Invoker request (remote web service)
       #...
    },
    PastExecutionData => {                  # Meta data containing information about previous request attempts, optional
        #...
    }
);

$Result = {
    Success      => 1,   # 0 or 1
    ErrorMessage => '',  # if an error occurred
    Data         => {    # Data payload of Invoker result (web service response)
        #...
    },
};

in case of an error if the request has been made asynchronously it can be re-schedule in future if the invoker returns the appropriate information

$Result = {
    Success      => 0,   # 0 or 1
    ErrorMessage => 'some error message',
    Data         => {
        ReSchedule    => 1,
        ExecutionTime => '2015-01-01 00:00:00',     # optional
    },
};

_HandleError()#

handles errors by - informing invoker about it (if supported) - calling an error handling layer

my $ReturnData = $RequesterObject->_HandleError(
    InvokerObject     => $InvokerObject,
    Invoker           => 'InvokerName',
    DebuggerObject    => $DebuggerObject,
    WebserviceID      => 1,
    WebserviceConfig  => $WebserviceConfig,
    DataInclude       => $DataIncludeStructure,
    ErrorStage        => 'PrepareRequest',              # at what point did the error occur?
    Summary           => 'an error occurred',
    Data              => $ErrorDataStructure,
    PastExecutionData => $PastExecutionDataStructure,   # optional
);

my $ReturnData = {
    Success      => 0,
    ErrorMessage => $Param{Summary},
};