Hi Roland, Thank you for your help. At least it works with preemptive authentication.
Do you know how i can set a automatic retry with different proxy authentication schemes? For example first try basic, then digest and then the microsoft thing. Greetings Simon -----Ursprüngliche Nachricht----- Von: Roland Weber [mailto:[EMAIL PROTECTED] Gesendet: Montag, 9. Januar 2006 17:37 An: HttpClient User Discussion Betreff: Re: AW: WG: Re: postmethod proxy authentication failing Hi Simon, Simon Buettner wrote: > Hi Roland, i tried this code: > FilePost.setRequestEntity(new InputStreamRequestEntity(new > FileInputStream(file), file.length())); > try { > //Proxy konfigurieren > if(proxyInfo.isUsingProxyServer()) > { > //Proxy Infos > mHttpClient.getHostConfiguration().setProxyHost(new > ProxyHost(proxyInfo.getProxyHost(),proxyInfo.getProxyPort())); > mHttpClient.getState().setProxyCredentials(new > AuthScope(proxyInfo.getProxyHost(), proxyInfo.getProxyPort()), > proxyInfo.getProxyCredentials()); > > } > filePost.setDoAuthentication(true); > mHttpClient.getParams().setAuthenticationPreemptive(true); > mHttpClient.getState().setCredentials(new > AuthScope(proxyInfo.getProxyHost(), proxyInfo.getProxyPort()), > proxyInfo.getProxyCredentials()); > > int status = mHttpClient.executeMethod(filePost); > } > catch(Exception e){ > e.printStackTrace(); > } > > > And i get the following exception: > 09.01.2006 16:34:12 org.apache.commons.httpclient.HttpMethodDirector > authenticateHost > WARNUNG: Required credentials not available for BASIC <any realm>@localhost:80 > 09.01.2006 16:34:12 org.apache.commons.httpclient.HttpMethodDirector > authenticateHost > WARNUNG: Preemptive authentication requested but no default credentials > available That is not an exception, it is a warning. Either the proxy credentials or the credentials for the target server are not set as default credentials. If you don't have to authenticate against both at the same time, that should be ok. HttpClient can't tell whether it is supposed to perform preemptive auth only against the proxy, or only against the target server, or both. So it prints a warning about the missing credentials, just in case. cheers, Roland --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
