You are on page 1of 28

Automating HCM Data Loader

Oracle Fusion Human Capital Management 11g Release 11 (11.1.11)


ORACLE WHITE PAPER | OCTOBER 2016
Table of Contents

Introduction 1

Oracle WebCenter Content 2

Security 2

Methods of Staging Files on the WebCenter Content Server 2

File Import and Export Interface 2

WebCenter Content Document Transfer Utility Interface 2

Remote Intradoc Client (RIDC) 3

Example Code for Uploading a File to the WebCenter Content Server 4

HCM Data Loader 7

Security 7

Methods of Initiating HCM Data Loader 7

Import and Load Data Interface 7

HCM Data Loader Integration Service 7

Import and Load Data Method 8

Get Data Set Status Method 8

Sample Code to Invoke and Monitor HCM Data Loader 9

HCM Extracts 20

HCM Extracts in the Payroll Flow Engine 20

Invoking HCM Extracts 21

Monitoring the Extract 22

Retrieving HCM Extracts XML 23

HCM Extract BI Report Output Location 24

AUTOMATING HCM DATA LOADER


Table of Figures
Figure 1. Example Invocation Command for the WebCenter Content Document Transfer Utility .............................. 3
Figure 2. Example Showing How to Include Libraries in a JDeveloper Project ......................................................... 4
Figure 3. Attributes of the DataBinder Object Used in the Code Example ................................................................ 5
Figure 4. Example Java Code for Uploading Files to Oracle WebCenter Content .................................................... 7
Figure 5: Parameters for the HcmDataLoader Web Service importAndLoadData Method ........................................ 8
Figure 6. Invoking HCM Data Loader ....................................................................................................................... 9
Figure 7. Example of a Certificate in a Service WSDL File ..................................................................................... 10
Figure 8: Example - Invoking the HCM Data Loader getDataSetStatus Method ..................................................... 15
Figure 9: Example - Output of the HCM Data Loader getDataSetStatus Method .................................................... 15
Figure 10: Example - Invoking the HCM Data Loader Automation Method ............................................................. 19
Figure 11: Example - Output of the HCM Data Loader Automation Method ........................................................... 20
Figure 12: Flow Pattern for an HCM Extract ........................................................................................................... 21

AUTOMATING HCM DATA LOADER


Introduction
This document describes how to automate the HCM Data Loader processes to load your data
successfully into Oracle HCM Cloud and extract both status information and error details.

For more general guidelines on the use of HCM Data Loader, see the Users Guide (MOS Doc ID:
1664133.1)

Files to be loaded with HCM Data Loader must first be uploaded to the Oracle WebCenter Content
server. This document covers three topics:

Oracle WebCenter Content How to automate the upload of your file


HCM Data Loader How to automate the submission of your file.
HCM Extracts How to automate and retrieve output from the HCM Data Loader Data Set Summary.

1 | AUTOMATING HCM DATA LOADER


Oracle WebCenter Content
Oracle WebCenter Content is the infrastructure for the staging of data files for processing by HCM Data Loader. It
offers secure file-management capabilities and is used by many Oracle Fusion applications.

This document reviews methods of staging a file for HCM Data Loader on the WebCenter Content server. Once a
file is staged, it can be processed by invoking an externally available web service, details of which are also provided
in this document.

Security
In order to upload files to the WebCenter Content server, your user must have the following duty role:

File Import and Export Management Duty


(FND_FILE_IMPORT_AND_EXPORT_MANAGEMENT_DUTY)

Methods of Staging Files on the WebCenter Content Server


You can stage a zip file on the WebCenter Content server using:

The Oracle Applications Cloud File Import and Export interface

The WebCenter Content Document Transfer Utility

Remote Intradoc Client (RIDC).

File Import and Export Interface


This method of loading files to the WebCenter Content server is fully documented in the HCM Data Loader Users
Guide (MOS Doc ID: 1664133.1).

WebCenter Content Document Transfer Utility Interface


The WebCenter Content Document Transfer Utility for Oracle Fusion Applications is a feature-set Java library that
provides content export and import capabilities. The utility can be evaluated from the Individual Component
Downloads section of the Oracle WebCenter Content 11gR1 Downloads tab on Oracle Technology Network (OTN):

http://www.oracle.com/technetwork/middleware/webcenter/content/downloads/wcc-11g-downloads-2734036.html

Note: Current customers download from Oracle Software Delivery Cloud.

Open the Individual Components Download section on the Downloads tab, accept the license agreement, and
download the WebCenter Content Document Transfer Utility. Once the component zip file is downloaded, extract the
JAR file. The zip file also contains a useful readme file describing the example invocation command shown in
Figure 1. Example Invocation Command for the WebCenter Content Document Transfer UtilityFigure 1.

java -classpath "oracle.ucm.fa_client_11.1.1.jar" oracle.ucm.client.UploadTool --url=https://{host}/cs/idcplg


--username=<provide_user_name> --password=<provide_password> --primaryFile="<file_path_with_filename>" --
dDocTitle="<provide_Zip_Filename>" -dDocAccount=hcm/dataloader/import

2 | AUTOMATING HCM DATA LOADER


For example

java -cp "oracle.ucm.fa_client_11.1.1.jar" oracle.ucm.client.UploadTool --url="https://{host}/cs/idcplg" --


username="HCM_IMPL" --password="Welcome1" --primaryFile="/scratch/HRDataFile.zip" --dDocTitle="Department Load
File" --dSecurityGroup="FAFusionImportExport" --dDocAccount="hcm/dataloader/import"

Figure 1. Example Invocation Command for the WebCenter Content Document Transfer Utility

Sample Output

Oracle WebCenter Content Document Transfer Utility


Oracle Fusion Applications
Copyright (c) 2013, Oracle. All rights reserved.
Performing upload (CHECKIN_UNIVERSAL) ...
Upload successful.
[dID=21537 | dDocName=UCMFA021487]

How to Define the WebCenter Content URL


The URL in the command line uses the same domain name as your service.

Obtain the URL for Setup and Maintenance from the Service Details section in the cloud environments provisioning
e-mail that your service administrator received.

It should look like the following example: -

https://fs-xxxxxxxxxxx.oracleoutsourcing.com/setup/faces/TaskListManagerTop

Modify this URL by removing /setup/Task and replacing it with /cs/idcplg.

The above URL would now be as follows:

https://fs-xxxxxxxxxxx.oracleoutsourcing.com/cs/idcplg

This method of defining the WebCenter Content URL applies to all examples given in this document.

Other Command Line Parameters


The dDocName value (which is equivalent to the content ID) returned when executing the above statement is
required for the HCMDataLoader call described later in this document.

Review the readme file downloaded with the WebCenter Content Document Transfer Utility for a list of all
parameters, including advanced networking options for resolving proxy issues.

Remote Intradoc Client (RIDC)


The RIDC communication API removes data abstractions to Oracle Content Server while still providing a wrapper to
handle connection pooling, security, and protocol specifics. This is the recommended approach if you want to use
native Java APIs.

RIDC supports three protocols: Intradoc, HTTP, and JAX-WS.

Intradoc

3 | AUTOMATING HCM DATA LOADER


The Intradoc protocol communicates with Oracle Content Server over the Intradoc socket port (typically, 4444). This
protocol does not perform password validation and so requires a trusted connection between the client and Oracle
Content Server. Clients that use this protocol are expected to perform any required authentication. Intradoc
communication can also be configured to run over SSL.

HTTP
RIDC communicates with the web server for Oracle Content Server using the Apache HttpClient package. Unlike
Intradoc, this protocol requires authentication credentials for each request.

JAX-WS
The JAX-WS protocol is supported only in Oracle WebCenter Content 11g with Oracle Content Server running in
Oracle WebLogic Server. To provide JAX-WS support, several additional JAR files are required.

For more information, see:

Oracle WebCenter Content Developer's Guide for Content Server (specifically the section Using RIDC to
Access Content Server)

Oracle Fusion Middleware Developer's Guide for Remote Intradoc Client (RIDC)

Once the RIDC Component Library download file has been unzipped, include the following JAR files in your project.
Figure 2 shows an example from Oracle JDeveloper.

Figure 2. Example Showing How to Include Libraries in a JDeveloper Project

Example Code for Uploading a File to the WebCenter Content Server

4 | AUTOMATING HCM DATA LOADER


Parameters

Parameter Meaning Comment for HCM Data Loader

IdcService The service to invoke. CHECKIN_UNIVERSAL for uploading files

dDocName The Content ID for the content item Value passed to HcmDataLoader

dDocAuthor The content item author (contributor)

dDocTitle The content item title. The title of the file as it appears in Import/Export
UI

dDocType The content item type. Document

dSecurityGroup The security group, such as Public or Secure. FAFusionImportExport

dDocAccount The account for the content item. Required only if accounts are hcm$/dataloader$/import$
enabled.

primaryFile The absolute path to the location of the file as seen from the
server.

Figure 3. Attributes of the DataBinder Object Used in the Code Example

Example Code
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;

import oracle.stellent.ridc.IdcClient;
import oracle.stellent.ridc.IdcClientException;
import oracle.stellent.ridc.IdcClientManager;
import oracle.stellent.ridc.IdcContext;
import oracle.stellent.ridc.model.DataBinder;
import oracle.stellent.ridc.model.TransferFile;
import oracle.stellent.ridc.protocol.ServiceResponse;

public class UploadFile {


public static void main(String[] arg) throws Exception {
try {
IdcClientManager m_clientManager = new IdcClientManager();
IdcClient idcClient =
m_clientManager.createClient("https://{host}/cs/idcplg"); // replace with relevant URL
IdcContext userContext = new IdcContext("HCM_ADMIN", "Password");
// replace with relevant username password

checkin(idcClient,
userContext,
"/scratch/jdoe/ridc/BusinessUnit1.zip",
// Replace with fully qualified path to source file
"Document", // content type
"BusinessUnit1", // doc title
userContext.getUser(), // author
"FAFusionImportExport", // security group
"hcm$/dataloader$/import$", // account
"BU5") // dDocName - this is the ContentId
;

5 | AUTOMATING HCM DATA LOADER


}
catch (IdcClientException e)
{e.printStackTrace();}
}

/**
* Method description
* @param idcClient
* @param userContext
* @param sourceFileFQP fully qualified path to source content
* @param contentType content type
* @param dDocTitle doc title
* @param dDocAuthor author
* @param dSecurityGroup security group
* @param dDocAccount account
* @param dDocName dDocName
*
* @throws IdcClientException
*/
public static void checkin(IdcClient idcClient, IdcContext userContext,
String sourceFileFQP, String contentType,
String dDocTitle, String dDocAuthor,
String dSecurityGroup, String dDocAccount,
String dDocName) throws IdcClientException {
InputStream is = null;
try {
String fileName =
sourceFileFQP.substring(sourceFileFQP.lastIndexOf('/') + 1);

is = new FileInputStream(sourceFileFQP);

long fileLength = new File(sourceFileFQP).length();

TransferFile primaryFile = new TransferFile();


primaryFile.setInputStream(is);
primaryFile.setContentType(contentType);
primaryFile.setFileName(fileName);
primaryFile.setContentLength(fileLength);

// note!!! when using HTTP protocol (not intradoc/jaxws) - you must explicitly
// set the Content Length when supplying an InputStream to the transfer file
// e.g. primaryFile.setContentLength(xxx);
// otherwise, a 0-byte file results on the server

DataBinder request = idcClient.createBinder();


request.putLocal("IdcService", "CHECKIN_UNIVERSAL");
request.addFile("primaryFile", primaryFile);
request.putLocal("dDocTitle", dDocTitle);
request.putLocal("dDocAuthor", dDocAuthor);
request.putLocal("dDocType", contentType);
request.putLocal("dSecurityGroup", dSecurityGroup);

// if server is setup to use accounts - an account MUST be specified


// even if it is the empty string; supplying null results in Content server
// attempting to apply an account named "null" to the content!
request.putLocal("dDocAccount", dDocAccount == null ? "" : dDocAccount);

6 | AUTOMATING HCM DATA LOADER


if (dDocName != null && dDocName.trim().length() > 0) {
request.putLocal("dDocName", dDocName);
}

// execute the request


ServiceResponse response =
idcClient.sendRequest(userContext, request); // throws IdcClientException

// get the binder - get a binder closes the response automatically


DataBinder responseBinder =
response.getResponseAsBinder(); // throws IdcClientException

} catch (IOException e) {
e.printStackTrace(System.out);
} finally {
if (is != null) {
try {
is.close();
} catch (IOException ignore) {
}
}
}
}
}

Figure 4. Example Java Code for Uploading Files to Oracle WebCenter Content

HCM Data Loader


HCM Data Loader accepts only compressed zip files that have been staged on the Oracle WebCenter Content
server and secured with the hcm/dataloader/import account.

Security
In order to process files using HCM Data Loader, your user must have the following role:

Human Capital Management Integration Specialist


(ORA_HRC_HUMAN_CAPITAL_MANAGEMENT_INTEGRATION_SPECIALIST_JOB)

Methods of Initiating HCM Data Loader


You can initiate Oracle WebCenter Content staged files using:

The HCM Data Loader Import and Load Data interface

The HCM Data Loader Integration Service

Import and Load Data Interface


This method of initiating files for bulk load into Oracle HCM Cloud is fully documented in the HCM Data Loader
Users Guide (MOS Doc ID: 1664133.1).

HCM Data Loader Integration Service

7 | AUTOMATING HCM DATA LOADER


HCM Data Loader implements a web service that can be used to initiate the import and load of data files staged on
the WebCenter Content server and monitor the progress of a data file.

importAndLoadData Initiates the processing of a data file.

getDataSetStatus Returns the current status of a data file.

Import and Load Data Method


The importAndLoadData method initiates the processing of a data file hosted on the WebCenter Content server. It
is an asynchronous job returning only the ProcessId of the submitted process.

Note: The ProcessId is the request ID for the concurrent process that initiates HCM Data Loader processing. If you
wish to review the progress of your data set via the user interface, then this value is available in the Data Sets table
on the Import and Load Data page, but is hidden by default.

IMPORT AND LOAD DATA PARAMETERS

Parameter Description

ContentId Content ID of the file on the WebCenter Content server (the same value as dDocName in the WebCenter Content Java
call)

Parameters Name and value pairs. The following parameter names are available. None of these parameters is mandatory. For values
that you do not supply, the defaults specified on the Configure HCM Data Loader page are used.
ImportMaximumErrors Percentage of file lines in error that can occur in a business object before the import process
stops.
ImportConcurrentThreads Number of concurrent threads when importing.
LoadMaximumErrors Percentage of business object instances in error that can occur for a business object before
the validation and load processes stop.
LoadConcurrentThreads Number of concurrent threads when validating or loading.
LoadGroupSize Number of business objects processed as a single unit of work by a concurrent thread.
FileEncryption Type of file encryption
DeleteSourceFile Y to purge the source file from the WebCenter Content server after processing it.

Name and value are paired with an equals (=) sign. Parameters must be comma delimited.
Examples:
ImportMaximumErrors=100,LoadMaximumErrors=100,LoadConcurrentThreads=4, DeleteSourceFile=Y
FileEncryption=PGPSIGNED

Figure 5: Parameters for the HcmDataLoader Web Service importAndLoadData Method

Get Data Set Status Method


The getDataSetStatus method returns the current status of the specified data file.

GET DATA SET STATUS PARAMETERS

Parameter Description

Parameters Name and value pairs. The following parameter names are available
ProcessId The ID of the process initiated and returned by the importAndLoadData method.
ContentId Content ID of the file on the WebCenter Content server (the same value as dDocName in the

8 | AUTOMATING HCM DATA LOADER


WebCenter Content Java call)
Name and value are paired with an equals (=) sign. Parameters must be comma delimited.
Examples:
ProcessId=1213
ProcessId=1231,ContentId=UCMFA23411

Figure 7. Parameters for the HcmDataLoader Web Service getDataSetStatus Method

Either one or both of these parameters must be supplied, though the ProcessId is recommended.

Sample Code to Invoke and Monitor HCM Data Loader


Several ways exist of invoking Oracle HCM Cloud web services. This section explains how to invoke web services
using generated proxy classes. You can generate your own proxy classes by providing the URL of the service
WSDL file to your generator of choice. These proxy classes are then used to invoke the web service.

Note: Oracle HCM Cloud web services are protected by Oracle Web Services Manager (OWSM) security policies.
Refer to the OWSM Security and Administrator's Guide for Web Services for further details.

Invoking HCM Data Loader


http://{Host}/hcmCommonDataLoader/HCMDataLoader
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:importAndLoadData
xmlns:ns1="http://xmlns.oracle.com/apps/hcm/common/dataLoader/core/dataLoaderIntegrationService/types/">
<ns1:ContentId></ns1:ContentId>
<ns1:Parameters></ns1:Parameters>
</ns1:importAndLoadData>
</soap:Body>
</soap:Envelope>

Figure 6. Invoking HCM Data Loader

The method for resolving the URL is slightly different from the method outlined for WebCenter Content (given
earlier). Use the domain name given for the Service Home URL, which is shown in the Service Details section of
your service provision e-mail. Using the same example given earlier, the above URL will be:

https://hcm-xxxxxxxxxxx.oracleoutsourcing.com/hcmCommonDataLoader/HCMDataLoader?wsdl

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsa="http://www.w3.org/2005/08/addressing">
<env:Header>
<wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>
<wsa:Action>http://xmlns.oracle.com/apps/hcm/common/dataLoader/core/dataLoaderIntegrationService//HCMDataLoa
der/importAndLoadDataResponse</wsa:Action>
<wsa:MessageID>urn:uuid:ab36195f-775b-4688-a0e4-8a4e531e904c</wsa:MessageID>
<wsa:RelatesTo>urn:uuid:74c7b631-c20a-4d49-bf36-1f483f3dc43e</wsa:RelatesTo>
</env:Header>
<env:Body>
<ns0:importAndLoadDataResponse
xmlns:ns0="http://xmlns.oracle.com/apps/hcm/common/dataLoader/core/dataLoaderIntegrationService/types/">

9 | AUTOMATING HCM DATA LOADER


<result
xmlns="http://xmlns.oracle.com/apps/hcm/common/dataLoader/core/dataLoaderIntegrationService/types/">7958</resul
t>
</ns0:importAndLoadDataResponse>
</env:Body>
</env:Envelope>

Implications of Security Policy on the HCMDataLoader Web Service


The HCMDataLoader web service is secured using the following policy:

oracle/wss11_saml_or_username_token_with_message_protection_service_policy

Therefore, when a client calls the service it must satisfy the message-protection policy to ensure that the payload is
transported encrypted or sent over the SSL transport layer.

If payload encryption is desirable or otherwise required, a client policy that can be used to meet this requirement is:

oracle/wss11_username_token_with_message_protection_client_policy

To use this policy, the message must be encrypted using a public key provided by the server. When the message
reaches the server it can be decrypted by the server's private key. A KeyStore is used to import the certificate and it
is referenced in the subsequent client code.

The public key can be obtained from the certificate provided in the service WSDL file. See Figure 7 (the certificate is
Base64 encoded).

Figure 7. Example of a Certificate in a Service WSDL File

To use the key contained in this certificate, you need to create a local KeyStore and import the certificate into it:

1. Create a new file with any name you like. You must change the extension to .cer to indicate that it is a
certificate file.

2. Using a text editor, open the file you just created and enter "-----BEGIN CERTIFICATE-----" on the first line.

10 | AUTOMATING HCM DATA LOADER


3. On the next line, copy the Base64 encoded certificate from the service WSDL file to the newly created
certificate file.

4. Add "-----END CERTIFICATE-----" on a new line and save the file. Now you have a certificate containing the
public key from the server.

5. Open the command line and change the directory to $JAVA_HOME/bin. Use the following command to create
a KeyStore and import the public key from the certificate.

keytool -import -file <Provide the path of the certification.cer file> -alias orakey -keypass welcome -keystore
<Provide the path where the jks file needs to be created(including the file name)> -storepass welcome

6. You can find the KeyStore file in the KeyStore path you set.

Once the client KeyStore has been created, you can call the service using the proxy classes. The following
parameters are used by the proxy class to encrypt and decrypt the message.

PROXY CLASS PARAMETERS

Parameter Description

WSBindingProvider.USERNAME_PROPERTY User name of the application user who has relevant privileges for importing and
processing HDL data files.

WSBindingProvider.PASSWORD_PROPERTY The password of the above user.

ClientConstants.WSSEC_KEYSTORE_TYPE Type of the KeyStore you created. JKS (Java KeyStore) is widely used and is
the most common type.

ClientConstants.WSSEC_KEYSTORE_LOCATION Path of the client KeyStore file.

ClientConstants.WSSEC_KEYSTORE_PASSWORD Password of your client KeyStore.

ClientConstants.WSSEC_ENC_KEY_ALIAS Alias of the key you use to decrypt the SOAP message from the server.

ClientConstants.WSSEC_ENC_KEY_PASSWORD Password of the key you use to decrypt the SOAP message.

ClientConstants.WSSEC_RECIPIENT_KEY_ALIAS Alias of the key you use to encrypt the SOAP message to the server.

How to Create a Proxy Class


Generate the JAX-WS proxy class for the HCMDataLoader web service using the wsimport command, which is
available at JAVA_HOME/bin:

wsimport -s <Provide the folder where the generated files need to be placed> -d <Provide the folder where the
generated files need to be placed> <The HCM Data Loader Integration Service URL>

Example:

wsimport -s "D:\HCMDataLoader" -d "D:\ HCMDataLoader" https://{host}/hcmCommonDataLoader/HCMDataLoader?wsdl

The generated files are placed in the following two folders:

com
sdo

11 | AUTOMATING HCM DATA LOADER


Add the generated code to a JAR file:

zip loaderIntegrationProxy.jar -r * -

How to Invoke the importAndLoadData Web Service


Create the client class HCMDataLoaderServiceSoapHttpPortClient for invoking the
dataloaderintegrationservice. The class must be created in the folder:

com/oracle/xmlns/apps/hcm/common/dataloader/core/dataloaderintegrationservice

package com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice;
import com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice.HCMDataLoader;
import com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice.HCMDataLoader_Service;
import com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice.ServiceException;

import java.util.Map;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.WebServiceRef;
import weblogic.wsee.jws.jaxws.owsm.SecurityPolicyFeature;

public class HCMDataLoaderServiceSoapHttpPortClient {


@WebServiceRef
private static HCMDataLoader_Service hcmDataLoader_Service;
public HCMDataLoaderServiceSoapHttpPortClient() {
super();
}
public static void main(String[] args) {
hcmDataLoader_Service = new HCMDataLoader_Service();
SecurityPolicyFeature[] securityFeatures =
new SecurityPolicyFeature[] { new
SecurityPolicyFeature("oracle/wss11_username_token_with_message_protection_client_policy") };
HCMDataLoader hcmLoaderService =
hcmDataLoader_Service.getHCMDataLoaderSoapHttpPort(securityFeatures);
BindingProvider wsbp = (BindingProvider)hcmLoaderService;
Map<String, Object> requestContext = wsbp.getRequestContext();
requestContext.put(BindingProvider.USERNAME_PROPERTY,"Provide the applications username");
requestContext.put(BindingProvider.PASSWORD_PROPERTY, "Provide the password");
requestContext.put("oracle.webservices.security.keystore.type", "JKS");
requestContext.put("oracle.webservices.security.keystore.location",
"Provide the location of the default-keystore.jks (including the file name)");
requestContext.put("oracle.webservices.security.keystore.password", "welcome");
requestContext.put("oracle.webservices.security.encryption.key.alias", "orakey");
requestContext.put("oracle.webservices.security.encryption.key.password", "welcome");
requestContext.put("oracle.webservices.security.recipient.key.alias", "orakey");

String contentId = args[0];


String parameters = args[1];
String response;

try {
response = hcmLoaderService.importAndLoadData(contentId,parameters);
System.out.println("The response received from the server is ...");
System.out.println(response);
} catch (ServiceException e) {
System.out.println("Error occurred during the invocation of the service ...");

12 | AUTOMATING HCM DATA LOADER


e.printStackTrace();
}
}
}

To generate the class file you need the following JAR file:

ws.api_1.1.0.0.jar

This JAR file is available at the following location:

$MIDDLEWARE_HOME/modules

If you do not have the JAR file, it can be can be downloaded as part of JDeveloper. The JAR file is available at the
following location in the JDeveloper installation:

modules/ ws.api_1.1.0.0.jar

Compile the Java code:

javac -classpath <Provide the path of the folder where the JAX-WS files are generated>;<Provide the location of
the ws.api_1.1.0.0.jar> HCMDataLoaderServiceSoapHttpPortClient.java

Run the class HCMDataLoaderServiceSoapHttpPortClient to invoke the HCM Data Loader Integration Service:

java -classpath <Provide the path of the folder where the JAX-WS files are generated>;<Provide the location of
the weblogic.jar>;<Provide the location of the jrf.jar>
com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice.HCMDataLoaderServiceSoapHttpPortCli
ent <ContentId> <Parameters>

How to Invoke the getDataSetStatus Web Service


Create the client class HCMDataLoaderServiceGetDataSetStatus in the following package for invoking the
getDataSetStatus() method.

com/oracle/xmlns/apps/hcm/common/dataloader/core/dataloaderintegrationservice

package com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice;
import com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice.HCMDataLoader;
import com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice.HCMDataLoader_Service;
import com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice.ServiceException;

import java.util.Map;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.WebServiceRef;
import weblogic.wsee.jws.jaxws.owsm.SecurityPolicyFeature;

public class HCMDataLoaderServiceGetDataSetStatus {


@WebServiceRef
private static HCMDataLoader_Service hcmDataLoader_Service;

13 | AUTOMATING HCM DATA LOADER


public HCMDataLoaderServiceGetDataSetStatus() {
super();
}

public static void main(String[] args) {


hcmDataLoader_Service = new HCMDataLoader_Service();
SecurityPolicyFeature[] securityFeatures =
new SecurityPolicyFeature[] { new
SecurityPolicyFeature("oracle/wss11_saml_token_with_message_protection_client_policy") };
HCMDataLoader hcmLoaderService = hcmDataLoader_Service.getHCMDataLoaderSoapHttpPort(securityFeatures);
BindingProvider wsbp = (BindingProvider)hcmLoaderService;
Map<String, Object> requestContext = wsbp.getRequestContext();
requestContext.put(BindingProvider.USERNAME_PROPERTY,"Provide the applications username");
requestContext.put(BindingProvider.PASSWORD_PROPERTY, "Provide the password");
requestContext.put("oracle.webservices.security.keystore.type", "JKS");
requestContext.put("oracle.webservices.security.keystore.location",
"Provide the location of the default-keystore.jks (including the file name)");
requestContext.put("oracle.webservices.security.keystore.password", "welcome");
requestContext.put("oracle.webservices.security.encryption.key.alias", "orakey");
requestContext.put("oracle.webservices.security.encryption.key.password", "welcome");
requestContext.put("oracle.webservices.security.recipient.key.alias", "orakey");

String parameters = args[0];


String response;

try {
response = hcmLoaderService.getDataSetStatus(parameters);
System.out.println("The latest Data Set Status ....\n\n\n\n\n");
System.out.println(response);
} catch (ServiceException e) {
System.out.println("Error occurred during the invocation of the service ...");

e.printStackTrace();
}
}
}

Provide the necessary values in the above java file and compile.

Compile the Java code:

javac -classpath <Provide the path of the folder where the JAX-WS files are generated>;<Provide the location of
the ws.api_1.1.0.0.jar> HCMDataLoaderServiceGetDataSetStatus.java

Run the class HCMDataLoaderServiceGetDataSetStatus to invoke the HCM Data Loader Integration Service:

java -classpath <Provide the path of the folder where the JAX-WS files are generated>;<Provide the location of
the weblogic.jar>;<Provide the location of the jrf.jar>
com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice.HCMDataLoaderServiceGetDataSetStatu
s <ProcessId=nnnn,ContentId=xxxx>

getDataSetStatus Example

Invocation of the getDataSetStatus method:

14 | AUTOMATING HCM DATA LOADER


Figure 8: Example - Invoking the HCM Data Loader getDataSetStatus Method

Response:

Figure 9: Example - Output of the HCM Data Loader getDataSetStatus Method

Automating the Initiation of Multiple Files with HCM Data Loader


You may have multiple files to process, but dont want a file to be submitted until the completion of the previous file.
The code example below provides the following functionality:

Invoke the first data set.

At regular intervals, retrieve the current status of the data set until complete.

Invoke the next data set.

At regular intervals, retrieve the current status of the data set until complete.

15 | AUTOMATING HCM DATA LOADER


Create the client class HCMDataLoaderServiceAutomation in the following package::

com/oracle/xmlns/apps/hcm/common/dataloader/core/dataloaderintegrationservice

package com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice;

import com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice.HCMDataLoader;
import com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice.HCMDataLoader_Service;
import com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice.ServiceException;

import java.util.Map;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.WebServiceRef;

import weblogic.wsee.jws.jaxws.owsm.SecurityPolicyFeature;

import java.io.IOException;
import java.io.StringReader;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class HCMDataLoaderServiceAutomation {


@WebServiceRef
private static HCMDataLoader_Service hcmDataLoader_Service;

public HCMDataLoaderServiceAutomation() {
super();
}

public static final long time_interval = 60000L;


// Provide time in milli seconds. sample here is 60 secs. 60000/1000 = 60 sec.

public static void main(String[] args) {


hcmDataLoader_Service = new HCMDataLoader_Service();
SecurityPolicyFeature[] securityFeatures =
new SecurityPolicyFeature[] { new
SecurityPolicyFeature("oracle/wss11_saml_token_with_message_protection_client_policy") };

HCMDataLoader hcmLoaderService =
hcmDataLoader_Service.getHCMDataLoaderSoapHttpPort(securityFeatures);
BindingProvider wsbp = (BindingProvider)hcmLoaderService;
Map<String, Object> requestContext = wsbp.getRequestContext();
requestContext.put(BindingProvider.USERNAME_PROPERTY,"Provide the applications username");
requestContext.put(BindingProvider.PASSWORD_PROPERTY, "Provide the password");
requestContext.put("oracle.webservices.security.keystore.type", "JKS");
requestContext.put("oracle.webservices.security.keystore.location", "Provide the location of the default-

16 | AUTOMATING HCM DATA LOADER


keystore.jks (including the file name)");
requestContext.put("oracle.webservices.security.keystore.password", "welcome");
requestContext.put("oracle.webservices.security.encryption.key.alias", "orakey");
requestContext.put("oracle.webservices.security.encryption.key.password", "welcome");
requestContext.put("oracle.webservices.security.recipient.key.alias", "orakey");

String ucmContentIdList = args[0];


//Example : "UCMFA0123,DeleteSourceFile=Y;UCMFA01234,DeleteSourceFile=N";

String[] individualUcmArray = ucmContentIdList.split(";");


String ucmContentId = "";
String parameters = "";
String response = "";
Long processId;

for (String ucmIdAndParameters: individualUcmArray) {


String[] array = ucmIdAndParameters.split(",");

if (array.length == 2) {
ucmContentId = array[0];
parameters = array[1];
} else if (array.length == 1) {
ucmContentId = array[0];
parameters = "";
}

try {
System.out.println("\n\n\n\n\n\n");
System.out.println("Invoking importAndLoad() method for ucmContentId " + ucmContentId);
response = hcmLoaderService.importAndLoadData(ucmContentId, parameters);
processId = Long.valueOf(response);
System.out.println("\n\nImportAndLoad() method invocation for UcmContentId " + ucmContentId +
" is Successful, ProcessId generated is : " + processId);

System.out.println("\n\nInvoking the getDataSetStatus() method for UCM File " + ucmContentId


+ " to verify the latest status");

invokeGetDataSetStatus(hcmLoaderService, processId);

System.out.println("\n\n Load Completed for Data Set with UCM Content Id " + ucmContentId);

} catch (Exception e) {
System.out.println(response);

System.out.println("\n\nNo further processing....Program Exit");


break;
}
}

public static boolean invokeGetDataSetStatus(HCMDataLoader hcmLoaderService,


Long processId) throws ParserConfigurationException,
SAXException,
IOException,

17 | AUTOMATING HCM DATA LOADER


ServiceException {
String response = hcmLoaderService.getDataSetStatus("ProcessId=" + processId);

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();


DocumentBuilder builder = factory.newDocumentBuilder();

Document document = builder.parse(new InputSource(new StringReader(response)));

NodeList flowList = document.getElementsByTagName("DATA_SET_STATUS");

NodeList childList;
for (int i = 0; i < flowList.getLength(); i++) {
childList = flowList.item(i).getChildNodes();
for (int j = 0; j < childList.getLength(); j++) {
Node childNode = childList.item(j);
if ("DATA_SET".equals(childNode.getNodeName())) {
NodeList dataSeteChildNodes = childNode.getChildNodes();
{
for (int k = 0; k < dataSeteChildNodes.getLength();
k++) {
{
Node childDSNode = dataSeteChildNodes.item(k);

if ("STATUS".equals(childDSNode.getNodeName())) {

String status = dataSeteChildNodes.item(k).getTextContent().trim();


System.out.println("Current Status of the Data Set " +
dataSeteChildNodes.item(k).getTextContent().trim());
if ("COMPLETED".equals(status) ||
"ERROR".equals(status)) {
return true;
} else {
try {
System.out.println("Waiting for " + (time_interval / 1000) +
" secs, to recalculate the status ... ");
Thread.sleep(time_interval);
invokeGetDataSetStatus(hcmLoaderService, processId);

} catch (InterruptedException e) {
System.out.println("\n\nException while thread waiting....Program Exit");
}
}
}
}
}
}
}
}
}
return false;
}
}

The above automation code checks the status of the data set based on the time_interval value provided. By default,
the value is 60 seconds. Make sure to edit the time_interval variable based on the file size.

Compile the Java code:

18 | AUTOMATING HCM DATA LOADER


javac -classpath <Provide the path of the folder where the JAX-WS files are generated>;<Provide the location of
the ws.api_1.1.0.0.jar> HCMDataLoaderServiceAutomation.java

Run the class HCMDataLoaderServiceAutomation to invoke the HCM Data Loader Integration Service:

java -classpath <Provide the path of the folder where the JAX-WS files are generated>;<Provide the location of
the weblogic.jar>;<Provide the location of the jrf.jar>
com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice.HCMDataLoaderServiceAutomation
<ContentId=xxxx;DeleteSourceFile=N|ContentId=xxxx>

HCM Data Loader Service Automation Parameters

The list of WebCenter Content server IDs for each file to be processed should be delimited using pipe (|) characters.
You can optionally provide HCM Data Loader service parameters for each file by delimiting the parameter name and
value pairs with semi-colons(;). For example:

ContentId=UCMFA131235;DeleteSourceFile=N,LoadConcurrentThreads=4|ContentId=UCMFA131236;Loa
dConcurrentThreads=4

HCMDataLoaderServiceAutomation Example

Invocation of HCMDataLoaderServiceAutomation:

Figure 10: Example - Invoking the HCM Data Loader Automation Method

Response:

19 | AUTOMATING HCM DATA LOADER


Figure 11: Example - Output of the HCM Data Loader Automation Method

HCM Extracts
HCM Extracts is a powerful tool within Oracle HCM Cloud that is used for reporting and outbound integrations. It
generates raw XML as well as providing the capability to integrate with BI Publisher to generate formatted output in
a variety of supported formats.

When you use HCM Extracts as part of an integrated process, you may need to invoke it automatically as part of an
automated flow. In addition, once the extract is complete, it is likely that the output needs to be retrieved for
subsequent processing.

HCM Extracts in the Payroll Flow Engine


The Payroll Flow Engine is a generic processing engine that has the capability to invoke a wide range of different
types of processes. It is the mechanism by which HCM Extracts are invoked.

When an HCM extract is defined, it generates a flow object in the payroll flow data model with the same name as the
HCM extract itself. This flow is used to control the processing of the HCM extract, including setting any parameters

20 | AUTOMATING HCM DATA LOADER


and handling the individual steps within the flow. By default, there is just one step (or task) in the flow, but additional
tasks can be added. When a specific HCM extract flow is invoked, a flow instance is created.

The ability to manage the invocation of a flow and the tasks within it is the key to being able to automate a process
through the Payroll Flow Engine, and hence the way in which an HCM extract can be automated.

HCM Data Loader delivers the HCM Data Loader Data Set Summary and Compensation Changes extracts.
Before either can be used, it is recommended that you make a copy of the predefined extract and edit the default
definition to suit your requirements. This may involve generating a BI Publisher layout. Further details about these
two extracts and how to copy them are available from the HCM Data Loader Extracts document (MOS Doc ID:
1664133.1).

When you save a copy of an HCM extract you also create a payroll flow of type EXTRACT with the same name as
the saved extract, for example, HDL Data Set Summary.

Figure 12: Flow Pattern for an HCM Extract

Invoking HCM Extracts


A payroll flow can be invoked from outside Oracle HCM Cloud using the FlowActionsService, which is the
mechanism by which HCM Extracts can be automated.

The method to invoke the HCM extract is FlowActionsService.submitFlow. This method has the following
parameters:

Parameter Name Description

Flow Name The name of the HCM extract

Flow Instance Name The identifier of the particular instance of the extract to be run

Legislative Data Group Name The name of the legislative data group

Recurring Flag Set to false

Parameters Name value pairs of parameters. See example below.

21 | AUTOMATING HCM DATA LOADER


Example

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:typ="http://xmlns.oracle.com/apps/hcm/processFlows/core/flowActionsService/types/"
xmlns:flow="http://xmlns.oracle.com/apps/hcm/processFlows/core/flowControllerService/">
<soapenv:Header/>
<soapenv:Body>
<typ:submitFlow>
<typ:flowName>HDL Data Set Summary</typ:flowName>
<typ:flowInstanceName>HDL_Summary_1</typ:flowInstanceName>
<typ:legislativeDataGroupName>how to make this null not needed for this
extract</typ:legislativeDataGroupName>
<typ:recurringFlag>false</typ:recurringFlag>
<typ:parameterValues>
<flow:ParameterName>Content ID</flow:ParameterName>
<flow:ParameterValue>UCMFA23931</flow:ParameterValue>
<flow:ParameterName>Show Messages</flow:ParameterName>
<flow:ParameterValue>Y</flow:ParameterValue>
<flow:ParameterName>Show StackTrace</flow:ParameterName>
<flow:ParameterValue>N</flow:ParameterValue>
</typ:parameterValues>
</typ:submitFlow>
</soapenv:Body>
</soapenv:Envelope>

Monitoring the Extract


When the HCM extract is invoked, it executes each of the tasks according to the flow task sequence. In this case,
there is only one task to perform. While the task is being performed, its status is maintained by the Payroll Flow
Engine. You can monitor status changes using the FlowActionsService.getFlowTaskInstanceStatus method.

The parameters for this method are as follows:

Parameter Name Description

Flow Instance Name The identifier of the particular instance of the extract to be run

Flow Task Instance Name The name of the specific task to monitor

Legislative Data Group The name of the legislative data group

The status values that could be returned are:

Status Returned Meaning

COMPLETED Complete

ERROR0 Error

ESS_CHILD_JOB_COMPLETED ESS child job completed

ESS_CHILD_JOB_NOT_FOUND ESS child job not found

ESS_CHILD_JOB_SUBMITTED ESS child job has been submitted

22 | AUTOMATING HCM DATA LOADER


ESS_CHILD_JOB_SUB_ERROR ESS child job submission error

ESS_MT_SERV_NOT_FOUND ESS Metadata service not found

ESS_PARENT_JOB_SUBMITTED ESS parent job submitted

ESS_PARENT_JOB_SUB_ERROR ESS parent job submission error

ESS_RT_SERV_NOT_FOUND ESS run time service not found

EXECUTION_STARTED Flow task execution started

FUNCTIONAL_ERROR Flow task functional error

IN_PROGRESS In progress

IN_PROGRESS_IDLE In progress with manual intervention required

MARKED_FOR_RETRY Marked for recalculation

NOT_STARTED Not started

PUBLISHED Published

ROLLEDBACK Rolled back

SCHEDULED Scheduled

SKIPPED Skipped

Example:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:typ="http://xmlns.oracle.com/apps/hcm/processFlows/core/flowActionsService/types/">
<soapenv:Header/>
<soapenv:Body>
<typ:getFlowTaskInstanceStatus>
<typ:flowInstanceName> HDL_Summary_1</typ:flowInstanceName>
<typ:flowTaskInstanceName> HDL Data Set Summary </typ:flowTaskInstanceName>
<typ:legislativeDataGroupName>US Legislative Data Group</typ:legislativeDataGroupName>
</typ:getFlowTaskInstanceStatus>
</soapenv:Body>
</soapenv:Envelope>

Retrieving HCM Extracts XML


Once the HCM extract flow reaches COMPLETED status, the raw XML can be downloaded.

The payrollProcessingActionService.fetchExtractOutput method can be used to download the raw XML. The
parameters for this method are as follows:

Parameter Name Description

Flow Instance Name The identifier of the particular instance of the extract to be run

Flow Task Name The name of the specific task to monitor

Mode Set to FLOW

23 | AUTOMATING HCM DATA LOADER


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:typ="http://xmlns.oracle.com/apps/hcm/processFlows/core/flowActionsService/types/">
<soapenv:Header/>
<soapenv:Body>
<typ:fetchExtractOutput >
<typ:InstanceName>HDL_Summary_1</typ:InstanceName>
<typ:taskName>HDL Data Set Summary</typ:taskName>
<typ:mode>FLOW</typ:mode>
</typ:fetchExtractOutput>
</soapenv:Body>
</soapenv:Envelope>

This service call returns a String result attribute that contains the full XML generated by the extract.

HCM Extract BI Report Output Location


When an HCM extract is associated with a BI template, the payroll flow ensures that the BI report is generated and
written to the BI server.

The payroll action parameter BI_OUTPUT_SIZE determines whether the generated BI report is written as an
attachment to the WebCenter Content server. The action parameter value is the maximum size in bytes of the file.
Files larger than this value cannot be stored on the WebCenter Content server. If the file is stored on the WebCenter
Content server, then it appears in the Payroll Checklist Results UI and can be viewed and downloaded from this
location. Otherwise, a link to the location of the file on the BI server is shown in the Payroll Checklist Results UI.

If the BI_OUTPUT_SIZE action parameter is not present, a default of 10MB is applied. In this case, files of 10MB or
less are stored on the WebCenter Content server and rendered in the Payroll Checklist Results UI. For files that are
larger than 10MB, links are provided to the relevant location on the BI server.

24 | AUTOMATING HCM DATA LOADER


Oracle Corporation, World Headquarters Worldwide Inquiries
500 Oracle Parkway Phone: +1.650.506.7000
Redwood Shores, CA 94065, USA Fax: +1.650.506.7200

CONNECT W ITH US

blogs.oracle.com/oracle Copyright 2014, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only, and the
contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other
warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or
facebook.com/oracle fitness for a particular purpose. We specifically disclaim any liability with respect to this document, and no contractual obligations are
formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any
twitter.com/oracle means, electronic or mechanical, for any purpose, without our prior written permission.

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
oracle.com
Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and
are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are
trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. 1016

Automating HCM Data Loader


October 2016

You might also like