c# - How to give a value to a variable that is in a WebService? -


i making project using webservices in c#. wanted ask you, how can give value variable client web service?

for example: in web service have variable , 2 methods, getvariable() , setvariable(bool a);

bool var = false;  [webmethod] public void setvariable(bool a) {  var = a; }  [webmethod] public bool getvariable() {  return var; } 

this how web service looks (it's simple because learning).

my client: //in client added web service service reference , added code:

servicereference.servicesoapclient obj = new servicereference.servicesoapclient();   private void form_load(object sender, eventargs e) {     obj.setvariable(true);     label1.text = obj.getvariable().tostring(); } 

and when load form, label1.text isn't equal "true" "false"!! means didn't execute code: obj.setvariable(true); professor said in class webservice "full...." (but couldn't hear well), said have find way make webservices "ful..."

can me ?

web services stateless default, means don't retain state between calls. value set in 1 call won't available usage next call.

if need stateful service, there several ways go. this simplest.

it sounds doing learning purposes, in case suggest reading on why not practice develop using stateful services. try this one starters.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -