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;
8-22 Developers Guide for Oracle Business Intelligence Publisher
submit the request req.submit;
close the request req.close;
The following table lists the properties that are supported. A String value is required for each property unless otherwise noted.
Table 8–9 Properties for Delivering Documents over HTTP
Property Description
HTTP_METHOD Optional
Sets the HTTP request method. Valid values are:
HTTP_METHOD_POST Default HTTP_METHOD_PUT
HTTP_CONTENT_TYPE Optional
The document content type example: applicationpdf.
HTTP_HOST Required
Enter the server host name. HTTP_PORT
Optional Enter the server port number. The default is 80.
HTTP_REMOTE_DIRECTORY Required
Enter the remote directory name example: home.
HTTP_REMOTE_FILENAME Required
Enter the file name to save the document as in the remote directory.
HTTP_AUTHTYPE Optional
Valid values for authentication type are: HTTP_AUTHTYPE_NONE - no authentication
default HTTP_AUTHTYPE_BASIC - use basic HTTP
authentication HTTP_AUTHTYPE_DIGEST - use digest
HTTP authentication HTTP_USERNAME
Optional If the server requires authentication, enter the
username. HTTP_PASSWORD
Optional If the server requires authentication, enter the
password for the username. HTTP_ENCTYPE
Optional Enter the encryption type:
HTTP_ENCTYPE_NONE - no encryption default
HTTP_ENCTYPE_SSL - use Secure Socket Layer
Using the Delivery Manager Java APIs 8-23
8.11 Delivering Documents over AS2
AS2 is one of the standard protocols defined in the Electronic Data Interchange-Internet Integration EDI-INT. AS2 is based on HTTP and other internet
standard technologies and is designed to exchange data over the internet in a secure manner. The AS2 specification is defined in RFC4130 available at
http:www.ietf.org . The delivery system supports the delivery of documents
to AS2 servers. Sample code is as follows:
Example 8–19 Sample Code for Delivering Documents over AS2
create delivery manager instance DeliveryManager dm = new DeliveryManager;
create a delivery request DeliveryRequest req = dm.createRequestDeliveryManager.TYPE_AS2;
set AS2 message properties req.addPropertyDeliveryPropertyDefinitions.AS2_FROM, Me;
req.addPropertyDeliveryPropertyDefinitions.AS2_TO, You; req.addPropertyDeliveryPropertyDefinitions.AS2_SUBJECT, My EDI Message;
req.addPropertyDeliveryPropertyDefinitions.AS2_CONTENT_TYPE, applicationsEDIFACT;
set HTTP properties req.addPropertyDeliveryPropertyDefinitions.AS2_HTTP_HOST, as2hsot;
req.addPropertyDeliveryPropertyDefinitions.AS2_HTTP_REMOTE_DIRECTORY, ; req.addPropertyDeliveryPropertyDefinitions.AS2_HTTP_REMOTE_FILENAME, as2;
set the document req.setDocumentdocumentmyEDIdoc;
submit the request DeliveryResponse res = req.submit;
close the request req.close;
The following table lists the supported properties. A string value is required for each property unless otherwise noted.
HTTP_USE_FULL_URL Optional
Set to true to send the full URL for the HTTP request header. Valid values are true or
false default. HTTP_USE_CHUNKED_BODY
Optional Valid values are true default to use HTTP
chunked transfer coding for the message body, or false.
HTTP_TIMEOUT Optional
Enter a length of time in milliseconds after which to terminate the request if a connection
is not made to the HTTP server. The default is 60000 1 minute.
HTTP_URL_CHARACTER_ENCODING Encoding of the URL. It will be used if you use
non-ASCII characters in the URL. Set the Java-supported encoding string for the value.
Table 8–9 Cont. Properties for Delivering Documents over HTTP
Property Description