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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -