Sessions usually work with web-browsers by being stored as cookies or passed as part of the URL. Using web-services, this functionality doesn't usually exist and a more common way to preserve data between requests is to create a unique key which is used during all of the communications between your application and the web-service.
You could use a process similar to below, but I think it would pay off to streamline your web methods (so that, in the example you gave, you don't need to make a call to return the card number you just passed to the web-service).
bool ValidateVISACard(string cardNumber,ref Guid uniqueKey){bool isValid =false; Validator v =new Validator();if (v.ValidateVisa(cardNumber)) {// Generate a unique key uniqueKey =new Guid();// Store the result in the database (along with the key // and current date/time) isValid =true; }return isValid;}string GetCardNumber(Guid uniqueKey){// Look up the card number in the database, using the unique key // as a reference to the database entry}
No comments:
Post a Comment