Generic Interface - TicketGet.AuthFail

Moderator: crythias

Locked
tchtam
Znuny newbie
Posts: 3
Joined: 31 Dec 2012, 23:48
Znuny Version: 3.1.11
Real Name: Thomas Tam
Company: CANARIE Inc.

Generic Interface - TicketGet.AuthFail

Post by tchtam »

Hi,

Our company has been using OTRS for while now, recently we are exploring a possibility of accessing the Ticket information through Generic Interface. The documentation provides an example of how to perform a TicketCreate, following the example I've managed to create new tickets. However what we want to do is to get a ticket information or search for open tickets.

I've altered the example script to turn it to a TicketGet script as follow, but I was getting an errorcode 'TicketGet.AuthFail'. Would anyone have any experience on that? Is there anything I could check or verify?

Thanks,
-Thomas

**** GetTicket Script ****
# <HTTP_TYPE>:://<OTRS_FQDN>/nph-genericinterface.pl/WebserviceID/<WEB_SERVICE_ID>
my $URL = 'http://127.0.0.1/otrs/nph-genericinterf ... tConnector';

# this name space should match the specified name space in the SOAP transport for the web service.
my $NameSpace = 'http://www.otrs.org/TicketConnector/';

# this is operation to execute, it could be TicketCreate, TicketUpdate, TicketGet, TicketSearch
# or SessionCreate. and they must to be defined in the web service.
my $Operation = 'TicketGet';

# this variable is used to store all the parameters to be included on a request in XML format, each
# operation has a determined set of mandatory and non mandatory parameters to work correctly, please
# check OTRS Admin Manual in order to get the complete list.
my $XMLData = '
<TicketGet>
<UserLogin>someuser</UserLogin>
<Password>someuserpwd</Password>
<TicketID>2012123110000011</TicketID>
</TicketGet>
';

# ---

# create a SOAP::Lite data structure from the provided XML data structure.
my $SOAPData = SOAP::Data
->type( 'xml' => $XMLData );

my $SOAPObject = SOAP::Lite
->uri($NameSpace)
->proxy($URL)
->$Operation($SOAPData);

# check for a fault in the soap code.
if ( $SOAPObject->fault ) {
print $SOAPObject->faultcode, " ", $SOAPObject->faultstring, "\n";
}

# otherwise print the results.
else {

# get the XML response part from the SOAP message.
my $XMLResponse = $SOAPObject->context()->transport()->proxy()->http_response()->content();

# deserialize response (convert it into a perl structure).
my $Deserialized = eval {
SOAP::Deserializer->deserialize($XMLResponse);
};

# remove all the headers and other not needed parts of the SOAP message.
my $Body = $Deserialized->body();

# just output relevant data and no the operation name key (like TicketCreateResponse).
for my $ResponseKey ( keys %{$Body} ) {
print Dumper( $Body->{$ResponseKey} );
}
}
joecopty
Znuny newbie
Posts: 22
Joined: 11 Jan 2013, 01:42
Znuny Version: 3.2.6
Real Name: Joseph Copty
Company: TMC

Re: Generic Interface - TicketGet.AuthFail

Post by joecopty »

I had a similar problem when using the
"SOAP::User" & "SOAP::Password" which you can set from SysConfig Settings in "Framework -> Core::SOAP"
However when I used a regular agents username and password, ie one you may use to logging to the OTRS system and their password.
Maybe you can crate a user for this purpose.
I am not sure why the SOAP::User & SOAP::Password don't work... It could be that they are used only when using rpc.pl since the description says:
"Defines the username/password to access the SOAP handle (bin/cgi-bin/rpc.pl). " And I think rps.pl has been replaced with :
# <HTTP_TYPE>:://<OTRS_FQDN>/nph-genericinterface.pl/Webservice/<WEB_SERVICE_NAME>
# or
# <HTTP_TYPE>:://<OTRS_FQDN>/nph-genericinterface.pl/WebserviceID/<WEB_SERVICE_ID>

ADDITIONALLY ,
TicketID refers to a different value than the ticket number you see. To find the ticket you are interested in find it using the OTRS Web User interface and look in the URL of the browser should look something like :
http://MyOTRSServer/otrs/index.pl?Actio ... icketID=27

This means the ticket ID you are after is : 27

If you do want to find a ticket based on the ticketNumber you may need to use TicketSearch first to get the TicketID
I hope this helps someone, and sorry if my answer is inaccurate.
cheers,
Joe
Sydney, Australia
OTRS 3.3.6 on Windows Server 2003, IIS6 with MSSQL database
vivek
Znuny newbie
Posts: 4
Joined: 20 Jun 2014, 16:00
Znuny Version: OTRS::ITSM 3.3.7
Real Name: VIVEK
Company: CSC

Re: Generic Interface - TicketGet.AuthFail

Post by vivek »

Hi,

I am working on the same requirement and also getting the same authentication error even with the new user.
Please let me know if anyone got the correct solution for this issue.

Thanks,
Vivek
Locked