invoker example

Moderator: crythias

Locked
amelendez
Znuny newbie
Posts: 1
Joined: 01 Jun 2015, 21:17
Znuny Version: OTRS 4.08
Real Name: Aldamis Melendez
Company: Stack Pointer

invoker example

Post by amelendez »

Hello

i am trying to make a call to an external webservice using the Generic Interface. But for this, i must activate an invoker. otrs has two example invokers (test.pm and testsimple.pm), but these are incomplete examples because in their codes instead of data, there are three points, making it hard to figure out how data should be indicated.

Code: Select all

=item PrepareRequest()

prepare the invocation of the configured remote webservice.

    my $Result = $InvokerObject->PrepareRequest(
        Data => {                               # data payload
            ...
        },
    );

    $Result = {
        Success         => 1,                   # 0 or 1
        ErrorMessage    => '',                  # in case of error
        Data            => {                    # data payload after Invoker
            ...
        },
    };
please, could you send me one example with data ( TicketID, State Ticket, the last actualitation date...) ?

thank you
erik0o
Znuny newbie
Posts: 5
Joined: 11 Apr 2016, 22:08
Znuny Version: 5.0.9

Re: invoker example

Post by erik0o »

hi men

I just set up a web service by following these steps first
I hope it helps you

1. make a copy of Test.pm in /opt/otrs/Kernel/GenericInterface/Invoker/Test
and name it OtherTest.pm (let it reside in the same directory for now)

2. change the package name in OtherTest.pm to reflect the name of the Invoker

3. add record for OtherTest in /opt/otrs/Kernel/Config/Files/GenericInterface.xml which will register the new operation with OTRS; basically just copy/paste and adjust the record which is already present for the Test invoker which you initially copied

4. now you can enable the operation in otrs Admin section (SysConfig > GenericInterface > GenericInterface::Invoker::ModuleRegistration)

5. your new OtherTest is now ready to be used from WebServices configuration screen
Locked