Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: RE: Web-callable Properties


Message #1 by Rob Howard <rhoward@m...> on Mon, 1 Jan 2001 19:47:05 -0800
Hi Scott,



You should design the web service to be stateless if at all possible.

However, if you do wish for the web service to be stateful you'll have to do

two things:

1. Inherit from the base class WebService

2. Add the following to your WebMethod attribute declaration (by default

session state is turned off):

 [WebMethod(EnableSessionState=true)]



A couple of other points:

1. Consider redesigning the object to not use properties. The fewer calls

you can make to the web service the better, as each call means network i/o

and that will almost always be your slowest resource.

2. Using session state ties your web service to the http protocol, since we

use http cookies to maintain the session state for web services just as we

do with web pages.



Hope that helps!

Rob



-----Original Message-----

From: Scott A. Keen [mailto:scott@s...]

Sent: Friday, December 22, 2000 7:56 AM

To: ASP+

Subject: [aspx] RE: Web-callable Properties





Thanks for the reply.



The reason is because we want to convert an existing COM object, which has

custom properties and methods, to be a web-callable service.



The way it works is, we set a bunch of properties on the object, then call

several methods which access those properties which may or may not change

some of the properties.



Of course we could re-write the entire thing with parameterized method calls

and no properties, and this would mean passing a long list of parameters,

some which may not ever change.



I'm reading the Wrox ASP+ Preview book, and it says that the <WebMethod>

attribute makes methods and _properties_ web-callable. Microsoft

documentation says that the _default_ state of a Web Service is stateless,

which implies that the state could be changed.



I really don't need it to maintain state between web-pages, just for the

instance that it's being used in the .aspx calling page. When the page has

finished loading, I would have no further use for the object.



Well, hope I get a definitive answer on this. I'd prefer not to have to

rewrite the object.





---

http://www.asptoday.com - the leading site for timely,

in-depth information for ASP developers everywhere.

---

You are currently subscribed to aspx as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-aspx-$subst('Recip.MemberIDChar')@p2p.wrox.com


  Return to Index