2017-06-01 27 views
1

APIを使用してWorkdayのカスタム従業員データを編集したいが、ドキュメントに実際のカスタムデータ形式が指定されていない。また、私は追加のワーカーデータを取得する方法を見つけることができませんでした。 Googleは、このAPI(Edit_Worker_Additional_Data関数)の使用例を見つけません。Workday APIを使用して作業者の追加データを編集する

答えて

2

これは、すべてのオプションパラメータを含むSOAPリクエストの様子です。

<?xml version="1.0" encoding="UTF-8"?> 
<env:Envelope 
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <env:Body> 
     <wd:Edit_Worker_Additional_Data_Request 
      xmlns:wd="urn:com.workday/bsvc" 
      wd:version="v28.0"> 
      <wd:Business_Process_Parameters> 
       <wd:Auto_Complete>true</wd:Auto_Complete> 
       <wd:Run_Now>true</wd:Run_Now> 
       <wd:Comment_Data> 
        <wd:Comment>abcdef</wd:Comment> 
        <wd:Worker_Reference> 
         <wd:ID wd:type="Contingent_Worker_ID">abcdef</wd:ID> 
        </wd:Worker_Reference> 
       </wd:Comment_Data> 
      </wd:Business_Process_Parameters> 

      <wd:Worker_Custom_Object_Data> 
       <wd:Effective_Date>2017-07-20</wd:Effective_Date> 
       <wd:Worker_Reference> 
        <wd:ID wd:type="Contingent_Worker_ID">abcdef</wd:ID> 
       </wd:Worker_Reference> 
       <wd:Business_Object_Additional_Data></wd:Business_Object_Additional_Data> 
      </wd:Worker_Custom_Object_Data> 
     </wd:Edit_Worker_Additional_Data_Request> 
    </env:Body> 
</env:Envelope> 

カスタムオブジェクトは、例えば、「TestObject」として定義されている場合

<wd:Business_Object_Additional_Data></wd:Business_Object_Additional_Data> 

内のカスタムオブジェクト(または追加データ)の要素を定義する必要があり、あなたは、オブジェクトやフィールドリファレンスの両方が必要になりますIDは次のようになります。

<wd:Business_Object_Additional_Data> 
      <cus:TestObject> 
       <cus:TestObjectField>Value</cus:TestObjectField> 
      </cus:TestObject> 
</wd:Business_Object_Additional_Data> 
2

Javaを使用している場合、ワーカーデータを更新するWorkday APIの使用例を次に示します。 これはEdit_Worker_Additional_Dataではありませんが、すべて同じように動作します。とこのコードスニペットが役立ちます。ここのすべてのJavaクラスは、WorkdayCredentialsクラスを除いて、jaxws-maven-pluginを使用してwsdlから生成されます(Workday Soap API - User Name/Passwordを参照)。

public void updateWorkerContactInfo(Worker worker) throws WorkerDataException, 
      WorkerDataInvalidException { 
     HumanResourcesPort hrPort = hrService.getHumanResources(); 

     BindingProvider bp = (BindingProvider) hrPort; 

     WorkdayCredentials.addWorkdayCredentials(bp, 
       config.getWdIntegrationUsername(), 
       config.getWdIntegrationPassword()); 

     MaintainContactInformationForPersonEventRequestType body 
      = new MaintainContactInformationForPersonEventRequestType(); 

     body.setAddOnly(false); 

     BusinessProcessParametersType params = new BusinessProcessParametersType(); 
     params.setAutoComplete(false); 
     params.setRunNow(false); 

     body.setBusinessProcessParameters(params); 

     ContactInformationForPersonEventDataType contactData 
      = new ContactInformationForPersonEventDataType(); 

     edu.bowdoin.workdayservice.data.hr.WorkerObjectType workerObjectType 
      = new edu.bowdoin.workdayservice.data.hr.WorkerObjectType(); 

     edu.bowdoin.workdayservice.data.hr.WorkerObjectIDType idType 
      = new edu.bowdoin.workdayservice.data.hr.WorkerObjectIDType(); 

     idType.setType("Employee_ID"); 
     idType.setValue(worker.getWorkerId()); 

     workerObjectType.getID().add(idType); 

     contactData.setWorkerReference(workerObjectType); 

     Date effectiveDate = new Date(); 

     // set the effective date to the hire date + 1 day, this has to be 
     // greater than any other change to the worker address data, for 
     // example during the new hire process 
     if (worker.getHireDate() != null) { 

      DateTime hireDate = new DateTime(worker.getHireDate()); 
      DateTime hireDatePlus1Day = hireDate.plusDays(1); 
      DateTime today = DateTime.now(); 

      // only use hire date plus 1 if it is after today's date 
      if (hireDatePlus1Day.isAfter(today)) { 
       effectiveDate = hireDatePlus1Day.toDate(); 
      } 
     } 

     contactData.setEffectiveDate(dateToXMLGregorian(effectiveDate)); 

     ContactInformationDataType contactDataType 
      = new ContactInformationDataType(); 

     EmailAddressInformationDataType emailAddressDataType 
      = new EmailAddressInformationDataType(); 

     emailAddressDataType.setEmailAddress(worker.getPrimaryWorkEmail()); 

     CommunicationMethodUsageInformationDataType usageDataType 
      = new CommunicationMethodUsageInformationDataType(); 
     usageDataType.setPublic(true); 

     CommunicationUsageTypeDataType usageTypeData 
      = new CommunicationUsageTypeDataType(); 
     usageTypeData.setPrimary(true); 

     CommunicationUsageTypeObjectType usageTypeObjectType 
      = new CommunicationUsageTypeObjectType(); 

     CommunicationUsageTypeObjectIDType usageTypeObjectID 
      = new CommunicationUsageTypeObjectIDType(); 
     usageTypeObjectID.setType("Communication_Usage_Type_ID"); 
     usageTypeObjectID.setValue("WORK"); 

     usageTypeObjectType.getID().add(usageTypeObjectID); 

     usageTypeData.setTypeReference(usageTypeObjectType); 

     usageDataType.getTypeData().add(usageTypeData); 

     emailAddressDataType.getUsageData().add(usageDataType); 

     contactDataType.getEmailAddressData().add(emailAddressDataType); 
     contactData.setWorkerContactInformationData(contactDataType); 

     body.setMaintainContactInformationData(contactData); 

     try { 
      hrPort.maintainContactInformation(body); 
     } catch (edu.bowdoin.workdayservice.data.hr.ProcessingFaultMsg e) { 
      throw new WorkerDataException(e.getMessage(), e); 
     } catch (edu.bowdoin.workdayservice.data.hr.ValidationFaultMsg e) { 
      throw new WorkerDataInvalidException(e.getMessage(), e); 
     } finally { 

     } 
    } 
関連する問題