我想在Workday中使用他们的API编辑自定义员工数据,但实际的自定义数据格式未在文档中指定。另外,我无法找到检索其他工作人员数据的方法。谷歌没有找到任何使用他们的API的例子(Edit_Worker_Additional_Data函数)。使用Workday API编辑工作人员额外数据
1
A
回答
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>
你必须定义内
<wd:Business_Object_Additional_Data></wd:Business_Object_Additional_Data>
自定义对象(或其他数据)的元素。如果您的自定义对象定义为“的TestObject”例如,你需要两个对象和字段参考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类都是使用jaxws-maven-plugin从wsdl生成的,WorkdayCredentials类除外,请参阅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 {
}
}
相关问题
- 1. 使用长外部API响应设置Django WSGI工作人员
- 2. Chrome开发人员工具css编辑
- 3. 使用MediaCodec API编辑MP4元数据
- 4. 画布API和Web工作人员
- 5. 使用curl服务工作人员数据
- 6. 使uWSGI使用所有工作人员
- 7. JQuery的$。员额不工作
- 8. 编辑推荐人数据
- 9. 为什么用$就和$。员额该API调用不工作
- 10. 的jQuery。员额不工作
- 11. Youtube API使用不相关的工作人员?
- 12. asp.net mvc编辑会员用户数据
- 13. datagridview中的额外列的后台工作人员和进度栏实现?
- 14. ForkJoinFramework只使用两名工作人员
- 15. Octobercms - 带按钮的额外列(编辑,...)
- 16. 在Javascript中的Web工作人员,线程数量和工作人员?
- 17. MySQL查询 - 编辑额外的字段
- 18. 分布式工作人员的Dask工作人员资源
- 19. 服务人员响应从其他工作人员获取数据后提取
- 20. ÇWIN32 API:更新编辑框完成编辑工作
- 21. 保存额外的联系人数据的数据存储
- 22. 灰烬,数据工作使用JSON-API
- 23. 将工作分配给工作人员
- 24. 如何编辑IE8开发人员工具中的IFrame?
- 25. C#,后台工作人员
- 26. 减慢Laravel工作人员
- 27. 斯卡拉演员和工作人员
- 28. C#后台工作人员
- 29. C# - 后台工作人员?
- 30. ExternalQuestion工作人员限制