如何在saber SOAP API中使用c#创建会话资源

时间:2016-07-20 14:29:11

标签: c# sabre

//我希望用肥皂创建Saber的会话ID或令牌号。我发现它的错误,我无法解决它,如果任何一个解决错误可以告诉我

try
        {

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://webservices3.sabre.com");

            //HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://sws3-crt.cert.sabre.com/");


            req.UserAgent = Request.UserAgent.ToString();
            req.ContentType = "text/xml;charset=\"utf-8\"";
            req.Accept = "text/xml";
            req.Method = "POST";
            req.Timeout = 500000;
            req.KeepAlive = false;
            req.ProtocolVersion = HttpVersion.Version11;


            Stream stm = req.GetRequestStream();
            doc.Save(stm);
            stm.Close();
            WebResponse resp  = req.GetResponse();

            stm = resp.GetResponseStream();
            StreamReader r = new StreamReader(stm);
            Response.Write(r.ReadToEnd());

            //Response.Write(stm.ToString());
            //Response.Write(r.ToString());

            Response.End();
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }

1 个答案:

答案 0 :(得分:0)

分享错误有助于社区做出回应。 无论如何,您是否看过.NET的Sabre API代码示例(SACS)?

https://github.com/SabreDevStudio/SACS-DotNet

它包含用于从SOAP生成会话的示例代码(如果您感兴趣,还包括REST)。