Otrs TestSimple.pm (Invoker)

Moderator: crythias

Post Reply
MaxMaz
Znuny newbie
Posts: 30
Joined: 08 Sep 2015, 17:06
Znuny Version: 3.3.9

Otrs TestSimple.pm (Invoker)

Post by MaxMaz »

Hello everyone i would like to add in otrs invoker request (TestSimple.pm) more parameters than TicketID.
For example TicketNumber and Title and many Others.
TestSimple works fine but for only TickedID so anyone knows how help me?
MaxMaz
Znuny newbie
Posts: 30
Joined: 08 Sep 2015, 17:06
Znuny Version: 3.3.9

Re: Otrs TestSimple.pm (Invoker)

Post by MaxMaz »

changed this

Code: Select all

    return {
        Success => 1,
       Data    => $Param{Data},
    };
with

Code: Select all

	return {
			Success => 1,
			Data => {
			            TicketID => 'TicketID',
						Title => 'Title',
					},
			};
and i got on my webservice this 2 parameters.

but how can return a TicketID value instead 'TicketID' and Title value instead 'Title' ???????

already tried with

Code: Select all

TicketID => TicketID,
or

Code: Select all

TicketID => $Param{Data} => TicketID,
but without success!!!!!
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Otrs TestSimple.pm (Invoker)

Post by RStraub »

I think that's a file for testing. If you want to configure your own module, see the manual, there are examples that should give you a good idea about how to write it:
http://otrs.github.io/doc/manual/admin/ ... rface.html
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
MaxMaz
Znuny newbie
Posts: 30
Joined: 08 Sep 2015, 17:06
Znuny Version: 3.3.9

Re: Otrs TestSimple.pm (Invoker)

Post by MaxMaz »

RStraub wrote:I think that's a file for testing. If you want to configure your own module, see the manual, there are examples that should give you a good idea about how to write it:
http://otrs.github.io/doc/manual/admin/ ... rface.html
sorry where???

i didnt find it
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Otrs TestSimple.pm (Invoker)

Post by RStraub »

Close to the bottom, headlined as "Perl SOAP Requester".
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
MaxMaz
Znuny newbie
Posts: 30
Joined: 08 Sep 2015, 17:06
Znuny Version: 3.3.9

Re: Otrs TestSimple.pm (Invoker)

Post by MaxMaz »

Unfortunately i dont know perl, how can update TestSimple.pm for it???'
eandrex
Znuny expert
Posts: 213
Joined: 04 Nov 2012, 23:58
Znuny Version: OTRS 4.x
Real Name: Esteban
Company: NORTON DE COLOMBIA

Re: Otrs TestSimple.pm (Invoker)

Post by eandrex »

To achieve that, you would need an instance of http://otrs.github.io/doc/api/otrs/3.3/ ... et.pm.html

then invoke TicketGet

Something like

Code: Select all

...
my %Ticket = $TicketObject->TicketGet( TicketID => $Param{Data}->{TicketID} );

return {
  Success => 1,
  Data => {
   %Ticket
  }
};
MaxMaz
Znuny newbie
Posts: 30
Joined: 08 Sep 2015, 17:06
Znuny Version: 3.3.9

Re: Otrs TestSimple.pm (Invoker)

Post by MaxMaz »

Eandrex doesn't works please help cause i dont know perl

My TestSimple.pm changed by your advice

Code: Select all

package Kernel::GenericInterface::Invoker::Test::TestSimple;

use strict;
use warnings;
use Kernel::System::Ticket;
use Kernel::System::VariableCheck qw(IsString IsStringWithData);

our $ObjectManagerDisabled = 1;

sub new {
    my ( $Type, %Param ) = @_;

    # allocate new hash for object
    my $Self = {};
    bless( $Self, $Type );

    # check needed params
    if ( !$Param{DebuggerObject} ) {
        return {
            Success      => 0,
            ErrorMessage => "Got no DebuggerObject!"
        };
    }

    #$Self->{DebuggerObject} = $Param{DebuggerObject};
	
	$Self->{TicketObject} = Kernel::System::Ticket->new( %Param );

    return $Self;
}

sub PrepareRequest {
    my ( $Self, %Param ) = @_;
	
	my %Ticket = $TicketObject->TicketGet( TicketID => $Param{Data}->{TicketID} );

	return {
			Success => 1,
			Data => {
						%Ticket
					}
			};
}

sub HandleResponse {
    my ( $Self, %Param ) = @_;

    # if there was an error in the response, forward it
    if ( !$Param{ResponseSuccess} ) {
        return {
            Success      => 0,
            ErrorMessage => $Param{ResponseErrorMessage},
        };
    }

    return {
        Success => 1,
        Data    => $Param{Data},
    };
}

1;
there is some errors im sure
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Otrs TestSimple.pm (Invoker)

Post by RStraub »

So you have no experience in perl, won't tell us what you need or what the error is and expect this forum to write the module for you :/ ?
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
MaxMaz
Znuny newbie
Posts: 30
Joined: 08 Sep 2015, 17:06
Znuny Version: 3.3.9

Re: Otrs TestSimple.pm (Invoker)

Post by MaxMaz »

ok sorry but i wrote a new TestSimple.pm module with Eandrex's suggests.
Unfortunately otrs return a generic error "can't load module"
Dont want that forum write it for me, indeed i post my module with error
jojo
Znuny guru
Posts: 15019
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Otrs TestSimple.pm (Invoker)

Post by jojo »

Hire an expert
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
MaxMaz
Znuny newbie
Posts: 30
Joined: 08 Sep 2015, 17:06
Znuny Version: 3.3.9

Re: Otrs TestSimple.pm (Invoker)

Post by MaxMaz »

jojo wrote:Hire an expert
ahah very very nice behaviour...thanks :)
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Otrs TestSimple.pm (Invoker)

Post by crythias »

I'm with jojo. This forum is volunteer. The code is in perl. Perl isn't that difficult to learn and this forum isn't a perl instruction forum.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
MaxMaz
Znuny newbie
Posts: 30
Joined: 08 Sep 2015, 17:06
Znuny Version: 3.3.9

Re: Otrs TestSimple.pm (Invoker)

Post by MaxMaz »

I asked an help if you want give me ok else dont reply no-Friendly message Just for +1
Jojo could avoid that Kind of messag.
Jojo is free to answer or not ŕight but i dont accettare bis answer.
Crithia are you moderator??? It seems not
Post Reply