i'm using Zeep to interact with Workday's SOAP API to edit a someone's Workday username. Here is the following request body to the Human Resources WSDL, v37.2
request_dict = {
"Workday_Account_for_Worker_Update": {
"Worker_Reference": {
"Employee_Reference": {
"Integration_ID_Reference": {
"ID": {
"type": "WD-EMPLID",
"_value_1": user_id
}
}
}
},
"Workday_Account_for_Worker_Data": {
"User_Name": username
}
}
}
response = client.service.Update_Workday_Account(request_dict)
The error message i receive is
zeep.exceptions.ValidationError: Missing element Workday_Account_for_Worker_Data (Workday_Account_for_Worker_Update.Workday_Account_for_Worker_Data)
, but the element is clearly there. Anyone have any idea what I'm doing wrong?
You are not using the correct method signature to perform the call.
If you do a:
python -mzeep https://community.workday.com/sites/default/files/file-hosting/productionapi/Human_Resources/v37.2/Human_Resources.wsdl > output.txt
and you look inside the produced output.txt
file, you will see that Update_Workday_Account
has this signature:
Update_Workday_Account(
Worker_Reference: ns0:Worker_ReferenceType,
Non_Worker_Reference: ns0:RoleObjectType,
Workday_Account_for_Worker_Data: ns0:Workday_Account_for_Worker_DataType,
version: xsd:string,
_soapheaders={header: ns0:Workday_Common_HeaderType}
) -> None
so your code should probably be something like this:
worker_reference = {
"Employee_Reference": {
"Integration_ID_Reference": {
"ID": {
"type": "WD-EMPLID",
"_value_1": user_id
}
}
}
}
workday_account_for_worker_data = {
"User_Name": username
}
client.service.Update_Workday_Account(worker_reference, None, workday_account_for_worker_data)
I can't really test the call from my side so you should substitute appropriate parameters on your side before making the request.