You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Chaohua Wang <ch...@premierdata.com> on 2006/08/23 00:14:11 UTC

unable to find line starting with "HTTP"


Hi, Folks,

I am using HttpClient 3.1, 

The code is simple:

HttpClient client = new HttpClient();
GetMethod method = new GetMethod( myURL );
byte[]  responseBody = method.getResponseBody();

When I sent a short a url string with few parameters , it works fine.

But when I sent a very long url string with too many parameters, 

I got this exception:

org.apache.commons.httpclient.HttpRecoverableException:
org.apache.commons.httpclient.HttpRecoverableException
: Error in parsing the status  line from the response: unable to find
line starting with "HTTP"
        at
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase
.java:1965)
        at
org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBa
se.java:2659)
        at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java
:1093)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:6
75)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:5
29)


I wonder if a heavy load in server site? How to fix this issue?

Thank you very much, Please help.

Chwang


For example these following parameters I need to contains them in url.
If cut them to half, it works fine. But if not, I got "unable to find
line starting with "HTTP" " 

(tblCase.CaseTypeCode = '210000' OR tblCase.CaseTypeCode = '210001' OR
tblCase.CaseTypeCode = '210002' OR tblCase.CaseTypeCode = '210003' OR
tblCase.CaseTypeCode = '210004' OR tblCase.CaseTypeCode = '210005' OR
tblCase.CaseTypeCode = '210006' OR tblCase.CaseTypeCode = '210007' OR
tblCase.CaseTypeCode = '210008' OR tblCase.CaseTypeCode = '210009' OR
tblCase.CaseTypeCode = '210010' OR tblCase.CaseTypeCode = '210011' OR
tblCase.CaseTypeCode = '210012' OR tblCase.CaseTypeCode = '210013' OR
tblCase.CaseTypeCode = '210014' OR tblCase.CaseTypeCode = '210015' OR
tblCase.CaseTypeCode = '210016' OR tblCase.CaseTypeCode = '210017' OR
tblCase.CaseTypeCode = '210018' OR tblCase.CaseTypeCode = '210019' OR
tblCase.CaseTypeCode = '210020' OR tblCase.CaseTypeCode = '210026' OR
tblCase.CaseTypeCode = '210030' OR tblCase.CaseTypeCode = '210099' OR
tblCase.CaseTypeCode = '210500' OR tblCase.CaseTypeCode = '210501' OR
tblCase.CaseTypeCode = '210502' OR tblCase.CaseTypeCode = '211000' OR
tblCase.CaseTypeCode = '211001' OR tblCase.CaseTypeCode = '212002' OR
tblCase.CaseTypeCode = '212009' OR tblCase.CaseTypeCode = '213000' OR
tblCase.CaseTypeCode = '213001' OR tblCase.CaseTypeCode = '213002' OR
tblCase.CaseTypeCode = '213700' OR tblCase.CaseTypeCode = '213701' OR
tblCase.CaseTypeCode = '214000' OR tblCase.CaseTypeCode = '214001' OR
tblCase.CaseTypeCode = '214002' OR tblCase.CaseTypeCode = '214100' OR
tblCase.CaseTypeCode = '214101' OR tblCase.CaseTypeCode = '215000' OR
tblCase.CaseTypeCode = '215001' OR tblCase.CaseTypeCode = '215002' OR
tblCase.CaseTypeCode = '215003' OR tblCase.CaseTypeCode = '215005' OR
tblCase.CaseTypeCode = '216001' OR tblCase.CaseTypeCode = '218000' OR
tblCase.CaseTypeCode = '218001' OR tblCase.CaseTypeCode = '218002' OR
tblCase.CaseTypeCode = '218003' OR tblCase.CaseTypeCode = '218004' OR
tblCase.CaseTypeCode = '218005' OR tblCase.CaseTypeCode = '218006' OR
tblCase.CaseTypeCode = '218007' OR tblCase.CaseTypeCode = '218008' OR
tblCase.CaseTypeCode = '218009' OR tblCase.CaseTypeCode = '218010' OR
tblCase.CaseTypeCode = '218011' OR tblCase.CaseTypeCode = '218012' OR
tblCase.CaseTypeCode = '218013' OR tblCase.CaseTypeCode = '218014' OR
tblCase.CaseTypeCode = '218015' OR tblCase.CaseTypeCode = '218016' OR
tblCase.CaseTypeCode = '218017' OR tblCase.CaseTypeCode = '218018' OR
tblCase.CaseTypeCode = '218019' OR tblCase.CaseTypeCode = '218020' OR
tblCase.CaseTypeCode = '218021' OR tblCase.CaseTypeCode = '218022' OR
tblCase.CaseTypeCode = '218023' OR tblCase.CaseTypeCode = '218024' OR
tblCase.CaseTypeCode = '218025' OR tblCase.CaseTypeCode = '218030' OR
tblCase.CaseTypeCode = '218035' OR tblCase.CaseTypeCode = '218040' OR
tblCase.CaseTypeCode = '218050' OR tblCase.CaseTypeCode = '218060' OR
tblCase.CaseTypeCode = '218065' OR tblCase.CaseTypeCode = '218070' OR
tblCase.CaseTypeCode = '218071' OR tblCase.CaseTypeCode = '218080' OR
tblCase.CaseTypeCode = '218090' OR tblCase.CaseTypeCode = '218091' OR
tblCase.CaseTypeCode = '250005' OR tblCase.CaseTypeCode = '262601' OR
tblCase.CaseTypeCode = '264001' OR tblCase.CaseTypeCode = '274002' OR
tblCase.CaseTypeCode = '276501')







---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: unable to find line starting with "HTTP"

Posted by Roland Weber <ht...@dubioso.net>.
Hi Chaohua,

> The code is simple:
> 
> HttpClient client = new HttpClient();
> GetMethod method = new GetMethod( myURL );
> byte[]  responseBody = method.getResponseBody();

I assume there's also a call to HttpClient.execute somewhere :-)

> When I sent a short a url string with few parameters , it works fine.
> 
> But when I sent a very long url string with too many parameters, 

There are practical limits to the length of a URL, which are
(server) implementation dependent. That's why you send long
or many parameters in the message body, either form-url-encoded
or as multipart-mime. If the server application is a Servlet,
it won't make any difference.

> org.apache.commons.httpclient.HttpRecoverableException:
> org.apache.commons.httpclient.HttpRecoverableException
> : Error in parsing the status  line from the response: unable to find
> line starting with "HTTP"
>         at

This indicates that the server is sending nonsense. Since you
know the reason, there is no point in further analysis.


> For example these following parameters I need to contains them in url.
> If cut them to half, it works fine. But if not, I got "unable to find
> line starting with "HTTP" " 
> 
> (tblCase.CaseTypeCode = '210000' OR tblCase.CaseTypeCode = '210001' OR
> tblCase.CaseTypeCode = '210002' OR tblCase.CaseTypeCode = '210003' OR
> [...]
> tblCase.CaseTypeCode = '250005' OR tblCase.CaseTypeCode = '262601' OR
> tblCase.CaseTypeCode = '264001' OR tblCase.CaseTypeCode = '274002' OR
> tblCase.CaseTypeCode = '276501')

These are not parameters. Parameters look like "?n1=v1&n2=v2".
Don't put that stuff in the URL, it is way too big. There is no
way you can get that across reliably with a GET request. The
primer has a few short paragraphs about creating POST requests
and the two primary options for encoding parameters:
http://wiki.apache.org/jakarta-httpclient/ForAbsoluteBeginners#head-8ce973d0347a2eba238f594c47f478035c51ea66

Here are some starters in the JavaDoc:
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/PostMethod.html#addParameter(java.lang.String,%20java.lang.String)
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/multipart/MultipartRequestEntity.html

Decide on one of the two. You can't mix a multipart request entity
with parameters added directly to the PostMethod.

hope that helps,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: unable to find line starting with "HTTP"

Posted by Roland Weber <ht...@dubioso.net>.
By the way: do NOT cross-post your problems into multiple mailing lists!
This is mentioned twice in the Jakarta mailing list guidelines.
http://jakarta.apache.org/site/mail.html

cheers,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org