Oleg,
It worked! But why (now it's personal, hehe, I don't like to see that it's
working and not knowing the reason)? I'm tyring to access HttpClient's
website, but that seems to be down.
Thanks!
olegk wrote:
>
> On Tue, 2010-10-26 at 04:57 -0700, Andre Brito wrote:
>> Hey guys.
>> We have 2 peace of software that imports a few data from sites. I was
>> using
>> HttpClient 3.1 and it was great! But then, one of the sites started to
>> complain (maybe because of our access, I don't know) and was throwing
>> exceptions about the certificate.
>>
>> So I decided to change from 3.1 to 4.0.3. Ok, I can do the GET methods,
>> but
>> I can't build the POST. I'm getting a 417 HttpStatus code (expectation
>> failed). In HttpClient 3.1, I was building the POST like this:
>>
>> PostMethod method = new
>> PostMethod("http://www.receita.fazenda.gov.br/PessoaJuridica/CNPJ/cnpjreva/valida.asp");
>>
>> method.addParameter("origem", "comprovante");
>> method.addParameter("cnpj", cnpj);
>> method.addParameter("idLetra", captcha);
>> method.addParameter("idSom", "");
>> method.addParameter("submit1", "Consultar");
>> method.addParameter("search_type", "cnpj");
>> method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new
>> DefaultHttpMethodRetryHandler(3, false));
>>
>> In HttpClient I'm doing like this:
>>
>> HttpPost post = new HttpPost(url);
>>
>> List<NameValuePair> parameters = new ArrayList<NameValuePair>();
>> parameters.add(new BasicNameValuePair("origem", "comprovante"));
>> parameters.add(new BasicNameValuePair("cnpj", cnpj));
>> parameters.add(new BasicNameValuePair("idLetra", captcha));
>> parameters.add(new BasicNameValuePair("idSom", ""));
>> parameters.add(new BasicNameValuePair("submit1", "Consultar"));
>> parameters.add(new BasicNameValuePair("search_type", "cnpj"));
>>
>> post.setEntity(new UrlEncodedFormEntity(parameters, "UTF-8"));
>>
>> Is that correct? If that so, I can't find a reason why in 3.1 is working
>> and
>> in 4.0.3 is not.
>>
>> Can anyone give me a direction?
>
> Try disabling the 'expect: continue' handshaking.
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://old.nabble.com/Trouble-with-post-in-HttpClient-4.0.3-tp30056777p30066545.html
Sent from the HttpClient-User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]