0

I have a simple web-service on .Net 3.5 in which there is a method of HelloWorld() as below

[WebMethod(EnableSession=true)]
public string HelloWorld() {
    if (Session["Count"] == null) { Session["Count"] = 1; }
    Session["Count"] = Convert.ToInt32(Session["Count"]) + 1;
    return "Hello World " + Session["Count"];
}

which works in ASP.NET web-browser and IIS and returns output Hello World 1, 2, 3, 4 and soon.... depend on how much page open or refresh.

After some time according to requirement of project i was used SOAPUI tool (for testing of web service).
I create new project in SOAPUI and insert the url of service like http://www.myservices/service.asmx?wsdl

In SOAPUI there is a method with same name but when i execute it the open every time it creates a new session. means its returns me Hello World 1, 1, 1, 1 at all the time, not maintain Sessions.

However i need to maintain the session for the testing of service.
Thank you.

4

2 回答 2

0

维护会话需要客户端的 cookie 支持。很可能您的客户端禁用了 cookie。您可以使用任何 http 调试器(如 Fiddler)轻松验证这一点,只需发布​​两个请求并查看第一个请求(应设置 cookie)和第二个请求(应携带 cookie)的响应。

于 2012-08-25T09:23:52.537 回答
0

Wiktor Zychla,感谢您的帮助,最后我发现我们如何在 SOAP UI 中处理会话。

我们需要在testCase中添加Request,添加HTTP Test Request。还要检查维护 HTTP 会话的选项。参考:http ://beforedikshaforgets.blogspot.com/2011/08/soap-ui-creating-test-case.html

此外,根据我的理解,SOAPUI 4.0 中存在一个错误,因此我将我的服务转移到 SOAOUI 4.5 上以维护会话

于 2012-08-26T20:13:40.900 回答