Closed on-delete closed 9 years ago
I'd love to see some debugging output and code examples demonstrating the failure. =)
Thanks for your answer!
public class Main {
public static void main(String[] args){
String username = args[0];
String password = args[1];
String sharepointUrl = args[2];
try {
Sardine sardine = SardineFactory.begin(username, password);
List<DavResource> ressource = sardine.list(sharepointUrl + "/projects/aquarium/ISODokumentenablage/03%20Mitarbeiterübersicht/");
for(DavResource res: ressource){
System.out.println("Filename: " + res.getDisplayName());
}
if(sardine.exists(sharepointUrl + "/projects/aquarium/ISODokumentenablage/03%20Mitarbeiterübersicht/Mitarbeiter.xlsx")){
System.out.println("File found!");
InputStream is = null;
is = sardine.get(sharepointUrl + "/projects/aquarium/ISODokumentenablage/03%20Mitarbeiterübersicht/Mitarbeiter.xlsx");
if (is!= null)
System.out.println("File has content!");
List<DavResource> ressourceNew = sardine.list(sharepointUrl + "/projects/aquarium/ISODokumentenablage/03%20Mitarbeiterübersicht/Mitarbeiter.xlsx");
for(DavResource res : ressourceNew){
System.out.println("Filename New: " + res.getDisplayName());
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
So this is my testcode. As you can see, i want to get an Item called "Mitarbeiterübersicht.xlsx". If i make the list() call on the root folder of this file, it is found correctly. With exists() and get() the same. Except with list() on the file directly. This is the console output:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Dez 22, 2014 7:14:03 PM org.apache.http.impl.auth.HttpAuthenticator generateAuthResponse WARNUNG: NEGOTIATE authentication error: Invalid name provided (Mechanism level: KrbException: Cannot locate default realm) INFO: Filename: 03 Mitarbeiterübersicht INFO: Filename: Mitarbeiter.xlsx INFO: File found! INFO: File has content! Dez 22, 2014 7:14:03 PM org.apache.http.impl.auth.HttpAuthenticator generateAuthResponse WARNUNG: NEGOTIATE authentication error: Invalid name provided (Mechanism level: KrbException: Cannot locate default realm) com.github.sardine.impl.SardineException: Unexpected response (404 NOT FOUND) at com.github.sardine.impl.handler.ValidatingResponseHandler.validateResponse(ValidatingResponseHandler.java:48) at com.github.sardine.impl.handler.MultiStatusResponseHandler.handleResponse(MultiStatusResponseHandler.java:40) at com.github.sardine.impl.handler.MultiStatusResponseHandler.handleResponse(MultiStatusResponseHandler.java:35) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:218) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:160) at com.github.sardine.impl.SardineImpl.execute(SardineImpl.java:904) at com.github.sardine.impl.SardineImpl.list(SardineImpl.java:393) at com.github.sardine.impl.SardineImpl.list(SardineImpl.java:360) at com.github.sardine.impl.SardineImpl.list(SardineImpl.java:351) at com.github.sardine.impl.SardineImpl.list(SardineImpl.java:345) at testsardine.Main.main(Main.java:46)
And this is the logging output (i only give you the passage for the list() call on the file)
2014/12/22 19:15:01:925 MEZ [DEBUG] headers - http-outgoing-0 << Last-Modified: Thu, 07 Feb 2013 09:33:02 GMT
2014/12/22 19:15:01:925 MEZ [DEBUG] headers - http-outgoing-0 << ETag: "{3256B546-B3A6-4342-890F-50763809EF77},22"
2014/12/22 19:15:01:925 MEZ [DEBUG] headers - http-outgoing-0 << Server: Microsoft-IIS/7.5
2014/12/22 19:15:01:925 MEZ [DEBUG] headers - http-outgoing-0 << SPRequestGuid: 3b83313b-ff04-451c-b60c-3c42aab1947c
2014/12/22 19:15:01:925 MEZ [DEBUG] headers - http-outgoing-0 << X-SharePointHealthScore: 0
2014/12/22 19:15:01:925 MEZ [DEBUG] headers - http-outgoing-0 << ResourceTag: rt:3256B546-B3A6-4342-890F-50763809EF77@00000000022
2014/12/22 19:15:01:925 MEZ [DEBUG] headers - http-outgoing-0 << Public-Extension: http://schemas.microsoft.com/repl-2
2014/12/22 19:15:01:925 MEZ [DEBUG] headers - http-outgoing-0 << X-Powered-By: ASP.NET
2014/12/22 19:15:01:925 MEZ [DEBUG] headers - http-outgoing-0 << MicrosoftSharePointTeamServices: 14.0.0.6129
2014/12/22 19:15:01:925 MEZ [DEBUG] headers - http-outgoing-0 << X-MS-InvokeApp: 1; RequireReadOnly
2014/12/22 19:15:01:926 MEZ [DEBUG] headers - http-outgoing-0 << Date: Mon, 22 Dec 2014 18:15:02 GMT
2014/12/22 19:15:01:926 MEZ [DEBUG] MainClientExec - Connection can be kept alive indefinitely
2014/12/22 19:15:01:927 MEZ [DEBUG] RequestAddCookies - CookieSpec selected: best-match
2014/12/22 19:15:01:927 MEZ [DEBUG] RequestAddCookies - Cookie [version: 0][name: WSS_KeepSessionAuthenticated][value: {ee6f36c5-06e0-4b83-990e-5cde666ab628}][domain: sharepointurl][path: /][expiry: null] match [(secure)sharepointurl/projects/aquarium/ISODokumentenablage/03 Mitarbeiterübersicht/Mitarbeiter.xlsx]
2014/12/22 19:15:01:927 MEZ [DEBUG] RequestAuthCache - Auth cache not set in the context
2014/12/22 19:15:01:927 MEZ [DEBUG] PoolingHttpClientConnectionManager - Connection request: [route: {s}->sharepointurl][state: username][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
2014/12/22 19:15:01:928 MEZ [DEBUG] PoolingHttpClientConnectionManager - Connection leased: [id: 1][route: {s}->sharepointurl][total kept alive: 0; route allocated: 2 of 2; total allocated: 2 of 20]
2014/12/22 19:15:01:928 MEZ [DEBUG] MainClientExec - Opening connection {s}->sharepointurl
2014/12/22 19:15:01:928 MEZ [DEBUG] HttpClientConnectionOperator - Connecting to sharepointurl
2014/12/22 19:15:01:963 MEZ [DEBUG] HttpClientConnectionOperator - Connection established 141.46.247.121:49646<->194.180.239.23:443
2014/12/22 19:15:01:963 MEZ [DEBUG] MainClientExec - Executing request PROPFIND /projects/aquarium/ISODokumentenablage/03%20Mitarbeiter%C3%BCbersicht/Mitarbeiter.xlsx HTTP/1.1
2014/12/22 19:15:01:963 MEZ [DEBUG] MainClientExec - Target auth state: SUCCESS
2014/12/22 19:15:01:963 MEZ [DEBUG] MainClientExec - Proxy auth state: UNCHALLENGED
2014/12/22 19:15:01:964 MEZ [DEBUG] headers - http-outgoing-1 >> PROPFIND /projects/aquarium/ISODokumentenablage/03%20Mitarbeiter%C3%BCbersicht/Mitarbeiter.xlsx HTTP/1.1
2014/12/22 19:15:01:964 MEZ [DEBUG] headers - http-outgoing-1 >> Depth: 1
2014/12/22 19:15:01:964 MEZ [DEBUG] headers - http-outgoing-1 >> Content-Type: text/xml; charset=utf-8
2014/12/22 19:15:01:964 MEZ [DEBUG] headers - http-outgoing-1 >> Content-Length: 99
2014/12/22 19:15:01:964 MEZ [DEBUG] headers - http-outgoing-1 >> Host: sharepointurl
2014/12/22 19:15:01:964 MEZ [DEBUG] headers - http-outgoing-1 >> Connection: Keep-Alive
2014/12/22 19:15:01:964 MEZ [DEBUG] headers - http-outgoing-1 >> User-Agent: Sardine/5.4
2014/12/22 19:15:01:964 MEZ [DEBUG] headers - http-outgoing-1 >> Cookie: WSS_KeepSessionAuthenticated={ee6f36c5-06e0-4b83-990e-5cde666ab628}
2014/12/22 19:15:01:964 MEZ [DEBUG] headers - http-outgoing-1 >> Cookie2: $Version=1
2014/12/22 19:15:01:964 MEZ [DEBUG] headers - http-outgoing-1 >> Accept-Encoding: gzip,deflate
2014/12/22 19:15:01:964 MEZ [DEBUG] wire - http-outgoing-1 >> "PROPFIND /projects/aquarium/ISODokumentenablage/03%20Mitarbeiter%C3%BCbersicht/Mitarbeiter.xlsx HTTP/1.1[\r][\n]"
2014/12/22 19:15:01:964 MEZ [DEBUG] wire - http-outgoing-1 >> "Depth: 1[\r][\n]"
2014/12/22 19:15:01:964 MEZ [DEBUG] wire - http-outgoing-1 >> "Content-Type: text/xml; charset=utf-8[\r][\n]"
2014/12/22 19:15:01:964 MEZ [DEBUG] wire - http-outgoing-1 >> "Content-Length: 99[\r][\n]"
2014/12/22 19:15:01:964 MEZ [DEBUG] wire - http-outgoing-1 >> "Host: sharepointurl[\r][\n]"
2014/12/22 19:15:01:964 MEZ [DEBUG] wire - http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
2014/12/22 19:15:01:964 MEZ [DEBUG] wire - http-outgoing-1 >> "User-Agent: Sardine/5.4[\r][\n]"
2014/12/22 19:15:01:964 MEZ [DEBUG] wire - http-outgoing-1 >> "Cookie: WSS_KeepSessionAuthenticated={ee6f36c5-06e0-4b83-990e-5cde666ab628}[\r][\n]"
2014/12/22 19:15:01:964 MEZ [DEBUG] wire - http-outgoing-1 >> "Cookie2: $Version=1[\r][\n]"
2014/12/22 19:15:01:965 MEZ [DEBUG] wire - http-outgoing-1 >> "Accept-Encoding: gzip,deflate[\r][\n]"
2014/12/22 19:15:01:965 MEZ [DEBUG] wire - http-outgoing-1 >> "[\r][\n]"
2014/12/22 19:15:01:965 MEZ [DEBUG] wire - http-outgoing-1 >> "<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
Try encoding the ü?
Just tried it with %FC in the link for the ü, bot it throws the same error. In this case, it would also throw the error at the exists() method, so this can not be the problem.
I see in the log output above, that the ü is being encoded to this: 03%20Mitarbeiter%C3%BCbersicht
%BC, not %FC
I don't think this is a sardine issue. It is something with the way that you're sending the request to the server.
Try with a filename that doesn't have any spaces or non basic ascii characters. Get the simplest case working first. =)
Cannot avoid the use of the space character (%20) because the folder structure in our sharepoint is like that.
I dont think that a not well formated url string is a problem in this case, because then the exists() method would also cause this 404 error.
The ü actually encodes to this: %C3%BC
Just tried it with this:
List<DavResource> ressourceNew = sardine.list(sharepointUrl + "/projects/aquarium/ISODokumentenablage/03%20Mitarbeiter%C3%BCbersicht/Mitarbeiter.xlsx");
Same problem.
any new idea for my problem? :)
As I said above, try to get the easiest case working first. Then start adding edges.
I already tried it with simple links. If this would be the problem, then the get() would also not work.
The only log and code output that I've seen is what you've shown above. I can't read your mind and I'm not sitting there next to you to help you. So, until you give full details for things, I'm sorry, there isn't much I can do to help you.
Since this is now turning into a discussion and less of a bug report, I'm going to close this issue and if you'd like to try to bring this up on the sardine google group (or stack overflow) to get outside help, you are welcome to do so.
Hello,
i tried to receive a single DavRessource for a file on a sharepoint server. But this is not working, i always get the error message 404 file not found. But if i perform a list() on the directory of the file, the file is found correctly.
So i don't exactly know, if this is a sharepoint problem, or the sardine api looks for an directory instead of a single file. Because in the response from the sharepoint server it says, that the directory is not found.
I also performed an exists() on the file and it returned true.