如何与Kronos API通信? [英] How can I communicate with the Kronos API?

查看:56
本文介绍了如何与Kronos API通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Kronos 入口点

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>

我应该怎么使用Web服务?

What should I do to use the web services?

顺便说一句,我正在使用C#与服务器通信.

By the way, I'm using C# to communicate with the server.

推荐答案

您可以通过浏览器实现这一点,因为Kronos服务器仅支持POST请求,并且浏览器正在发出GET请求.这样做的原因是因为Kronos的主体中需要XML,而POST是最简单的方法.

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.

访问Kronos XML API的方法是制作将WebRequest 更改为您将URL设置为POST的网址,如下所示:

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";

请注意如何将ContentType也设置为text/xml.

Note how the ContentType is also set to text/xml.

这篇关于如何与Kronos API通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆