Hi

I am trying to debug my colleague's code.

(1) When I run this on command line

 # java '<XML string>' http://weburl

The output is

<XML string> Result = [OPERATION SUCCESSFUL]

Note: It takes few seconds between the output line-1 and output line-2

(2) The same web service call is coded in Perl CGI as below:

 $java_res = `java '<XML string>' http://weburl 2>/err.dat 1>/out.dat` ;

I have introduced debug logs in the CGI program just before and after this code.

(3) When this CGI program is tested on command line. It works as expected.

err.dat is empty file and

out.dat has

<XML string> Result = [OPERATION SUCCESSFUL]

(4) When this same CGI program is called from web browser and running on web server it doesn't work as expected.

err.dat is empty file and

out.dat has

<XML string>

Note:

err.dat file is empty which is correct and as expected But

out.dat doesn't have the Result = [OPERATION SUCCESSFUL] which is not correct.

Also, the program hangs at this call and I don’t see the log message after this call. It means the program doesn’t continue after this. Log message works while running the same CGI on the command line.

For debugging purpose I did hardcode the java parameters just to make sure they are same in command line and web server.

Only thing I could suspect is there is some delay (max 5 seconds) between the output line-1 and output line-2. Please confirm if that could be the issue.

Please let me know how do I go about and debug this Perl CGI code.

Please let me know if you need more details to help me on this.

Thanks.


In reply to how to debug CGI when response is slow by smg1827

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.