OTRS получает внутреннюю ошибку сервера при создании заявки - PullRequest
1 голос
/ 18 февраля 2020

У меня проблема с созданием заявки с помощью интерфейса c. Я использую Perl через SOAP API. Я создал веб-сервис с GenericTicketConnector.yml.

Я посмотрел на отладчик веб-службы, и единственные данные, которые не предоставлены, - это данные TicketCreate.

Я загрузил скрипт на удаленный сервер (Unix), где хранятся файлы с использованием WinSCP и запускаю скрипт с использованием соединения Putty S SH.

Сообщение об ошибке: 500 Internal Server Error

# this is the URL for the web service
# the format is
# <HTTP_TYPE>:://<OTRS_FQDN>/nph-genericinterface.pl/Webservice/<WEB_SERVICE_NAME>
# or
# <HTTP_TYPE>:://<OTRS_FQDN>/nph-genericinterface.pl/WebserviceID/<WEB_SERVICE_ID>
my $URL = 'http://localhost/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnector';

# 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 = 'TicketCreate';

# 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 = '
<UserLogin>pp</UserLogin>
<Password>********</Password>
<Ticket>
    <Title>some title</Title>
    <CustomerUser>Jan2804</CustomerUser>
    <Queue>raw</Queue>
    <State>open</State>
    <Type>Incident</Type>
    <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 ( sort keys %{$Body} ) {
        print Dumper( $Body->{$ResponseKey} );    ## no critic
    }
}

1 Ответ

0 голосов
/ 06 апреля 2020

Попробуйте открыть веб-сервис в вашем браузере. Это работает?

Я недавно сделал это для себя. Я использовал REST yml файл. Я также назвал мой веб-сервис GenericTicketConnectorREST. Но вы также должны получить ответ, а также

Следующий URI доступен для меня через браузер

http://otrs-test.company.local/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Ticket?UserLogin=username&Password=testtesttest

...