Delivering Your Document over the File Transfer Protocol FTP

8-20 Developers Guide for Oracle Business Intelligence Publisher

8.9.1 Authentication Modes

The secure FTP delivery supports two authentication modes: password authentication and public key authentication. Set the property SFTP_AUTH_TYPE to choose the mode. The default mode is password authentication. The password authentication mode requires the username and password to log in to the secure FTP server. The following example shows sample code: Example 8–16 Sample Code for Password Authentication : : set password auth type req.addPropertyDeliveryPropertyDefinitions.SFTP_AUTH_TYPE, DeliveryPropertyDefinitions.SFTP_AUTH_TYPE_PASSWORD; set username and password to access server req.addPropertyDeliveryPropertyDefinitions.SFTP_USERNAME, myname; req.addPropertyDeliveryPropertyDefinitions.SFTP_PASSWORD, mypassword; : : Table 8–8 Properties for Delivering Documents over SFTP Property Description SFTP_HOST Required Enter the target server host name. SFTP_PORT Optional Enter the target server SSH port number. Default is 22. SFTP_USERNAME Required Enter the login user name. SFTP_PASSWORD Required if you choose the SFTP_AUTH_TYPE_PASSWORD authentication type. Enter the login password. SFTP_REMOTE_ DIRECTORY Required Enter the directory to which to deliver the document example: pub. If no value is entered, the document will be delivered to the login directory. SFTP_REMOTE_ FILENAME Required Enter the document file name on the remote server. SFTP_AUTH_TYPE Set either of the following: SFTP_AUTH_TYPE_PASSWORD Default Requires providing password at login. SFTP_AUTH_TYPE_PUBLIC_KEY - public key authorization type. SFTP_PRIVATE_KEY_FILE Enter the client private key file. Required if you choose SFTP_ AUTH_TYPE_PUBLIC_KEY. SFTP_PRIVATE_KEY_ PASSWORD Enter the client private key password. Required if you choose SFTP_AUTH_TYPE_PUBLIC_KEY. SFTP_FILE_PERMISSION Enter the permissions to set for the file being created. Default is 0755. Using the Delivery Manager Java APIs 8-21 The public key authorization mode requires the username, your private key and password for the private key. This is a more secure method than the password authentication. Note that to use the public key authentication mode, you must set up the public key in the sshsecure FTP server in advance. The following example shows sample code: Example 8–17 Sample Code for Public Key Authentication : : set public key auth type req.addPropertyDeliveryPropertyDefinitions.SFTP_AUTH_TYPE, DeliveryPropertyDefinitions.SFTP_AUTH_TYPE_PUBLIC_KEY; set username req.addPropertyDeliveryPropertyDefinitions.SFTP_USERNAME, myname; set the clients private key file req.addPropertyDeliveryPropertyDefinitions.SFTP_PRIVATE_KEY_FILE, pathtothekey; set the clients private key password req.addPropertyDeliveryPropertyDefinitions.SFTP_PRIVATE_KEY_PASSWORD, myPrivateKeyPass; : :

8.10 Delivering Your Documents over Hypertext Transfer Protocol HTTP

The Delivery Manager supports delivery of documents to HTTP servers. The following sample sends a document through the HTTP POST method. Note that the receiving HTTP server must be able to accept your custom HTTP request in advance for example through a custom servlet or CGI program. Example 8–18 Sample Code for Delivering Documents over HTTP create delivery manager instance DeliveryManager dm = new DeliveryManager; create a delivery request DeliveryRequest req = dm.createRequestDeliveryManager.TYPE_HTTP; set request method req.addPropertyDeliveryPropertyDefinitions.HTTP_METHOD, DeliveryPropertyDefinitions.HTTP_METHOD_POST; set document content type req.addPropertyDeliveryPropertyDefinitions.HTTP_CONTENT_TYPE, applicationpdf; set the HTTP server hostname req.addPropertyDeliveryPropertyDefinitions.HTTP_HOST, myhost; set the HTTP server port number req.addPropertyDeliveryPropertyDefinitions.HTTP_PORT, 80; set the target remote directory req.addPropertyDeliveryPropertyDefinitions.HTTP_REMOTE_DIRECTORY, servlet; set the remote filename servlet class req.addPropertyDeliveryPropertyDefinitions.HTTP_REMOTE_FILENAME, uploadDocument; set the document req.setDocumentdocumenttest.pdf;