读书人

Delphi调用C# Webservice有关Sessio

发布时间: 2012-04-27 11:57:44 作者: rapoo

Delphi调用C# Webservice,有关Session问题
在Delphi,是否有类似的CookieContainer???

C# code
--webservice[WebMethod(Description = "Hello Demo", EnableSession = true)]        public string HelloWorld()        {            if (System.Web.HttpContext.Current.Session.Count == 0)            {                return "Hello,World";            }            else            {                return "Hello World, " + System.Web.HttpContext.Current.Session["UserName"].ToString();            }        }--客户端 winformsingleWebservice = new WindowsFormsApplication1.localhost.MyService();            cookieContainer = new CookieContainer();            singleWebservice.CookieContainer = cookieContainer;


[解决办法]
GetServiceSoap 调用的 HTTPRIO 貌似不支持 Cookie
非要用的话,用 IdHttp + IdCookieManager
自己弄XML POST上去,再分析回来的XML
我记得有几个控件,对XML分析的还是不错的

读书人网 >.NET

热点推荐