HCM 데이터 로더 통합 웹 서비스 사용

HCM 데이터 로더 SOAP 웹 서비스를 사용하여 WebCenter Content 서버에 스테이지된 데이터 파일을 임포트 및 로드할 수 있습니다. Oracle Cloud HCM 사용자 인터페이스의 데이터 임포트 및 로드 페이지에서 해당 데이터 파일을 수동으로 처리할 수 있습니다.

Oracle Cloud HCM에서 SOAP 웹 서비스를 호출하는 데 필요한 라이브러리를 가져오려면 먼저 Oracle JDeveloper 11.1.1.9를 설치해야 합니다.

HCM 데이터 로더 통합 서비스 정보

Oracle Cloud HCM SOAP 웹 서비스를 사용하여 SOAP API를 사용하여 파일을 업로드할 수 있습니다.

다른 SOAP 웹 서비스와 마찬가지로 네비게이터 메뉴의 도구 아래에 있는 개발자 연결 링크의 Oracle Fusion Cloud Human Resources에서 데이터 로더 서비스 웹 서비스 세부정보를 얻을 수 있습니다.

DAT 파일이 포함된 ZIP 파일을 WebCenter Content 서버에 배치한 후 SOAP 웹 서비스를 호출할 수 있습니다. 그런 다음 hcm/dataloader/import 계정으로 보안을 설정할 수 있습니다. 이 웹 서비스는 Oracle Cloud HCM에서 데이터를 임포트 및 로드하는 데 사용할 수 있습니다.

HCM 데이터 로더 호출을 위한 SOAP Envelop 정보

HCM 데이터 로더 SOAP 웹 서비스를 호출하면 요청 및 응답 봉투가 전송되고 수신됩니다.
다음 봉투를 사용하여 HCMDataLoader SOAP 웹 서비스에 대한 요청을 생성할 수 있습니다.
http://{Host}/hcmCommonDataLoader/HCMDataLoader

importAndLoadData 메소드 정보

importAndLoadData 메소드는 WebCenter Content 서버에 호스트된 데이터 파일의 처리를 시작합니다. 제출된 프로세스의 ProcessId만 반환하는 비동기 작업입니다.

이 Envelope를 사용하여 SOAP 웹 서비스에서 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>

Envelope와 함께 전송되는 importAndLoadData 메소드의 매개변수는 다음과 같습니다.

ContentId: WebCenter Content 서버에 있는 파일의 콘텐츠 ID입니다(WebCenter Content Java 호출에서 dDocName 매개변수와 동일한 값).

매개변수: 이름-값 쌍입니다. 다음 매개변수 이름은 사용할 수 있지만 필수는 아닙니다.

  • ImportMaximumErrors: 임포트 프로세스가 중지되기 전에 비즈니스 객체에 대해 발생할 수 있는 오류 내 파일 라인의 퍼센트입니다.

  • LoadMaximumErrors: 검증 및 로드 프로세스가 중지되기 전에 비즈니스 객체에 나타날 수 있는 오류 내 비즈니스 객체의 백분율입니다.

  • LoadConcurrentThreads: 검증 또는 로드 시 동시 스레드의 수입니다.

  • LoadGroupSize: 동시 스레드에 의해 단일 작업 단위로 처리되는 비즈니스 객체입니다.

  • FileEncryption: 파일 암호화의 유형입니다. 예를 들어, PBE(암호 기반 암호화)입니다.

  • DeleteSourceFile: Y 또는 N 값입니다. Y로 설정되거나 비워 둘 경우 파일 콘텐츠가 HCM 데이터 로더 단계 테이블로 이전되고 더 이상 필요하지 않은 후 WebCenter 콘텐츠 서버에서 출처 파일을 삭제합니다.

예를 들어, <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 메소드는 지정된 데이터 파일의 현재 상태를 반환합니다.

이 Envelope를 사용하여 SOAP 웹 서비스에서 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>

Envelope와 함께 전송되는 getDataSetStatus 메소드의 매개변수는 다음과 같습니다.

ContentId: WebCenter Content 서버에 있는 파일의 콘텐츠 ID입니다(WebCenter Content Java 호출에서 dDocName 매개변수와 동일한 값).

ProcessId: importAndLoadData 메소드에서 시작 및 반환된 프로세스의 ID입니다.

HCM DataLoader 호출을 위한 프록시 클래스 생성

Oracle Cloud HCM SOAP 웹 서비스를 호출하기 위한 한 가지 옵션은 생성된 프록시 클래스를 사용하는 것입니다.

선택한 생성기에 서비스 WSDL 파일의 URL을 제공하여 프록시 클래스를 생성할 수 있습니다. 이러한 프록시 클래스는 웹 서비스를 호출하는 데 사용됩니다.

참고:

Oracle Cloud HCM SOAP 웹 서비스는 OWSM(Oracle Web Services Manager) 보안 정책으로 보호됩니다.
  1. Oracle Cloud HCM에 사인인합니다.
  2. Navigator 메뉴에서 Tools 머리글을 찾은 다음 Developer Connect를 누릅니다.
  3. 찾기 검색 상자에 데이터 로더를 입력한 다음 검색 아이콘을 누릅니다.
  4. 데이터 로더 서비스를 누릅니다. 서비스의 요약 페이지가 표시됩니다.
    [요약] 페이지에는 SOAP 웹 서비스와 관련된 정보(예: WSDL 파일 위치)가 표시됩니다.
  5. 명령 프롬프트를 열고 $JAVA_HOME/bin에서 제공되는 wsimport 명령을 실행합니다.
    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>

    명령에서 첫번째 매개변수는 생성된 파일을 배치해야 하는 폴더입니다. 두번째 파라미터는 생성된 파일을 배치해야 하는 폴더이기도 합니다. 세번째 매개변수는 HCM 데이터 로더 WSDL URL입니다. 예:

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

    생성된 파일은 다음 두 폴더에 배치됩니다.

    • com

    • sdo

  6. 생성된 코드를 JAR 파일에 추가합니다.
    zip loaderIntegrationProxy.jar -r * -

HCM 데이터 로더 사용 시의 보안 영향 정보

클라이언트가 HCM 데이터 로더 SOAP 웹 서비스를 호출할 때 나중에 메시지 보호 정책을 만족하여 페이로드가 암호화된 방식으로 전송되거나 SSL 전송 계층을 통해 전송되도록 해야 합니다.

HCMDataLoader 웹 서비스는 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 데이터 로더 SOAP 웹 서비스로 전달할 수 있는 변수입니다.

HCM DataLoader SOAP 웹 서비스 호출

Java 클래스에서 HCM 데이터 로더 SOAP 웹 서비스를 사용하여 ZIP 파일에서 Oracle Cloud HCM으로 데이터를 로드할 수 있습니다.

먼저 ZIP 파일을 만들어 수동으로 또는 프로그래밍 방식으로 WebCenter Content 서버에 업로드합니다. 그런 다음 importAndLoadData 웹 서비스를 사용하여 데이터를 로드할 수 있습니다.

참고:

이 솔루션에 제공된 코드 샘플은 Oracle WebLogic Server 12c에서 웹 서비스를 호출하기 위해 JDK 버전 8과 함께 테스트되었습니다. 다른 JDK 및 Oracle WebLogic Server 버전과 함께 사용하려면 원하는 버전과 관련된 라이브러리로 코드를 테스트합니다.

  1. /com/oracle/xmlns/apps/hcm/common/dataloader/core/dataloaderintegrationservice/ 폴더에 클라이언트 클래스를 생성합니다.
    클래스를 생성하려면 다음 JAR 파일이 있어야 합니다.
    • WebLogic Server 11g의 경우: ws.api_1.1.0.0.jar
    • WebLogic Server 12c의 경우: wls-api.jar

    이 JAR 파일은 JDeveloper 설치 폴더의 다음 위치에서 사용할 수 있습니다.

    • WebLogic Server 11g의 경우: $MIDDLEWARE_HOME/modules
    • WebLogic Server 12c의 경우: $MIDDLEWARE_HOME/wlserver/server/lib
  2. Java 코드에서 다음 Java 라이브러리를 가져와야 합니다.
    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 javax.xml.ws.BindingProvider;
    import weblogic.wsee.jws.jaxws.owsm.SecurityPolicyFeature;
    
  3. HCMDataLoader 객체를 반환하는 함수를 생성하고 url, username, passwordkeystore를 파라미터로 받습니다. 예:
    public static HCMDataLoader getHCMDataLoaderService(String url, String username, String password, String keystore)
    			throws MalformedURLException {
    		//The code in the next steps is placed within the function body
    }
  4. 함수 본문 내에서 SOAP 웹 서비스 객체를 생성합니다.
    HCMDataLoader_Service webService = new HCMDataLoader_Service(new URL("/hcmCommonDataLoader/HCMDataLoader?wsdl));
    
    SecurityPolicyFeature[] securityFeatures = new SecurityPolicyFeature[] { 
    				new SecurityPolicyFeature("oracle/wss_username_token_over_ssl_client_policy") 
    }; 
    
    HCMDataLoader hcmDataLoader = webService.getHCMDataLoaderSoapHttpPort(securityFeatures);
    
  5. BindingProvider 객체를 생성하고 컨텍스트 매개변수를 설정합니다.
    BindingProvider wsbp = (BindingProvider) hcmDataLoader;
    Map<String, Object> requestContext = wsbp.getRequestContext();
    requestContext.put(BindingProvider.USERNAME_PROPERTY, username);
    requestContext.put(BindingProvider.PASSWORD_PROPERTY, password);
    return hcmDataLoader;
  6. importAndLoadData 함수를 사용하여 Oracle Cloud HCM으로 데이터를 로드합니다.
    HCMDataLoader hcmDataLoaderService = HCMDataLoaderUtil.getHCMDataLoaderService(url, username, password,
    		keystore);
    
    String parameters = ""; // args[1];
    
    try {
    	String response = hcmDataLoaderService.importAndLoadData(contentId, parameters);
    
    	return response;
    } catch (ServiceException e) {
    	logger.severe("Error occurred during importAndLoad call  ..." + e.getLocalizedMessage());
    	throw e;
    }
  7. 업로드한 데이터 파일에서 상태를 가져오는 다른 함수를 생성할 수 있습니다.
    public static String invokeGetDataSetStatus(String url, String username, String password, String keystore,
    			Long processId, String getDataSetStatusDelay)
    			throws ServiceException, ParserConfigurationException, SAXException, IOException, InterruptedException {
    				//The code in the next steps is placed within this function body
    }
  8. getDataSetStatus 함수를 사용하여 상태 응답을 검색합니다.
    HCMDataLoader hcmLoaderService = getHCMDataLoaderService(url, username, password, keystore);
    String response = hcmLoaderService.getDataSetStatus("ProcessId=" + processId);
    String loadStatus = getLoadStatusFromResponse(response); // To save the status from the response to a String variable

    getDataSetStatus는 로드 및 임포트 프로세스에 대한 세부정보가 포함된 XML 객체를 반환합니다.

  9. getDataSetStatus 호출에서 XML 응답을 구문 분석하는 또 다른 함수를 생성합니다.
    public static String getLoadStatusFromResponse(String xmlResult)
    			throws ParserConfigurationException, SAXException, IOException {
    		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    		DocumentBuilder builder = factory.newDocumentBuilder();
    		Document document = builder.parse(new InputSource(new StringReader(xmlResult)));
    		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());
    									return status;
    								}
    							}
    						}
    					}
    				}
    			}
    		}
    		return "ERROR";
    	}
    
  10. Java 코드가 완료되면 javac 명령을 사용하여 컴파일합니다.
    • WebLogic Server 11g의 경우:
      javac -classpath path of the folder where with generated JAX-WS files;location of ws.api_1.1.0.0.jar HCMDataLoaderServiceSoapHttpPortClient.java
    • WebLogic Server 12c의 경우:
      javac -classpath path of the folder where with generated JAX-WS files;location of wls-api.jar HCMDataLoaderServiceSoapHttpPortClient.java
  11. HCMDataLoaderServiceSoapHttpPortClient 클래스를 실행하여 java 명령을 사용하여 HCM 데이터 로더 통합 서비스를 호출합니다.
    • WebLogic Server 11g의 경우:
      java -classpath path of the folder where with generated JAX-WS files;location of weblogic.jar;location of jrf.jar com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice.HCMDataLoaderServiceSoapHttpPortClient ContentId Parameters
    • WebLogic Server 12c의 경우:
      java -classpath path of the folder where with generated JAX-WS files;location of wlthint3client.jar;location of wls-api.jar com.oracle.xmlns.apps.hcm.common.dataloader.core.dataloaderintegrationservice.HCMDataLoaderServiceSoapHttpPortClient ContentId Parameters