Using WebDAVClient to Integrate Backend Systems with Salesforce B2C Commerce

B2C Commerce implements a WebDAV client in the B2C Commerce Script API to enable developers to access remote locations via the WebDAV protocol.

You must have File Transfer Manager access privileges to access the Import/Export WebDAV share.

The WebDAVClient class is the actual client, while the WebDAVFileInfo class is used to store information about the files that are located at the remote destination. Use the WebDAVClient class to synchronize directories from a remote server with the B2C Commerce file system or to export files out of the B2C Commerce system. The client supports the following common WebDAV methods:

The names of the script methods correspond exactly with the names of the WebDAV methods. The methods propfind() and list(), used to get information about remote files and directories, return instances of WebDAVFileInformation, which encapsulate this information.

Note: This client can't be used to access the B2C Commerce server via the WebDAV protocol.

The following is an example:

    var webdavClient : WebDAVClient = new
    WebDAVClient("http://mywebdav.server.com","myusername","mypassword");
     var getString : String = webdav.get("http://mywebdav.server.com/myData.xml","UTF-8");
     var message : String;
     if(webdavClient.succeeded()){
       message = webDavClient.statusText;
     }
     else{
     // error handling
       message="An error occurred with status code "+webdavClient.statusCode;
     }
     var data : XML = new XML(getString));

For more information see the section on classes and methods.