SOAP Example: “Hot Potatoe Reporting” – Part 1

Jens Bothe26. May 2010 | Best PracticesDevelopment

The script will return the number of used queues per ticket. The number of moves is this number less 1.

You need to activate the SOAP Interface via SysConfig first!

#!/usr/bin/perl -w
# SOAP Config
use SOAP::Lite( 'autodispatch', proxy => 'http://otrsserver/otrs/rpc.pl' );
my $SOAP_User = 'otrs';
my $SOAP_Pass = 'test';
 
# getting TicketID
use Getopt::Std;
my %opts;
getopts( 'i:', \%opts );
if ( !$opts{i} ) {
    print STDERR "ERROR: Need -i TicketID\n";
    exit 1;
}
# SOAP script
my $RPC = Core->new();
 
my @QueueList = $RPC->Dispatch( $SOAP_User, $SOAP_Pass, 'TicketObject', 'MoveQueueList',
        TicketID => $opts{i},
        Type     => 'Name',
    );
my $TicketNumber = $RPC->Dispatch( $SOAP_User, $SOAP_Pass, 'TicketObject', 'TicketNumberLookup',
        TicketID => $opts{i},
    );
$QL = scalar @QueueList;
print "NOTICE: Ticket#$TicketNumber ($opts{i}) - number of moves is $QL\n";
exit 0;

Running it  will look like this:


jb$ ./rpc_getmove.pl -i 4
NOTICE: Ticket#2010010610000011 (4) - number of moves is 8

#3
Fabi at 25.10.2018, 20:00

Please, I'm newbee at otrs soap/rest connections. Can you help me? I tried run the script, but occurs the error: syntax error near unexpected token `(' `use SOAP::Lite( 'autodispatch', proxy => 'http://ip_address/otrs/rpc.pl' );' Thank you very very much! Regards, Fabi

#2
Jens Bothe at 27.05.2010, 08:35

Thanks for yor feedback, I fixed it

#1
Rotten at 27.05.2010, 00:34

I think the various '=&gt' should be '=>'

Your email address will not be published. Required fields are marked *

This site uses cookies. By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close