java调用.net Webservice的会话状态问题

tzp_8 tzp_8 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
Web Service代码

class Student : System.Web.Services.WebService
{
private String name;
[WebMethod (EnableSession=true)]
public String getName()
{
return (String)Session["NAME"];
}
[WebMethod (EnableSession=true)]
public void setName(String aName)
{
Session["NAME"] = aName;
}
}



.net客户端代码

...
localhost.Student student = new localhost.Student();
student.CookieContainer = new System.Net.CookieContainer(); //.net中加这个才可以
student.setName("Lao Wang");
String myInfo = student.getName();
...



请问java改怎么调用,java每次调用getName();都是空值
...全文
评论 2
收藏 已收藏
分享
返回顶部
tzp_8
C# 111,130 成员 642,541 内容