SOAPLite:Creates Ticket on OTRS but Invaild Data

English! place to talk about development, programming and coding
Post Reply
pitchblack408
Znuny newbie
Posts: 21
Joined: 27 May 2011, 00:14
Znuny Version: 3.0.7
Real Name: Michael A Martin

SOAPLite:Creates Ticket on OTRS but Invaild Data

Post by pitchblack408 »

Hello,

So I used http://www.iniy.org/?p=20&lang=en as a guide.

My current setup
  • PC <------------------> OTRS Server
    OS: win 7 OS: win server 2003
    ActivePerl-5.12.3.1204 otrs-3.0.7
    with SOAP::Lite
    installed
My goal is to create tickets from the PC using SOAP::Lite.
I fallowed the steps from iniy.org

1- Login into your existing OTRS Installation as Admin
2- in the Menu under “Admin”->”Sysconfig” set Group to “Framework” and click “show”
3- In the list of subgroups click “Core::SOAP”
4- Check the boxes for SOAP::User: and SOAP::Password: and enter the values you like
5- click update

Then from the PC I run:

Code: Select all

use SOAP::Lite('autodispatch', proxy => 'http://myotrsserverip/otrs/rpc.pl');
my $User = 'some_user';
my $Pw = 'some_pass';
my $RPC = Core->new();
# create a new ticket number
my $TicketNumber = $RPC->Dispatch($User, $Pw, 'TicketObject','TicketCreateNumber');
print "RPC: New Ticketnumer created: ".$TicketNumber."\n";
my $TicketId = $RPC->Dispatch($User, $Pw, 'TicketObject', 'TicketCreate',
       TN => $TicketNumber,
       Title => 'Test Ticket',
       Queue => 'Raw',                # or QueueID => 123,
       Lock => 'unlock',
       PriorityID => 2,         # or PriorityID => 2,
       State => 'open',                # or StateID => 5,
       CustomerUser => 'mmartin',			# customer at example.com
       OwnerID => 1, # new owner
       ResponsibleID => 1, # new responsible
       UserID => 1,
);
print "RPC: New Ticket id is: $TicketId\n";
my $ArticleID =$RPC->Dispatch($User, $Pw, 'TicketObject', 'ArticleSend',
        TicketID         => $TicketId,
        ArticleType      => 'email-external',                   # email-external|email-internal|phone|fax|...
        SenderType       => 'agent',                           # agent|system|customer
        From             => 'root',  # not required but useful
        To               => 'customer', # not required but useful
        Cc               => '', # not required but useful
        ReplyTo          => '', # not required
        Subject          => 'Test Ticket',          # required
        Body             => "Test Body",                # required
        MessageID        => '',     # not required but useful
        Charset          => 'ISO-8859-15',
        HistoryType      => 'EmailCustomer',                     # EmailCustomer|Move|AddNote|PriorityUpdate|WebRequestCustomer|...
        HistoryComment   => 'Some free text!',
        UserID           => 1,
        NoAgentNotify    => 0,                                 # if you don't want to send agent notifications
        Type             => 'text/plain',
        Loop             => 0,                       # auto reject|auto follow up|auto follow up|auto remove
    );
I then log into OTRS as admin and I look in the RAW queue. A new ticket exits but there is no information
OTRS TICKET NO INFO.jpg
And if I click on it there is an error that occurs
error message.jpg

Code: Select all

$("#FixedTable tbody tr.Active").offset() is null

(?)([object Object])@http://localhost/otrs-web/js/js-cache/ModuleJS_d4dadc7d727479f12302f928ec003e30.js:97
(?)()@http://localhost/otrs/index.pl?Action=AgentTicketZoom;TicketID=14:571
Ready((function (j, s) {return new b.fn.init(j, s);}))@http://localhost/otrs-web/js/js-cache/CommonJS_135c8f5270a616743e81ff0eaeec77a0.js:580
trigger()@http://localhost/otrs-web/js/js-cache/CommonJS_135c8f5270a616743e81ff0eaeec77a0.js:37
trigger([object Event])@http://localhost/otrs-web/js/js-cache/CommonJS_135c8f5270a616743e81ff0eaeec77a0.js:37
How do I put information properly? What associations am I missing? I need help finding where to look next. Please help.
You do not have the required permissions to view the files attached to this post.
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: SOAPLite:Creates Ticket on OTRS but Invaild Data

Post by jojo »

your article creation did not work...

Have a look at the ticket-create.pl under http://blog.otrs.org/2010/11/11/proof-o ... -for-task/ for some more ideas...
"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
pitchblack408
Znuny newbie
Posts: 21
Joined: 27 May 2011, 00:14
Znuny Version: 3.0.7
Real Name: Michael A Martin

Re: SOAPLite:Creates Ticket on OTRS but Invaild Data

Post by pitchblack408 »

Thank you very much for the link. I removed my attempt to create the article and used the one that was in the link which you provided. It now populated the ticket and the error went away. The code from that article is below.

Code: Select all

# create new article
my $ArticleID = $RPC->Dispatch($User, $Pw, 'TicketObject', 'ArticleCreate',
TicketID         => $TicketId,
ArticleType      => 'phone',                # email-external|email-internal|phone|fax|...
SenderType       => 'customer',             # agent|system|customer
From             => $OTRS_CustomerFrom,     # not required but useful
To               => $OTRS_Queue,            # not required but useful
ReplyTo          => $OTRS_CustomerFrom,     # not required
Subject          => $OTRS_Subject,          # required
Body             => $OTRS_Body,             # required
Charset          => 'utf-8',
HistoryType      => 'PhoneCallCustomer',    # EmailCustomer|Move|AddNote|PriorityUpdate|WebRequestCustomer|...
HistoryComment   => 'Customer called us.',
UserID           => 3,
NoAgentNotify    => 0,                      # if you don't want to send agent notifications
MimeType         => 'text/plain',
Loop             => 0,                      # auto reject|auto follow up|auto follow up|auto remove
AutoResponseType => 'auto reply',
ForceNotificationToUserID => '',
OrigHeader       => {
'From' => $OTRS_CustomerFrom,
'To'   => $OTRS_Queue,
'Subject' => $OTRS_Subject,
'Body' => $OTRS_Body,
},
);
aaronm
Znuny newbie
Posts: 1
Joined: 20 Oct 2011, 23:46
Znuny Version: 3.0.6
Real Name: Aaron Mefford
Company: About.com

Re: SOAPLite:Creates Ticket on OTRS but Invaild Data

Post by aaronm »

The following code does the same as the original example without using autodispatch which is a bad idea in larger systems and will not work at all with some other libraries such as Moose. This example uses the OO interface instead to accomplish the same thing without toying with Perls global structures.

Code: Select all

#!/usr/bin/perl
use SOAP::Lite;

my $User = 'exampleuser';
my $Pw = 'examplepass';

my $otrs = new SOAP::Lite( proxy => 'http://localhost/otrs/rpc.pl',uri=> 'http://localhost/Core');
my $som; #SOAP message

# create a new ticket number
$som = $otrs->Dispatch($User, $Pw, 'TicketObject','TicketCreateNumber');
die $som->fault->{faultstring} if $som->fault;
my $TicketNumber = $som->result;
print "RPC: New Ticketnumer created: ".$TicketNumber."\n";

$som = $otrs->Dispatch($User, $Pw, 'TicketObject', 'TicketCreate',
       TN => $TicketNumber,
       Title => 'Test Ticket',
       Queue => 'Raw',                # or QueueID => 123,
       Lock => 'unlock',
       PriorityID => 2,         # or PriorityID => 2,
       State => 'open',                # or StateID => 5,
       CustomerUser => 'customer at example.com',
       OwnerID => 1, # new owner
       ResponsibleID => 1, # new responsible
       UserID => 1,
);
die $som->fault->{faultstring} if $som->fault;
my $TicketId = $som->result;
print "RPC: New Ticket id is: $TicketId\n";

$som =$otrs->Dispatch($User, $Pw, 'TicketObject', 'ArticleSend',
        TicketID         => $TicketId,
        ArticleType      => 'email-external',                   # email-external|email-internal|phone|fax|...
        SenderType       => 'agent',                           # agent|system|customer
        From             => 'root',  # not required but useful
        To               => 'customer', # not required but useful
        Cc               => '', # not required but useful
        ReplyTo          => '', # not required
        Subject          => 'Test Ticket',          # required
        Body             => "Test Body",                # required
        MessageID        => '',     # not required but useful
        Charset          => 'ISO-8859-15',
        HistoryType      => 'EmailCustomer',                     # EmailCustomer|Move|AddNote|PriorityUpdate|WebRequestCustomer|...
        HistoryComment   => 'Some free text!',
        UserID           => 1,
        NoAgentNotify    => 0,                                 # if you don't want to send agent notifications
        Type             => 'text/plain',
        Loop             => 0,                       # auto reject|auto follow up|auto follow up|auto remove
    );
die $som->fault->{faultstring} if $som->fault;
Post Reply