Hi there.

I use the httpclient 4.0.1 to access a basic authentication protected website. My program performs a MULTIPART request. But the webserver (Microsoft IIS) returns the error code 400 (Bad Request). When submitting the same request as a POST (without the file), everything works perfectly.

Here is the source code:

======================================

DefaultHttpClient client = new DefaultHttpClient();

UsernamePasswordCredentials creds = new UsernamePasswordCredentials("username", "password");
AuthScope scope = new AuthScope(host, 80)
client.getCredentialsProvider().setCredentials(scope, creds);

HttpPost httppost = new HttpPost(url);

MultipartEntity mpEntity = new MultipartEntity();
FileBody bin = new FileBody(new File("testfile.pdf"));
mpEntity.addPart("pdf", bin);

httppost.setEntity(mpEntity);
HttpResponse response = client.execute(httppost);

======================================

Any idea whats going on here?

Greetings,
Christian.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to