I have a Kronos entry point http://kronos../wfc/XmlService that I should be able to access however when I open it in the brower the response is:
<Kronos_WFC>
<Response Status="Failure" ErrorCode="1332" Message="WFP-01110 The MIME type of the request is invalid. Type Found: . Valid types: text/xml, application/xml."></Response>
</Kronos_WFC>
What should I do to use the web services?
By the way, I'm using C# to communicate with the server.
You can communicate with the Kronos API using XML POST requests.
The WFC v5.0 Developer's Toolkit Programmer's Guide1 provides a general guide for communicating with the Kronos API in various languages. The first chapter covers the XML API, which is how all API requests will be sent.
A standard XML logon request for Kronos WFC. This must be sent first before any other requests.
<Kronos_WFC version="1.0">
<Request Object="System" Action="Logon" Username="ValidUsername" Password="ValidPassword"/>
</Kronos_WFC>
Response:
<Kronos_WFC version="1.0" TimeStamp="11/15/2017 3:35PM GMT-05:00">
<Response Status="Success" Timeout="1800" PersonKey="123456" Object="System" Username="ValidUsername" Action="Logon" PersonNumber="112233">
</Response>
</Kronos_WFC>
This logoff request will end your active Kronos session.
<Kronos_WFC version="1.0">
<Request Object="System" Action="Logoff"/>
</Kronos_WFC>
This request loads the Pay Period Total for employee 12345
between October 20th 2017 and October 27th 2017.
<Kronos_WFC version="1.0">
<Request Action="Load">
<Timesheet>
<Employee>
<PersonIdentity PersonNumber="12345"/>
</Employee>
<Period>
<TimeFramePeriod PeriodDateSpan="10/20/2017 - 10/27/2017"/>
</Period>
</Timesheet>
</Request>
</Kronos_WFC>
A full list of Kronos API tags can be found in the Workforce Timekeeping Developer Toolkit Reference Guide (requires login).
Your method of sending POST requests may vary depending on your language. However, the XML request format and API entry point (<ServerName>/wfc/XmlService
) should apply to all languages.
Below is an example Python 3 script for sending a Kronos logon request:
import requests
url = "http://localhost/wfc/XmlService"
headers = {'Content-Type': 'text/xml'}
data = """<Kronos_WFC version = "1.0">
<Request Object="System" Action="Logon" Username="SomeUsername" Password="SomePassword"/>
</Kronos_WFC>"""
# Login to Kronos and print response
session = requests.Session() # preserve login cookies across requests
response = session.post(url, data=data, headers=headers)
print(response.text)
Chapter 2 of the WFC Developer's Toolkit Programmer's Guide includes examples for sending XML requests in Java and Visual Basic. However, I recommend looking into a more up-to-date XML or HTTP requests library specific to whatever language you are using.
Footnotes:
1: The quoted documentation was originally written for Kronos WFC 5.0 (API 1.0). While later versions should use the same API, I cannot guarantee accuracy for other versions. (See XML API version 6.3 to 8.0 upgrade)
Also,you need to make sure you have XML API access check in the Function Access Profile in Kronos.
You get that with the brower because the Kronos server only support POST requests and the Browser is issuing a GET Request. The reason for that is because Kronos requires an XML in the body and the POST is the most adecuate method to do so.
The way to access the Kronos XML API, is making a WebRequest to the URL you have with the Method set to POST like this:
HttpWebRequest reqFp = (HttpWebRequest)HttpWebRequest.Create(KronosServerUrl);
reqFp.Method = "POST";
reqFp.ContentType = "text/xml";
Note how the ContentType is also set to text/xml.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With