简体   繁体   English

为什么Java Web服务无法与Perl后端对话?

[英]Why can't my Java webservice talk to my Perl backend?

In our project the Java webservice communicate with the backend program written in C and Perl to process. 在我们的项目中,Java Web服务与用C和Perl编写的后端程序进行通信以进行处理。 We are using the ProcessBuilderto execute a backend (UNIX) job FrameworkHandler. 我们正在使用ProcessBuilder执行后端(UNIX)作业FrameworkHandler。

ProcessBuilder process;
process.Start(FrameworkHandler -a ACTION)

FrameworkHandler invokes a Perl script to perform some action. FrameworkHandler调用Perl脚本执行一些操作。 The Perl script internally does a diff command between two XML files and uses the print function to print the error: Perl脚本在内部在两个XML文件之间执行diff命令,并使用print函数来打印错误:

sub print_error
{
    $err_msg = shift;
    print STDERR "$err_msg\n";
}

Whenever there is a difference between the files the Perl program hangs in the print_error function. 只要文件之间存在差异,Perl程序就会在print_error函数中挂起。 If we execute the Perl program in the UNIX shell it is working without any issues. 如果我们在U​​NIX shell中执行Perl程序,它将正常工作。 But if we execute the Perl through the webservice, it is not returning after the diff command. 但是,如果我们通过Web服务执行Perl,则在diff命令之后它不会返回。 Due to this, the webservice is also not returning the response. 因此,Web服务也不会返回响应。 Whether the greater than (>) symbols in the XML tags are creating problem? XML标记中的大于(>)符号是否引起问题?

Any help is much appreciated. 任何帮助深表感谢。

Part of Error: 错误的一部分:


< diff -udr --new-file --label=postProcess1 --label=postProcess2 postProcess1 postProcess2
< --- postProcess1
< +++ postProcess2
< @@ -124,6 +124,36 @@
<               <LOCATION></LOCATION>
<               <ADDRESS_PART1>Test Address ^D</ADDRESS_PART1 >
<         </address_details>
< +       <address_details>
< +             <CITY></CITY>
< +             <STATE>12</STATE>

Thanks, Mathew Liju 谢谢,Mathew Liju

The API docs say: API文档说:

“Because some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, and even deadlock.” “由于某些本机平台仅为标准输入和输出流提供了有限的缓冲区大小,因此未能及时写入子流程的输入流或读取子流程的输出流可能导致子流程阻塞,甚至死锁。”

Are you complying? 你遵守吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM