Hi, When I tried to connect to a lotus domino server using httpClient 3.0 to POST an xml file, I recieved warnings:
2005/12/26 23:59:07:180 EST [WARN] HttpMethodDirector - Required credentials not available for BASIC <any realm>@camdev01.company.com:80 2005/12/26 23:59:07:180 EST [WARN] HttpMethodDirector - Preemptive authentication requested but no default credentials available Then the response code is 200 with response body as html for login page. But this was working when httpClient 2.0 was used. The code snippet with both verisions 2 and 3 : /****************************/ String strXMLFilename = "c:\\corpdir.txt"; static final String username = "devtest02"; static final String password = "devtest02"; static final String urlString = "http://camdev.company.name/..."; File input = new File(strXMLFilename); PostMethod post = new PostMethod(urlString); // post.setRequestBody(new FileInputStream(input)); //2.0 /* if (input.length() < Integer.MAX_VALUE) { post.setRequestContentLength((int)input.length()); } else { post.setRequestContentLength(EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED); } // 2.0 */ // 3.0 if (input.length() < Integer.MAX_VALUE) { post.setRequestEntity(new InputStreamRequestEntity(new FileInputStream(input), (int)input.length())); } else { post.setContentChunked(true); post.setRequestEntity(new InputStreamRequestEntity(new FileInputStream(input))); } // 3.0 post.setRequestHeader("Content-type", "text/xml"); post.setDoAuthentication(true); // Get HTTP client HttpClient httpclient = new HttpClient(); //2.0 httpclient.getState().setAuthenticationPreemptive(true); httpclient.getParams().setAuthenticationPreemptive(true); //3.0 httpclient.getParams().setParameter("http.protocol.expect-continue", new Boolean(true)); httpclient.getParams().setParameter("http.protocol.single-cookie-header", new Boolean(true)); Credentials defaultcreds = new UsernamePasswordCredentials(username, password); // 2.0 httpclient.getState().setCredentials( null, null, defaultcreds ); // 2.0 // 3.0 httpclient.getState().setCredentials( new AuthScope(urlString, 80, AuthScope.ANY_REALM), defaultcreds ); //3.0 // Execute request int result = httpclient.executeMethod(post); System.out.println("Response status code: " + result); /***************************************/ In the debug mode, I could see the httpState has username and password set. Are there any other parameters that need to be set? Thankyou, Prasad. __________________________________ Yahoo! for Good - Make a difference this year. http://brand.yahoo.com/cybergivingweek2005/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]