开发者

Bad file descriptor with XMLRPC::Lite in Perl

开发者 https://www.devze.com 2023-01-06 13:12 出处:网络
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:

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 i开发者_如何学Cs 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...


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消