Use Workday API to update employee's phone extension

256 views Asked by At

I need to update a user's phone extension in Workday when another service issues the extension to a user.

I have what I think is a valid URL for our "test" environment as well as a valid user in that environment.

I'm getting a 500 error on my Postman POST call against the URL and need help to either get the XML right or to understand what I have to ask for being done in Workday to properly "enable" the endpoint or the user I'm authenticating with.

Here is the XML I came up with that currently results in a 500 error back from Workday.

<?xml version="1.0" encoding="UTF-8"?>
            <soapenv:Envelope> 
               xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
               xmlns:bsvc="urn:com.workday/bsvc"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
               <!-- xmlns:cus="urn:com.workday/tenants/super/data/custom"> -->
               <soapenv:Header>
                  <wsse:Security soapenv:mustUnderstand="1">
                     <wsse:UsernameToken>
                        <wsse:Username>ISU_Get_Worker_Photo@mycompany_preview</wsse:Username>
                        <wsse:Password
                           Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PasswordTextxx</wsse:Password>
                     </wsse:UsernameToken>
                  </wsse:Security>
               </soapenv:Header>
               <soapenv:Body>
                  <bsvc:Change_Work_Contact_Information_Request bsvc:version="v40.0">
                     <bsvc:Business_Process_Parameters>
                        <bsvc:Auto_Complete>true</bsvc:Auto_Complete>
                        <bsvc:Run_Now>true</bsvc:Run_Now>
                     </bsvc:Business_Process_Parameters>
                     <bsvc:Change_Work_Contact_Information_Data>
                        <bsvc:Event_Effective_Date>2023-10-20</bsvc:Event_Effective_Date>  
                        <bsvc:Person_Reference>
                           <bsvc:ID bsvc:type="Employee_ID">5534</bsvc:ID>
                        </bsvc:Person_Reference>
                        <bsvc:Person_Contact_Information_Data>
                            <bsvc:Person_Phone_Information_Data bsvc:Replace_All="false">
                                <bsvc:Phone_Information_Data bsvc:Delete="false">
                                    <bsvc:Phone_Data bsvc:Formatted_Phone="1 866-282-5797">
                                        <!-- <bsvc:Complete_Phone_Number>"1 866-222-5555"</bsvc:Complete_Phone_Number> -->
                                        <bsvc:Extension>5555</bsvc:Extension>
                                    </bsvc:Phone_Data>
                                </bsvc:Phone_Information_Data>
                            </bsvc:Person_Phone_Information_Data>
                        </bsvc:Person_Contact_Information_Data>
                     </bsvc:Change_Work_Contact_Information_Data>
                  </bsvc:Change_Work_Contact_Information_Request>
               </soapenv:Body>
            </soapenv:Envelope>

Any advice on the XML itself or what needs to be done in Workday to make this work would be appreciated.

Here is the URL (private info redacted)

https://wd5-impl-services1.workday.com/ccx/service/mycompany_preview/Human_Resources/v40.0

Finally - when using the Photo API endpoint I ran into a difference between "Contingent Worker" and "Employee" in the XML... Will I have the same consideration on this endpoint? I.E. if it's a "contingent worker" I will have to use that tag instead of type="Employee_ID"?

<bsvc:ID bsvc:type="Employee_ID">5534</bsvc:ID>
1

There are 1 answers

10
Angela Hall On

Your XML looks correct, except it's missing the UsernameToken which I assume you took out for privacy. I would expect the server to return something, so the fact that you're getting a 500 error makes me wonder if its even getting through the authentication process, let alone the business process.

There are a couple things to check - You want to verify that you have the correct endpoint address by going to Public Web Services / Web Service / View WSDL. In the WSDL scroll until you find "soapbind:address location" and verify that the endpoint listed is the one you're hitting.

Next you might want to try to absolute simplest request, by removing all the optional parameters. This usually just looks like a header with 0 or 1 parameters in the body. This will let you test your authentication and headers without the overhead of wondering if all your params are correct for the business process.

If you've verified these and still get a 500 error, then dollars to donuts you have permission issue. You want to make sure that the user account you are authenticating with is in a security group that has permission to view and change worker data, permission to execute "Work Contact Change" business process, and permission to access the web service. (And don't forget to apply your security policy changes, that gets me every time.)

Something that might be useful is to check login attempts for your tennant. If see your web service user account there with failed logins then you have a smoking gun.

EDIT: based on the wsdl it looks like this is minimum your body can be

      <soapenv:Body>
      <bsvc:Change_Work_Contact_Information_Request bsvc:version="v40.0">
         <bsvc:Change_Work_Contact_Information_Data>
            <!--Optional:-->
            <bsvc:Person_Reference bsvc:Descriptor="?">
               <!--Zero or more repetitions:-->
               <bsvc:ID bsvc:type="Employee_ID">5534</bsvc:ID>
            </bsvc:Person_Reference>
            
            <bsvc:Person_Contact_Information_Data>
            
            </bsvc:Person_Contact_Information_Data>
         </bsvc:Change_Work_Contact_Information_Data>
      </bsvc:Change_Work_Contact_Information_Request>
   </soapenv:Body>

It looks like person reference is also optional. But I'm guessing if you don't include it you'll get back a sea of data

Second edit - instructions for SoapUI SoapUI runs on all platforms, is free, and even has a portable version. It is great because it crafts the XML for you based on the WSDL. All you have to do is remove what you don't want and fill in the variables. This is a great way to verify your XML is correct. https://www.soapui.org/downloads/soapui/

First get your WSDL from Workday for your specific tenant (Web Services / Web Service / View WSDL). In SoapUI click on SOAP. In the New Project Window assign it a project name, and enter your WSDL. SoapUI will auto-populate with all of the functions avaialable for that endpoint, and under each it will auto-generate a request based on the specification.

Auth: Next click on "auth" (bottom left corner of the request) and choose "Basic". Put in your username@tenant password, and the domain is just your tenant. Then under "Request Properties" (left side of screen) change WSS-Password Type to "PasswordText".

Now in the request fill in the version number and delete everything that is optional, and click on the green play button. Your server response will appear in the box on the right.

SoapUI creates the header tag for you, and adds the authentication and Nonce which you can see in the "Raw" tab on the left side of the window. You can just copy and paste the raw xml directly into whatever application you're building.