Hi
Recently discovered the Webdav protocol and have been playing with it
and my SharePoint Portal 2003 Server.
Using java.net.HttpURLConnection i can connect to the server as simply
as this without any username/password.
-------------------------
URL url = new URL("http://srv/sites/site/file.txt");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
System.err.println(connection.getResponseMessage() + " " +
connection.getResponseCode());
connection.disconnect();
-------------------------
--> result: OK 200
Same with VB.NET 2003 but i have to set credentials to get authorized
by obtaining the Windows credentials.
-------------------------
Dim request As HttpWebRequest =
CType(WebRequest.Create("http://srv/sites/site/file.txt"),
HttpWebRequest)
request.Method = "GET"
request.Credentials = CredentialCache.DefaultCredentials
Dim respons As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
TextBox1.Text = respons.StatusDescription & " " & respons.StatusCode
-------------------------
--> result: OK 200
Using org.apache.commons.httpclient.HttpClient it also succeeds but
the only way i have found is by using NTCredentials like this:
-------------------------
HttpClient client = new HttpClient();
NTCredentials creds = new NTCredentials("user", "pass", "", "");
client.getState().setCredentials(null, "srv", creds);
GetMethod g = new GetMethod("http://srv/sites/site/file.txt");
client.executeMethod(g);
System.err.println( g.getStatusLine());
-------------------------
--> result: HTTP/1.1 200 OK
The Windows credentials (user name/password/domain) are same as for
the sharepoint server so in .NET using
CredentialCache.DefaultCredentials it works.
java.net.HttpURLConnection works without supplying any authentication
information, a bit strange.
Now to the question. How can i using
org.apache.commons.httpclient.HttpClient successfully connect to the
server by obtaining the Windows credentials automatically without
having to type them in to client application.
regards,
Uno
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]