SOAP Example “Hot Potatoe Reporting” – Part 2

Jens Bothe28. May 2010 | Best PracticesDevelopment


The practical examples presented in our technical blog ( and now in the expert category in our FAQ blog section serve as a source of ideas and documentation to show what is theoretically possible with OTRS in concrete scenarios or sometimes even for more exotic configurations. All configurations presented here were developed under laboratory conditions as a proof of concept. 

We can only guarantee testing and implementation of these concepts to be error-free and productive if implemented in a workshop with one of our OTRS consultants. Without this, the responsibility lies with the customer himself. Please note that configurations from older OTRS versions may not work in the newer ones.

Now the complete script for the “Hot Potatoes”

jb$ ./ -m 6
NOTICE: Ticket#2010010610000011 (4) - number of used Queues: 8 - Limit: 6

The option -m defines the max. number of allowed Queues. If the number of used Queues for the ticket is greater than this value, the Ticketnumber will be given by the script on STDOUT..

You’ll find some more options for TicketSearch on the API description.

You’ll need to activate the SOAP interface of OTRS via SysConfig first. Perl SOAP::Lite will be needed by this script.

#!/usr/bin/perl -w
# SOAP Config
use SOAP::Lite( 'autodispatch', proxy => 'http://otrsserver/otrs/' );
my $SOAP_User = 'otrs';
my $SOAP_Pass = 'test';

# getting TicketID
use Getopt::Std;
my %opts;
getopts( 'm:', \%opts );
if ( !$opts{m} ) {
    print STDERR "ERROR: Need -m Maximum Queues\n";
    exit 1;
# SOAP script
my $RPC = Core->new();

# Getting all Open Tickets
my @TicketIDs = $RPC->Dispatch( $SOAP_User, $SOAP_Pass, 'TicketObject', 'TicketSearch',
        Limit  => 100000,
        Result => 'ARRAY',
        UserID => 1,
#       Queues   => ['system queue', 'other queue'],
#       UseSubQueues => 1,
        StateType    => ['open', 'new', 'pending reminder'],

# Start of for statement
for my $TicketID (@TicketIDs) {
        my @QueueList = $RPC->Dispatch( $SOAP_User, $SOAP_Pass, 'TicketObject', 'MoveQueueList',
                TicketID => $TicketID,
                Type     => 'Name',
        my $TicketNumber = $RPC->Dispatch( $SOAP_User, $SOAP_Pass, 'TicketObject', 'TicketNumberLookup',
                TicketID => $TicketID,
        $QL = scalar @QueueList;
        if ( $opts{m} < $QL )
                print "NOTICE: Ticket#$TicketNumber ($TicketID) - number of used Queues: $QL - Limit: $opts{m}\n";
exit 0;

bijal at 06.08.2010, 12:56

Hello, When i run the script it is showing error "Denied access to method (Dispatch) in class (main) at /usr/local/share/perl/5.10.0/SOAP/ line 2733." You know how to solve this error.. Plz help me to solve this issue. Thanks, Bijal

johnn at 28.05.2010, 11:52

Great to have a worked example of the soap interface in action. BTW, singular of potatoes is potato, despite Dan Quayle's opinion: :)

Your email address will not be published.