汉庭酒店智能酒店API接口
实现方式,与第三方厂商合作,本接口负责将汉庭酒店旅客登记入住和离店信息对接到第三方厂商的系统。按汉庭酒店要求,无法在汉庭酒店系统中做接口,只能做定时同步。按旅客登记信息的时间戳来同步更新。
案例截图,软件为C/S方式操作
代码片断,通用的websevice http传输方法
public static string PostMoths(string url, string param, string AuthorizationStr) { string strURL = url; System.Net.HttpWebRequest request; request = (System.Net.HttpWebRequest)WebRequest.Create(strURL); request.Method = "POST"; request.ContentType = "application/json;charset=UTF-8"; request.Headers.Add("Authorization", AuthorizationStr); string paraUrlCoded = param; byte[] payload; payload = System.Text.Encoding.UTF8.GetBytes(paraUrlCoded); request.ContentLength = payload.Length; Stream writer = request.GetRequestStream(); writer.Write(payload, 0, payload.Length); writer.Close(); System.Net.HttpWebResponse response; response = (System.Net.HttpWebResponse)request.GetResponse(); System.IO.Stream s; s = response.GetResponseStream(); string StrDate = ""; string strValue = ""; StreamReader Reader = new StreamReader(s, Encoding.UTF8); while ((StrDate = Reader.ReadLine()) != null) { strValue += StrDate + "\r\n"; } return strValue; }
未经允许不得转载:软件接口开发,api接口开发,webservice接口开发,设备接口,xml数据解析,json数据解析 » 汉庭酒店智能酒店API接口