Создание заявок perl скриптом 401 Autorization Required

Запросы на решение проблем

Модератор: ykolesnikov

Ответить
Elrengil
OTRS Новобранец
Сообщения: 104
Зарегистрирован: 18 июл 2012, 13:29

Создание заявок perl скриптом 401 Autorization Required

Сообщение Elrengil » 09 янв 2014, 15:55

Прошу помощи с perl скриптом по создании заявок в OTRS.
Web Service в OTRSе настроен
При запуске скрипта получаю сообщение 401 Autorization Required at create-ticket2.pl line 78
Скрипт пробовал запускать от пользователей root, так и от otrs
В UserLogin и Password указываю логин и пароль из Framework -> Core::SOAP

Код: Выделить всё

#!/usr/bin/perl -w

use strict;
use warnings;

use File::Basename;
use FindBin qw($RealBin);
use lib dirname($RealBin);

use SOAP::Lite;
use Data::Dumper;


my $URL =  'http://otrs.trololo.com/otrs/nph-genericinterface.pl/Webservice/soapme' ;

my $NameSpace = '/otrs/nph-genericinterface.pl/Webservice/soapme';

my $Operation = 'TicketCreate';

my $XMLData = '
<UserLogin>mysoap</UserLogin>
<Password>mysoap</Password>
<Ticket>
    <Title>some title</Title>
    <CustomerUser>service_account</CustomerUser>
    <Queue>first_line</Queue>
    <State>new</State>
    <Priority>3 normal</Priority>
</Ticket>
<Article>
    <Subject>some subject</Subject>
    <Body>some body</Body>
    <ContentType>text/plain; charset=utf8</ContentType>
</Article>
';

# 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} );
    }
}
OTRS ITSM 4.09 Apache/2.4.6 (CentOS) MySQL

alexus
OTRS Гуру
Сообщения: 5192
Зарегистрирован: 20 сен 2010, 18:17
Откуда: Москва
Благодарил (а): 92 раза
Поблагодарили: 82 раза

Re: Создание заявок perl скриптом 401 Autorization Required

Сообщение alexus » 10 янв 2014, 02:48

Надо передавать логин и пароль реального агента или клиента.
С уважением,
Алексей Юсов

Prod: OTRS CE ITSM 6.0.28 on CentOS 7 Apache 2.4 MariaDB 10.4.13 + Radiant Customer Portal

Radiant System OTRS Intergrator RU
Группа OTRS Community в Teleram
Хотите внедрить OTRS? Спросите меня как!

Elrengil
OTRS Новобранец
Сообщения: 104
Зарегистрирован: 18 июл 2012, 13:29

Re: Создание заявок perl скриптом 401 Autorization Required

Сообщение Elrengil » 10 янв 2014, 18:01

Пробовал вводить логин и пароль агента, результат тотже

в логе ошибок апатча пишет Bad/Missing NTLM/Basic Authorization Header for /otrs/nph-genericinterface.pl/Webservice/soapme'
OTRS ITSM 4.09 Apache/2.4.6 (CentOS) MySQL

Tuxper
OTRS Новобранец
Сообщения: 33
Зарегистрирован: 14 мар 2012, 16:47

Re: Создание заявок perl скриптом 401 Autorization Required

Сообщение Tuxper » 11 фев 2014, 12:22

Core::SOAP
Тут задается логин и пароль для взаимодействия по SOAP.

Elrengil
OTRS Новобранец
Сообщения: 104
Зарегистрирован: 18 июл 2012, 13:29

Re: Создание заявок perl скриптом 401 Autorization Required

Сообщение Elrengil » 17 фев 2014, 12:42

Пароль в Core::SOAP задан
я изначально пробовал запускать с ним
OTRS ITSM 4.09 Apache/2.4.6 (CentOS) MySQL

alexander-spiridonov
OTRS Новобранец
Сообщения: 25
Зарегистрирован: 25 окт 2015, 06:55
Откуда: Буртия

Re: Создание заявок perl скриптом 401 Autorization Required

Сообщение alexander-spiridonov » 11 ноя 2015, 04:18

Столкнулся с этим же косяком! Решил его Кто нибудь?!
OTRS 4.0.13, Ubuntu 14.04, MySQL5

alexander-spiridonov
OTRS Новобранец
Сообщения: 25
Зарегистрирован: 25 окт 2015, 06:55
Откуда: Буртия

Re: Создание заявок perl скриптом 401 Autorization Required

Сообщение alexander-spiridonov » 11 ноя 2015, 04:45

Если кому будет интересно решается это добавлением в <Directory "/opt/otrs/bin/cgi-bin/">


<Files "rpc.pl">
AuthType None
Require all granted
Satisfy Any
</Files>


Если делали по этой http://habrahabr.ru/post/264617/ инструкции
OTRS 4.0.13, Ubuntu 14.04, MySQL5

Ответить