最近经常有客户发消息问星空登录接口如何编写,这里总结了下:
K3Cloud WebAPI 接口
框架由三个组装件组成:
1. Kingdee.BOS.WebApi.FormService.dll
此组装件包含WebAPI主要接口的功能实现。部署在应用层服务器。
2. Kingdee.BOS.WebApi.ServicesStub.dll
此组装件主要包含WebAPI接口定义,扩展接口定义以及登陆验证接口。部署在应用层服务器。
3. Kingdee.BOS.WebApi.Client.dll
此组装件为WebAPI的客户端组件,封装了一些在异构系统客户端访问WebAPI的方法,适用于C#程序调用。由于它应用于异构系统客户端,所以此组装件需要拷贝到异构系统客户端环境中。非C#程序调用可以不用拷贝
服务地址:
http://ServerIp/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc
案例:ApiClient client = new ApiClient("http://192.168.66.60/k3cloud/");
string dbId = "5756960b27b1aa"; //AotuTest117
bool bLogin = client.Login(dbId, "demo", "888888", 2052);
if (bLogin)
{
//todo:登陆成功处理业务
}
参数设置:
HttpClient httpClient = new HttpClient();
httpClient.Url = "http://192.168.66.60/k3cloud/Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc";
List<object> Parameters = new List<object>();
Parameters.Add("558cbb01bfc79b");//帐套Id
Parameters.Add("Administrator");//用户名
Parameters.Add("888888");//密码
Parameters.Add(2052);
httpClient.Content = JsonConvert.SerializeObject(Parameters);
var iResult = JObject.Parse(httpClient.AsyncRequest())["LoginResultType"].Value<int>();
if (iResult == 1){
//todo:验证成功,处理业务
}