使用 HCM 資料載入器整合 Web 服務
您可以使用 HCM 資料載入器 SOAP Web 服務來匯入與載入 WebCenter Content 伺服器上暫存的資料檔。您可以從 Oracle Cloud HCM 使用者介面的匯入與載入資料頁面,手動處理這些資料檔。
您必須先安裝 Oracle JDeveloper 11.1.1.9,才能取得從 Oracle Cloud HCM 呼叫 SOAP Web 服務所需的程式庫。
關於 HCM 資料載入器整合服務
您可以使用 Oracle Cloud HCM SOAP Web 服務,透過 SOAP API 上傳檔案。
You can obtain the Data Loader Service web service details from Oracle Fusion Cloud Human Resources in the Developer Connect link, under Tools in the Navigator menu, just like any other SOAP web service.
在 WebCenter Content 伺服器上放置包含 DAT 檔案的 ZIP 檔案之後,您可以呼叫 SOAP Web 服務。之後,您可以使用 hcm/dataloader/import
帳戶來保護帳戶。此 Web 服務可用來在 Oracle Cloud HCM 中匯入與載入資料。
關於呼叫 HCM 資料載入器的 SOAP 信封
HCMDataLoader
SOAP Web 服務提出要求: http://{Host}/hcmCommonDataLoader/HCMDataLoader
關於 importAndLoadData 方法
importAndLoadData
方法會起始處理 WebCenter Content 伺服器上代管的資料檔。這是僅傳回已提交處理之 ProcessId
的非同步工作。
您可以使用此附加訊息呼叫 SOAP Web 服務中的 importAndLoadData
函數。
<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:Envelope>
與附加訊息一起傳送之 importAndLoadData
方法的參數如下:
ContentId :WebCenter Content 伺服器上檔案的內容 ID (與 WebCenter Content Java 呼叫中的 dDocName
參數值相同)。
參數:名稱 - 值組。以下是可用的參數名稱,但並非必要:
-
ImportMaximumErrors
:匯入處理停止前,業務物件所能發生的錯誤檔案行數百分比。 -
LoadMaximumErrors
:驗證與載入處理停止前,業務物件中所能發生的錯誤業務物件實例百分比。 -
LoadConcurrentThreads
:驗證或載入時的並行執行緒數目。 -
LoadGroupSize
:由並行執行緒作為單一工作單元處理的業務物件數。 -
FileEncryption
:檔案加密類型。例如,密碼型加密 (PBE)。 -
DeleteSourceFile
:Y
或N
值。如果設為Y
或保留空白,則在檔案內容轉移至「HCM 資料載入器」暫存表後,從 WebCenter Content 伺服器刪除來源檔案,不再需要。
例如,<ns1:Parameters>
標記可包含下列名稱和值組:<ns1:Parameters>ImportMaximumErrors=100,LoadMaximumErrors=100,LoadConcurrentThreads=4,FileEncryption=PGPSIGNED,DeleteSourceFile=N</ns1:Parameters>
<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/HCMDataLoader/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/"> <result xmlns="http://xmlns.oracle.com/apps/hcm/common/dataLoader/core/dataLoaderIntegrationService/types/">7958</result> </ns0:importAndLoadDataResponse>
</env:Body>
</env:Envelope>
關於 getDataSetStatus
方法
getDataSetStatus
方法會傳回指定資料檔案的目前狀態。
您可以使用此附加訊息呼叫 SOAP Web 服務中的 getDataSetStatus
函數。
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:getDataSetStatus xmlns:ns1="http://xmlns.oracle.com/apps/hcm/common/dataLoader/core/dataLoaderIntegrationService/types/">
<ns1:Parameters></ns1:Parameters>
</ns1:getDataSetStatus>
</soap:Envelope>
與附加訊息一起傳送之 getDataSetStatus
方法的參數如下:
ContentId :WebCenter Content 伺服器上檔案的內容 ID (與 WebCenter Content Java 呼叫中的 dDocName
參數值相同)。
ProcessId :由 importAndLoadData
方法起始和傳回的程序 ID。
產生用以呼叫 HCM DataLoader 的代理主機類別
呼叫 Oracle Cloud HCM SOAP Web 服務的一個選項是使用產生的代理主機類別。
您可以將服務 WSDL 檔案的 URL 提供給所選擇的產生器,以產生代理類別。這些代理類別用於呼叫 Web 服務。
注意:
Oracle Cloud HCM SOAP Web 服務受到 Oracle Web Services Manager (OWSM) 安全原則的保護。關於使用 HCM 資料載入器時的安全影響
當從屬端呼叫 HCM Data Loader SOAP Web 服務時,稍後必須滿足訊息保護原則,以確保有效負載以加密方式或透過 SSL 傳輸層傳輸。
HCMDataLoader
Web 服務使用下列 Oracle Web Services Manager 原則保護:oracle/wss11_saml_or_username_token_with_message_protection_service_policy
。
在從屬端,您可以使用下列 Oracle Web Services Manager 原則:oracle/wss11_username_token_with_message_protection_client_policy
。
若要使用此原則,訊息必須使用伺服器提供的公開金鑰加密。當訊息到達伺服器時,可以用伺服器的私密金鑰將訊息解密。您可以建立 KeyStore
來匯入服務 WSDL 檔案中提供的憑證,但基於安全上的理由,您每次執行程式碼時,都應該提示使用者輸入 Oracle Cloud HCM 密碼。
您可以建立可在程式碼中剖析的特性文字檔,以存取 Keystore
資訊,例如:
FUSION_USERNAME=<Your Oracle Global Human Resources Cloud User Name>
DATAPATH=C:\\My\\Assets\\cloud.asset.hcm.java-dataload-example\\data\\
HCM_DATA_LOADER_SERVICE_WSDL_LOCATION=https://<<FusionURL>/hcmCommonDataLoader/HCMDataLoader?wsdl
UCM_IDC_WEBSERVICE_LOCATION=https://<FusionURL>/idcws/GenericSoapPort
KEYSTORE_LOCATION=<Your Keystore trust location>
KEYSTORE_PASSWORD=<YourTrustPassword>
KEYSTORE_ALIAS=orakey
GETDATASETSTATUS_DELAY=5
OK=OK
ERROR=Error
WARNING=Warning
CSV_FILE_ENCODING=UTF-8
DATA_SEPERATOR=;
使用下列項目提示使用者輸入其 Oracle Cloud HCM 證明資料:
// Accept password from user
Scanner scanReader = new Scanner(System.in); // Reading from System.in
System.out.println("Enter password for user "+propertiesFile.getProperty("FUSION_USERNAME")+" :");
fusionUserPass= scanReader.next(); // Scans the next token of the input as an int.
scanReader.close();
在範例中,fusionUserPass
是一個變數,可用來儲存使用者的 Oracle Cloud HCM 密碼,然後傳送至 HCM Data Loader SOAP Web 服務。
呼叫 HCM DataLoader SOAP Web 服務
您可以使用 Java 類別的 HCM Data Loader SOAP Web 服務,將資料從 ZIP 檔案載入 Oracle Cloud HCM 。
請先建立 ZIP 檔案,並將其以手動或程式設計方式上傳至 WebCenter Content 伺服器。然後,您可以使用 importAndLoadData
Web 服務來載入資料。
注意:
本解決方案提供的程式碼範例已使用 JDK 版本 8 在 Oracle WebLogic Server 12c 上呼叫 Web 服務進行測試。若要與其他 JDK 和 Oracle WebLogic Server 版本搭配使用,請以所需版本特有的程式庫來測試程式碼。