PROPFIND Request In WTClient

1.6k views Asked by At

I would like to add a WebDAV and iDisk interface to my app, however I am having a bit of technical trouble regarding files stored on the server. Every answer to the question "How do I use a WebDAV server || to get a list of files" seems to end with the phrase "Use a PROPFIND request." I've decided to use the WTClient Classes because they establish and terminate the stream to the server for me and manage uploads and downloads, but here's where WTClient fails: It cannot gather a list of files on the server (or I seem to be unable to gather a list, whatever floats your boat). It puts in the PROPFIND request with this line:

WTHTTPConnection *connection = [[WTHTTPConnection alloc] initWithDestination:remoteURL
                                    protocol:@"PROPFIND"];

It then gathers the results as an NSDictionary. But instead of using that dictionary to get a list of files, WTClient uses it to gather error code information (if present) from the XML in the dictionary. While helpful, it is not what I'm looking for. If anyone has even the foggiest idea of how to request the files on a WebDAV server and gather them into an NSDictionary or NSArray, it would be greatly appreciated.

1

There are 1 answers

6
Yahia On BEST ANSWER

Judging from source of WTClient you need to use initWithLocalURL, preparePropertiesConnection and/or requestProperties to achieve what you want.

OTOH it seems from some comments in the source that esp. the functionality around PROPFIND (which is indeed necessary to get a directory listing from WebDAV) is not fully implemented yet... so it might be that this would not work for your use case.

UPDATE:

This is a WebDAV-client library including source which has been successfully used on iOS (with very little modification). It include an implementation for PROPFIND and other WebDAV-specific http verbs... to me it seems that this would be nice starting point for you.