Usage of OTRS Modules

English! place to talk about development, programming and coding
Post Reply
mohan
Znuny newbie
Posts: 19
Joined: 10 May 2010, 07:20
Znuny Version: 2.4

Usage of OTRS Modules

Post by mohan »

Hi,

I'm very new to perl scripting. Is there any one who could help me out in solving this issue? Im trying to use otrs modules in php script. But im getting error. Please help me in solving this issue.

The code is
<?php

$perl = new Perl();
$perl->eval("BEGIN {unshift( @INC, '/opt/otrs/Kernel/Modules/'); }");
$perl->eval("BEGIN {unshift( @INC, '/opt/otrs/Kernel/System/'); }");
$perl->eval('use opt::otrs::Kernel::Modules::AgentTicketSearch;');

$p = new Perl("opt::otrs::Kernel::Modules::AgentTicketSearch");
$p->Run();
var_dump($p);
?>



The error is
Fatal error: Uncaught exception 'PerlException' with message '[perl] eval error: Can't locate opt/otrs/Kernel/Modules/AgentTicketSearch.pm in @INC (@INC contains: /opt/otrs/Kernel/System/ /opt/otrs/Kernel/Modules/ /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at (eval 3) line 1. BEGIN failed--compilation aborted (in cleanup) Can't locate opt/otrs/Kernel/Modules/AgentTicketSearch.pm in @INC (@INC contains: /opt/otrs/Kernel/System/ /opt/otrs/Kernel/Modules/ /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at (eval 3) line 1. BEGIN failed--compilation aborted at (eval 3) line 1. ' in /var/www/mohan/t4.php:6 Stack trace: #0 /var/www/mohan/t4.php(6): Perl->eval('use opt::otrs::...') #1 {main} thrown in /var/www/mohan/t4.php on line 6

Thanks in advance
Mike_B
Moderator
Posts: 266
Joined: 12 Jan 2010, 18:16
Znuny Version: CVS HEAD

Re: Usage of OTRS Modules

Post by Mike_B »

Hi Mohan,

it might be my inexperience with accessing Perl modules from PHP, but generally I would recommend that if you want to work with OTRS modules directly, you should stick with Perl. This would in my opinion be a lot easier to maintain.

If you want to write PHP, that is of course also possible, but then please leverage our SOAP interface, as described on our wiki:

http://wiki.otrs.org/index.php?title=Cr ... HP_via_RPC

Regards,

Mike.
huntingbears.nl - @michielbeijen on Twitter
mohan
Znuny newbie
Posts: 19
Joined: 10 May 2010, 07:20
Znuny Version: 2.4

Re: Usage of OTRS Modules

Post by mohan »

I used the code in the link. I run that in the browser by saving that code in a file by name soap.php. I got this output.
is the output correct? if not how could i use that code? please suggest me......


Test SOAP-interface of OTRS

Fatal error: Uncaught SoapFault exception: [HTTP] Not Found in /var/www/mohan/soap.php:40 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://example....', 'Core#Dispatch', 1, 0) #1 /var/www/mohan/soap.php(40): SoapClient->__soapCall('Dispatch', Array) #2 {main} thrown in /var/www/mohan/soap.php on line 40
Mike_B
Moderator
Posts: 266
Joined: 12 Jan 2010, 18:16
Znuny Version: CVS HEAD

Re: Usage of OTRS Modules

Post by Mike_B »

I guess it is because you did not change the value for $url - and your script now tries to connect to example.com which does not exist?
huntingbears.nl - @michielbeijen on Twitter
mohan
Znuny newbie
Posts: 19
Joined: 10 May 2010, 07:20
Znuny Version: 2.4

Re: Usage of OTRS Modules

Post by mohan »

I have changed $user and $password and also $url But did not modify any thing other than this. The code remains the same as in the link but getting this.

Test SOAP-interface of OTRS

Fatal error: Uncaught SoapFault exception: [HTTP] Internal Server Error in /var/www/mohan/soap.php:40 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://localhos...', 'Core#Dispatch', 1, 0) #1 /var/www/mohan/soap.php(40): SoapClient->__soapCall('Dispatch', Array) #2 {main} thrown in /var/www/mohan/soap.php on line 40
mohan
Znuny newbie
Posts: 19
Joined: 10 May 2010, 07:20
Znuny Version: 2.4

Re: Usage of OTRS Modules

Post by mohan »

Hi, I'm using this code

Code: Select all

<?php
    	
	$perl = new Perl();
	$perl->eval("BEGIN {unshift( @INC, '/opt/otrs/Kernel/Modules'); }");
	$perl->eval("BEGIN {unshift( @INC, '/opt/otrs/Kernel/System'); }");
	$perl->eval('use opt::otrs::Kernel::Modules::CustomerTicketSearch;');
	//$perl->eval('InterfaceCustomer->new(Debug => $Debug, WebRequest => $WebRequest);');
	//$Interface=opt::otrs::Kernel::System::Web::InterfaceCustomer->new(Debug => $Debug, WebRequest => $WebRequest);
	$p = new Perl("CustomerTicketSearch");
	//$ar = array($p->{ParamObject}->GetParam('Param' => $Entry->[1] ));
	var_dump($p);
	//print "$ar[0]";
?>
If i run this code i get this error
Fatal error: Uncaught exception 'PerlException' with message '[perl] eval error: Can't locate opt/otrs/Kernel/Modules/CustomerTicketSearch.pm in @INC (@INC contains: /opt/otrs/Kernel/System /opt/otrs/Kernel/Modules /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at (eval 3) line 1. BEGIN failed--compilation aborted (in cleanup) Can't locate opt/otrs/Kernel/Modules/CustomerTicketSearch.pm in @INC (@INC contains: /opt/otrs/Kernel/System /opt/otrs/Kernel/Modules /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at (eval 3) line 1. BEGIN failed--compilation aborted at (eval 3) line 1. ' in /var/www/mohan/t4.php:6 Stack trace: #0 /var/www/mohan/t4.php(6): Perl->eval('use opt::otrs::...') #1 {main} thrown in /var/www/mohan/t4.php on line 6
Post Reply