XQuery/FTP Client

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Motivation[edit | edit source]

You would like to interact with a remote FTP server running remotely directly from your XQuery program. You would like to perform operations such as list, get and put files.

FTP Module Interfaces[edit | edit source]

The FTP module has the following interfaces:

  ftpclient:get-connection($host as xs:string, $username as xs:string, $password as xs:string) xs:long?
  ftpclient:list($connection-handle as xs:long, $remote-directory as xs:string) document-node()?
  ftpclient:get-binary-file($connection-handle as xs:long, $remote-directory as xs:string, $file-name as xs:string) xs:base64Binary?
  ftpclient:send-binary-file($connection-handle as xs:long, $remote-directory as xs:string, $file-name as xs:string, $data as xs:base64Binary) xs:boolean

Sample Usage[edit | edit source]

In this example we will open a connection to a remote FTP server, login and list the files.