Web Service check in SOAP UI with Session

杀马特。学长 韩版系。学妹 提交于 2019-12-25 18:24:01

问题


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.


回答1:


Maintaining sessions requires cookie support at the client side. Most probably your client has cookies disabled. You can verify that easily with any http debugger like Fiddler, just post two requests and see the response of the first (should set the cookie) and request of the second (should carry the cookie).




回答2:


Wiktor Zychla, Thank you for your help finally i find that how do we handle sessions in SOAP UI.

We need to Add Request in testCase, add HTTP Test Request. also check the option of Maintain HTTP session. Ref: http://beforedikshaforgets.blogspot.com/2011/08/soap-ui-creating-test-case.html

Furthermore according to my understanding there is a bug in SOAPUI 4.0 so i shift my service on SOAOUI 4.5 for maintaining session



来源:https://stackoverflow.com/questions/12120653/web-service-check-in-soap-ui-with-session

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!