I would like to find out if it is possible for a windows application web service proxy of a consumer can access session variables previously saved. I have been following the documentation on this site (http://www.c-sharpcorner.com/UploadFile/prvn_131971/CreatingWebServices02132008050732AM/CreatingWebServices.aspx) but i cant seem to have access to the property Cookiecontainer of the proxy (its not popping out in the intellisense). But for the asp.net application this property is available in the proxy. How can i access web service sessions in a windows application...my code looks something this this:
Hospital.HospitalServicesSoapClient proxy = new HospitalServicesClient.Hospital.HospitalServicesSoapClient();
bool login = proxy.authenticate(TextUsername.Text, TextPassword.Text);
Loading
Bechir BejaouiPosted Oct 30, 2008, 8:34 AM
public class AuthHeader : SoapHeader
{
public string SessionID;
…….
}
And the proxy method of your web service must have to be decorated with this [SoapHeader ("Authentication")] attribute.
From your client you have to initialize the web service as follow:
private Wsvs.AuthHeader Authorization = new Wsvs.AuthHeader();
and use an if block to check the sessionID
//SOAP Authorization request
Authorization.SessionID="mTeddy";
Teddy NyambePosted Oct 27, 2008, 12:13 AM
Session["username"] = "mteddy";
Now I want this variable to be accessed later by a windows application. According to the documentation i was reading in this website, it said i need to create a proxy which i did and then the proxy will have access to methods of the webservice...now further according to the documentation, the proxy wont work with sessions unless a cookie container is created, now my problem is how to use the cookie container with the proxy in a windows application. I have no problem with ASP.NET its working fine am able to add the cookie container member.
Your help will be greatly appreciated.
Bechir BejaouiPosted Oct 26, 2008, 5:07 PM