SOAP with perl

English! place to talk about development, programming and coding
Post Reply
drus
Znuny newbie
Posts: 4
Joined: 21 Dec 2010, 12:47
Znuny Version: 3.0.1

SOAP with perl

Post by drus »

Hello!

I don't undestand why I don't see the created ticket if calling rpc-example.pl from scripts folder.
Actually I'm running the following script :

Code: Select all

#!/usr/bin/perl -w

use strict;
use warnings;

use Data::Dumper;

# config
#use SOAP::Lite( 'autodispatch', proxy => 'http://127.0.0.1/otrs/rpc.pl' );
use SOAP::Lite;#( 'autodispatch', proxy => 'http://localhost/otrs/rpc.pl' );
my $User = 'soap_user';
my $Pw   = 'soap_user';

my $RPC = SOAP::Lite->new(proxy => 'http://localhost/otrs/rpc.pl');
#print Dumper($RPC);

# create a new ticket number
print "NOTICE: TicketObject->TicketCreateNumber()\n";
my $TicketNumber = $RPC->Dispatch( $User, $Pw, 'TicketObject', 'TicketCreateNumber' );
print "NOTICE: New Ticket Number is: $TicketNumber\n";

# create a ticket
my %TicketData = (
    Title        => 'rpc-example.pl test ticket',
    Queue        => 'Raw',
    Lock         => 'unlock',
    Priority     => 'low',
    State        => 'new',
    CustomerID   => 'www.otrs.com',
    CustomerUser => 'customer@example.com',
    OwnerID      => 1,
    UserID       => 1,
);

print "NOTICE: TicketObject->TicketCreate(%TicketData)\n";
my $TicketID = $RPC->Dispatch( $User, $Pw, 'TicketObject', 'TicketCreate', %TicketData => 1 )
    || die "Failed to create ticket: $!";
print "NOTICE: TicketID is $TicketID\n";

my %ArticleData = (
        TicketID         => 123,
        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
);

my $ArticleID =$RPC->Dispatch($User, $Pw, 'TicketObject', 'ArticleSend', %ArticleData => 1 );
print "NOTICE: ArticleID is $ArticleID \n";

exit 0;
It seems I get ok return-status after executing the script. But in fact, I don't see the new ticket via web-interface.
Any suggestions ?
ferrosti
Znuny superhero
Posts: 723
Joined: 10 Oct 2007, 14:30
Znuny Version: 3.0
Location: Hamburg, Germany

Re: SOAP with perl

Post by ferrosti »

Please fill in your signature! Version, etc.
What does the log say?
openSuSE on ESX
IT-Helpdesk: OTRS 3.0
Customer Service: OTRS 3.0 (upgraded from 2.3)
Customer Service (subsidiary): OTRS 3.0
+additional test and development systems
drus
Znuny newbie
Posts: 4
Joined: 21 Dec 2010, 12:47
Znuny Version: 3.0.1

Re: SOAP with perl

Post by drus »

ferrosti wrote:Please fill in your signature! Version, etc.
What does the log say?
I use OTRS 3.0.1. And I found no log messages related to SOAP. The last are
[Tue Dec 21 18:26:23 2010][Notice][Kernel::System::AuthSession::DB::RemoveSessionID] Removed SessionID 10716930b2307849c6dedb719724980937.
[Tue Dec 21 18:26:30 2010][Notice][Kernel::System::Auth::DB::Auth] User: soap_user authentication ok (REMOTE_ADDR: 195.160.233.15).
ferrosti
Znuny superhero
Posts: 723
Joined: 10 Oct 2007, 14:30
Znuny Version: 3.0
Location: Hamburg, Germany

Re: SOAP with perl

Post by ferrosti »

Could it be you have set up your OTRS using https instead of http?
I ran into this one myself a few weeks ago.
openSuSE on ESX
IT-Helpdesk: OTRS 3.0
Customer Service: OTRS 3.0 (upgraded from 2.3)
Customer Service (subsidiary): OTRS 3.0
+additional test and development systems
drus
Znuny newbie
Posts: 4
Joined: 21 Dec 2010, 12:47
Znuny Version: 3.0.1

Re: SOAP with perl

Post by drus »

I found the reason if the issue.
There is a bug in SOAP-Lite module used by OTRS.
ferrosti
Znuny superhero
Posts: 723
Joined: 10 Oct 2007, 14:30
Znuny Version: 3.0
Location: Hamburg, Germany

Re: SOAP with perl

Post by ferrosti »

Can you give some details about the bug?
openSuSE on ESX
IT-Helpdesk: OTRS 3.0
Customer Service: OTRS 3.0 (upgraded from 2.3)
Customer Service (subsidiary): OTRS 3.0
+additional test and development systems
Andre Bauer
Znuny guru
Posts: 2189
Joined: 08 Dec 2005, 17:01
Znuny Version: 5.0.x
Real Name: André Bauer
Company: Magix Software GmbH
Location: Dresden
Contact:

Re: SOAP with perl

Post by Andre Bauer »

Prod: Ubuntu Server 16.04 / Zammad 1.2

DO NOT PM ME WITH OTRS RELATED QUESTIONS! ASK IN THE FORUMS!

OtterHub.org
ameizen
Znuny newbie
Posts: 18
Joined: 25 Oct 2010, 16:10
Znuny Version: 2.4.7

Re: SOAP with perl

Post by ameizen »

Hi,
wie ist der aktuelle Status, da dieses Problem auch bei unserer OTRS-Installation vorliegt.

Gruß Ameizen
OTRS 3.0.5 (mit LDAP-Anbindung) auf PostgreSQL 8.3 und SLES11SP1 64Bit.
ferrosti
Znuny superhero
Posts: 723
Joined: 10 Oct 2007, 14:30
Znuny Version: 3.0
Location: Hamburg, Germany

Re: SOAP with perl

Post by ferrosti »

You haven´t read the link before, have you?
openSuSE on ESX
IT-Helpdesk: OTRS 3.0
Customer Service: OTRS 3.0 (upgraded from 2.3)
Customer Service (subsidiary): OTRS 3.0
+additional test and development systems
ameizen
Znuny newbie
Posts: 18
Joined: 25 Oct 2010, 16:10
Znuny Version: 2.4.7

Re: SOAP with perl

Post by ameizen »

Hi,
sorry I didn't saw that I'm in the english area. I resolved the problem with the default perl-soap-lite.rpm from my SLES11 64Bit system.
It was v0.710.08 !!

Greetz Ameizen
OTRS 3.0.5 (mit LDAP-Anbindung) auf PostgreSQL 8.3 und SLES11SP1 64Bit.
Post Reply