url-open, SFTP

Syntax for SFTP URLs with the dp:url-open extension element.

Syntax

To specify a relative path from the user's home directory
sftp://[user:password@]host[:port]/~/URI[?queryParameters]
To specify an absolute path from the root directory
sftp://[user:password@]host[:port]/URI[?queryParameters]
To specify a path that represents a directory
sftp://[user:password@]host[:port]/~/path/;type=d

Attributes

sftp
Indicates the required protocol identifier.
user
Optionally specifies a user ID on the target host. If omitted, specify the user ID for authentication in the SFTP client policy of the user agent. You must encode the following characters: @ / :
password
Optionally specifies the password corresponding to the user ID. If omitted, specify the user password for authentication in the SFTP client policy of the user agent. You must encode the following characters: @ / :
host
Fully qualified domain name or IP address of the target host.
port
Optionally identifies the connection port on the host. If omitted, the default value is 22.
URI
For a PUT (write) operation, specifies the remote location that receives the file. The URI for a GET (read) operation specifies the location from which the element fetches the file.

The presence or absence of content within the dp:url-open extension element determines whether the semantics for the url-open extension element is a PUT or a GET. If the element contains content, do a PUT. If there is no content, do a GET.

If the path string ends with a forward slash (/) or the ;type=d sequence, the string indicates that this path represents a remote directory. The dp:url-open extension element retrieves an XML document that represents the contents of this directory, which is a directory listing.

queryParameters
Specifies name-value pairs that follow the URI. Use a question mark (?) after the URI but before the first query parameter.
Delete
Indicates a request to delete the file that is specified by the URI. The default value is false.
false
Does not delete the file.
true
Deletes the file that is specified by the URI. Meaningful only for a read operation, that is, only if no data is provided with the request.

Guidelines

For directory listings, see the XML Directory Listing schema in store://schemas/filelist.xsd

If password authentication is wanted, specify the password in the SFTP client policy of the user agent or in the URL. If public key authentication is wanted, specify the private key for the user in the SFTP client policy of the user agent. Without an SFTP client policy in the user agent, the basic authentication and pubic key authentication policies take effect.

Examples

Use the SFTP protocol to write a file to the home directory of the user1 user on the server.

…
<xsl:variable name="sftp-put-url"
   select="'sftp://user1:123456@xx.xx.xx.xx/~/foo.xml'"/>
<dp:url-open target="{$sftp-put-url}" response="ignore">
  <xsl:copy-of select="/"/>
</dp:url-open>
…