最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Workday returns 406 error (Server.governedError) - Stack Overflow

programmeradmin1浏览0评论

I am having trouble getting some data from Workday, specifically from financial management & Get_Journals operation using this API (though I don't think problem is specific to this operation)

When I query Workday using the above mentioned Get_Journals operation, I am getting 406 HTTP response with Server.governedError as a fault code and no fault string.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="/">
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault xmlns:wd="urn:com.workday/bsvc">
         <faultcode>SOAP-ENV:Server.governedError</faultcode>
         <faultstring></faultstring>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This happens only for a specific combination of dates and company codes (Organization_Reference_ID). Moreover, this happens only for a specific response page. This has been observed across multiple clients.

example: I request data for company ABC, date 2024-01-01 and I specify count to be 1 (one object per page), there will be 10 pages. I can send 10 requests asking for each page individually. 9 of these requests return data as expected but one of them fails with the above mentioned error (let's say page 1 and 3-10 return data and page 2 returns error).

According to some online resources, this may be caused by the size of the response being too big. I can't confirm this claim since I don't have other access to the data but I have noticed that when I request data for some other company codes, distribution of the data across response pages can be highly uneven. ex: each individual page is up to 2MB except for a single page that is more than 1GB.

General suggestion is to filter the data based on the accounting date (Accounting_From_Date & Accounting_to_Date), and based on the Organization_Reference_ID, which I am already doing here - single day & single company code.

Here is the actual request.

request_text = '''
<?xml version=\'1.0\' encoding=\'utf-8\'?>\n<soap-env:Envelope xmlns:soap-env="/">
    <soap-env:Header>
        <wsse:Security xmlns:wsse=".0.xsd">
            <wsse:UsernameToken>
                <wsse:Username>abc</wsse:Username>
                <wsse:Password Type=".0#PasswordText">abc</wsse:Password>
            </wsse:UsernameToken>
        </wsse:Security>
    </soap-env:Header>
    <soap-env:Body>
        <ns0:Get_Journals_Request xmlns:ns0="urn:com.workday/bsvc">
            <ns0:Request_Criteria>
                <ns0:Organization_Reference>
                    <ns0:ID ns0:type="Organization_Reference_ID">ABC</ns0:ID>
                </ns0:Organization_Reference>
                <ns0:Accounting_From_Date>2024-01-01</ns0:Accounting_From_Date>
                <ns0:Accounting_To_Date>2024-01-01</ns0:Accounting_To_Date>
            </ns0:Request_Criteria>
            <ns0:Response_Filter>
                <ns0:As_Of_Entry_DateTime>2024-11-12T15:40:37.690367</ns0:As_Of_Entry_DateTime>
                <ns0:Page>22</ns0:Page>
                <ns0:Count>1</ns0:Count>
            </ns0:Response_Filter>
            <ns0:Response_Group>
                <ns0:Include_Attachment_Data>false</ns0:Include_Attachment_Data>
            </ns0:Response_Group>
        </ns0:Get_Journals_Request>
    </soap-env:Body></soap-env:Envelope>
'''

headers = {"Accept": "*/*"}
host = "/..."
request_bytes = request_text.encode("utf-8")
response = requests.post(
    host,
    data=request_bytes,
    headers=headers
)

Is there anything I can try to get either the data or at least some reasonable error message indicating what the actual problem is?

发布评论

评论列表(0)

  1. 暂无评论