commons-user mailing list archives

A very useful tool in determine what may be different about the way the
request is made of the server between your code and a browser, and in
particular, to determine which side may be misbehaving, is to use a packet
trace tool like wireshark, which is Open Source, and available for
multiple platforms. I consider it indispensible for sorting out this type
of issue.
Please respond to "Commons Users List" <user@commons.apache.org>
To: user@commons.apache.org
cc:
Subject: HttpClient PostMethod execute call hangs
I apologize, I don't have access to my code right now, but I remember it
well, and it's fairly simple. I'm trying to login to a website (step 1)
and
post data to a form on a page that I only have access to once I have
logged
in (step 2). Step 1 works fine, no problem. I execute a PostMethod
instance
and print the result from the server so I can confirm that I am indeed
logged in. Step 2 has been giving me a lot of problems. I have been able
to
get it to do two different things, depending on how I mess with the code.
Still my code for step 2 is largely identical to the code in step 1. When
I
try to execute the code for step 2, one permutation of my code, when
executed, the server returns the HTML of the page I am trying to post to -
obviously not the result I want. When I modify my code a bit, it hangs on
the call to execute the PostMethod instance. I stepped into the code, and
it
looks like it is stuck waiting for a response from the server - it never
gets one. I'm sure this form works fine when I navigate it manually w/ a
browser. Any idea what may be going on? I'm really stuck here. I've posted
the form HTML code from the page I'm trying to post to in step 2 below for
reference.
<form method="post" action="webcalls2.php">
<input type="hidden" name="action" value="initcall">
<input type="hidden" name="panel" value="">
<div style="margin: 0px; padding: 0px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">
<table border="0" cellpadding="0" cellspacing="0" style="width: 398px;">
<tr>
<td class="g11">&nbsp;</td>
<td class="g12"><h1 width="100" style="float: left; padding: 0px; margin:
0px; color: #FFFFFF; padding-top: 10px; font-size: 17px; font-weight:
bold;">Phone-to-Phone (connection fee 5Ct.)</h1></td>
<td class="g13">&nbsp;</td>
</tr>
<tr>
<td class="g21">&nbsp;</td>
<td class="g22" width="386" style="width: 376px; height: 140px;">
<table border="0" cellpadding="0" cellspacing="0" style="width: 360px;
height: 150px;">
<tr>
<td colspan="2" nowrap>
Your phone number:
</td>
</tr>
<tr>
<td colspan="2" style="width: 100%;">
<input type="text" name="anrphonenr" size="30" value="" onkeyup="return
checkDisabled();" onchange="return checkDisabled();" id="anrphonenr">
</td>
</tr>
<tr>
<td colspan="2" style="font-size: 1px; height: 1px;">&nbsp;</td>
</tr>
<tr>
<td colspan="2" nowrap>
Destination phone number:
</td>
</tr>
<tr>
<td colspan="2" style="width: 100%;">
<input type="text" name="bnrphonenr" size="30" value="" onkeyup="return
checkDisabled();" onchange="return checkDisabled();" id="bnrphonenr">
</td>
</tr>
<tr>
<td colspan="2" width="300" style="width: 300px;">
Make sure you enter both phone numbers in the international format, for
instance for calls to/from UK phones: +442012345678
(+44 is the international code for the UK, use this and then your normal
number without the first zero) # questionmark.gif .
</td>
</tr>
<tr>
<td colspan="2" style="vertical-align: bottom;">
webcalls2.php?explain=true&panel= questionmark.gif <input
type="submit" value="Call!" id="callbutton">
</td>
</tr>
</table>
</td>
<td class="g23">&nbsp;</td>
</tr>
<tr>
<td class="g31">&nbsp;</td>
<td class="g32">&nbsp;</td>
<td class="g33">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</form>
--
View this message in context:
http://www.nabble.com/HttpClient-PostMethod-execute-call-hangs-tp19803430p19803430.html
Sent from the Commons - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org