Boa tarde!
Estou tentando fazer uma conexão com o httpClient configurando o proxy conforme codigo abaixo:
public String executePOSTMethod(String url, NameValuePair[] parameters) throws ConnectionException {
Protocol myhttps = new Protocol("https", ((ProtocolSocketFactory) new EasySSLProtocolSocketFactory()), 443);
Protocol.registerProtocol("https", myhttps);
try {
$post.setURI(new URI(url, true));
$post.setRequestBody(parameters);
$post.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
//setDoAuthentication(true)
$post.setDoAuthentication(true);
//TimeOut's
$client.getHttpConnectionManager().getParams().setConnectionTimeout(2000000);
Credentials credentials = new NTCredentials("loginDaRede", "Senha","IPMaquinaLocal","meuProxy");
$client.getHostConfiguration().setProxy("10.13.121.5", 3128);
$client.getState().setProxyCredentials(
AuthScope.ANY,
credentials);
$client.getParams().setAuthenticationPreemptive(true);
$client.executeMethod($post);
String response = getPostHtmlCode();
/*nome do proxy bluecoat*/
if(numberConnectionAttemptsPost > 0) {
numberConnectionAttemptsPost = 0;
}
return response;
} catch(URIException exception) {
throw new ConnectionException("Formato não reconecido da url: " + url,exception);
} catch(IOException exception) {
throw new ConnectionException("Não foi possivel conectar na url: " + url,exception);
}
}
Gera o seguinte:
19/05/2010 18:14:16 org.apache.commons.httpclient.HttpMethodDirector authenticateHost
WARNING: Required credentials not available for BASIC <any realm>@crmlb.mercadolibre.com:80
19/05/2010 18:14:16 org.apache.commons.httpclient.HttpMethodDirector authenticateHost
WARNING: Preemptive authentication requested but no default credentials available
19/05/2010 18:14:16 org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
INFO: ntlm authentication scheme selected
19/05/2010 18:14:16 org.apache.commons.httpclient.HttpMethodDirector authenticateHost
WARNING: Required credentials not available for BASIC <any realm>@crmlb.mercadolibre.com:80
19/05/2010 18:14:16 org.apache.commons.httpclient.HttpMethodDirector authenticateHost
WARNING: Preemptive authentication requested but no default credentials available
19/05/2010 18:14:17 org.apache.commons.httpclient.HttpMethodDirector authenticateHost
WARNING: Required credentials not available for BASIC <any realm>@crmlb.mercadolibre.com:80
19/05/2010 18:14:17 org.apache.commons.httpclient.HttpMethodDirector authenticateHost
WARNING: Preemptive authentication requested but no default credentials available
19/05/2010 18:14:17 org.apache.commons.httpclient.HttpMethodDirector processProxyAuthChallenge
INFO: Failure authenticating with NTLM <any realm>@10.13.121.5:3128
Alguem tem ideia do que está errado?
Abraços