Ajadex Ajadex - 2 months ago 55
C# Question

How can I communicate with the Kronos API?

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.

Thanks

Answer

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.