perl - OTRS 创建票证时出现内部服务器错误
问题描述
我在使用通用接口创建票证时遇到问题。我通过 SOAP api 使用 Perl。我使用 GenericTicketConnector.yml 创建了一个 Web 服务。
我查看了 web 服务的调试器,唯一没有提供的数据是 TicketCreate 的数据。
我将脚本上传到使用 WinSCP 存储文件的远程(Unix),并使用 Putty SSH 连接运行脚本。
错误消息:500 内部服务器错误
# 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
}
}
解决方案
尝试在浏览器中打开网络服务。它在工作吗?
我最近为自己做了。我使用了 REST yml 文件。我还调用了我的网络服务 GenericTicketConnectorREST。但你也应该得到一些答案
我可以通过浏览器访问以下 URI
推荐阅读
- c# - 如何实现一个控制器动作调用另一个控制器中的另一个动作?
- excel - 如何进行“跨 Excel 版本”测试?我的 OpenPyXL 生成的 .xlsx 文件在 Mac、LibreOffice 和 Google 表格上看起来不同
- asynchronous - 将请求正文转发到 Actix-Web 中的响应
- chef-infra - 厨师防火墙食谱不适用于自定义 JSON 对象
- c - 生成 6 个随机数时如何检查以确保没有重复?
- python - 在分隔符处拆分python字符串,但在特定的分隔符处
- javascript - 无法调用 jQuery 函数
- c# - Memory leak on unawaited tasks which throw exception?
- javascript - Fullcalendar defaultview 'year' 不起作用谷歌浏览器
- java - 春季测试注解