File and FTP handling in import and export job scripts
Key Takeaway
Move feeds onto the instance before an import and back to the backend after an export, with custom jobs running the transfers. B2C Commerce imports only schema-valid XML, and sFTP is recommended for sensitive data.
Import and export jobs move feed files between a B2C Commerce instance and outside systems. A job script often connects to an FTP, sFTP, WebDAV or HTTPS endpoint and reads or writes files on the instance. The transfer classes have size, encoding and security rules that decide which technique fits a requirement.
Getting files on and off the instance
Before you import a feed, you must transfer it from the merchant system to the instance. After you export a file, you must transfer it back to the backend system. Use custom jobs to run these transfers automatically.
Jobs also avoid a timeout problem. A request to an instance times out if the application server doesn't respond within five minutes. Large imports and exports often run longer, so run them asynchronously as jobs instead.
You can transfer files using WebDAV, FTP or HTTPS. Secure FTP (sFTP) is supported. FTPS (FTP over SSL/TLS) isn't supported for integrating external systems with B2C Commerce.
In script, use these classes:
dw.net.FTPClientto connect to an FTP serverdw.net.SFTPClientto connect to an sFTP serverdw.net.HTTPClientto call HTTP endpointsWebDAVClientto reach a WebDAV server on the merchant's remote system
Use WebDAVClient to talk to a merchant's remote server, not to move files between B2C Commerce instances. The B2C Commerce WebDAV client can't connect to the B2C Commerce WebDAV server in its own instance or in other instances.