Perl 中的 XMLRPC::Lite 的错误文件描述符

发布于 2024-09-07 21:43:42 字数 444 浏览 5 评论 0原文

我调用了一个用 Java 实现的 XMLRPC,我已经验证它运行时没有异常并写入输出。 Perl 中的调用是这样的:

  my $result = XMLRPC::Lite
    -> proxy($url)
    -> call("someMethod",
               SOAP::Data->type(string => $par1),
               SOAP::Data->type(string => $par2),
               # etc...
       )
    -> result;

但是当我检查 $result 时发现它没有定义,我得到了 Bad file detector 错误。 可能会发生什么?它之前一直有效,我想不出有什么重要的改变......

I have a call to an XMLRPC implemented in Java which I have verified that runs without exceptions and writes the output. The call in Perl goes like this:

  my $result = XMLRPC::Lite
    -> proxy($url)
    -> call("someMethod",
               SOAP::Data->type(string => $par1),
               SOAP::Data->type(string => $par2),
               # etc...
       )
    -> result;

But then I check for $result and it is not defined, I get Bad file descriptor error.
What could be happening? It was working before, I can't think of anything significant that may have changed...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白鸥掠海 2024-09-14 21:43:42

好吧,我找到了,虽然我不太明白为什么会发生。
XMLRPC 应用程序执行此操作:

byte[] result = xServer.execute(request.getInputStream());

getLogger().log(new String(result));

response.setContentType("text/xml");
response.setContentLength(result.length);
OutputStream out = response.getOutputStream();
out.write(result);
out.flush();

getLogger().log("finished doPost");

我正在记录发送到输出的结果,因此我应该在 Perl 脚本的 $result 变量中获取它。结果是通过 Jdom 库生成的 XML。
当我收到错误时,记录的是一个 XML,其中包含一条错误消息,指示 Jdom 存在问题(基本上,该应用程序没有完全重新编译为该版本的库)。

现在它可以工作了,预期的 XML 被记录并成功分配给 Perl 中的 $result。

然而,由于在这两种情况下字节数组都是 XML,所以我不太明白它对调用者有何影响。它甚至没有寻找给定的 XML 结构,调用导致了错误。

对此的任何见解将不胜感激。不过问题已经解决了。

OK, I found it, although I don't quite understand why it happened.
The XMLRPC app does this:

byte[] result = xServer.execute(request.getInputStream());

getLogger().log(new String(result));

response.setContentType("text/xml");
response.setContentLength(result.length);
OutputStream out = response.getOutputStream();
out.write(result);
out.flush();

getLogger().log("finished doPost");

I'm logging the result that is sent to the output and therefore I should be getting it in the Perl script's $result variable. The result is XML generated via the Jdom library.
While I got the error, what got logged was an XML cointaining an error message indicating a problem with Jdom (basically, the app wasn't fully recompiled to that version of the library).

Now that it works, the expected XML is logged and successfully assigned to $result in Perl.

However, since the byte array is an XML in both cases I don't quite understand how it makes any difference to the caller. It wasn't even looking for a given XML sctructure, the call resulted in an error.

Any insight on this will be appreciated. However the problem is solved.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文