Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / June 2005

Tip: Looking for answers? Try searching our database.

Question on object instace & web service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ravi - 27 Jun 2005 06:15 GMT
Hi,
    I have a (stupid) question on why web service class needs an instance.
Everybody knows its stateless then why cant it can be standardized that all
methos in web service class should be static. For eg I create an instance
websrv.
I have 2(set/get) methods and a private variable 'name'.
websrv.setName("Hello"); and in next line if I call
websrv.getName() obviously it wont work. then why cant we make it static.
Jon Skeet [C# MVP] - 27 Jun 2005 07:04 GMT
>      I have a (stupid) question on why web service class needs an instance.
> Everybody knows its stateless then why cant it can be standardized that all
[quoted text clipped - 3 lines]
> websrv.setName("Hello"); and in next line if I call
> websrv.getName() obviously it wont work. then why cant we make it static.

Actually, I think it *might* work, depending on how the web service
deals with sessions.

More importantly though, the methods can't be static because of the
various instance properties to do with the web service class which are
needed to know what server to contact etc - things like the url, the
proxy etc.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

jabailo@texeme.com - 27 Jun 2005 07:44 GMT
> Hi,
>      I have a (stupid) question on why web service class needs an
[quoted text clipped - 5 lines]
> websrv.setName("Hello"); and in next line if I call
> websrv.getName() obviously it wont work. then why cant we make it static.

You should use remoting.

Signature

Texeme Textcasting Technology
http://www.texeme.com

Cor Ligthert - 27 Jun 2005 08:49 GMT
Ravi,

In addition what Jon wrote.

I am not sure about a webservice, however I would not know why it would
works different.

In any webapplication does the serverside application belongs to all active
clients.

For me it is a multitier especially if you use static/shared classes.

The application running in the Client inside IE is the client (it is a real
application running in IE,  even if you don't think in it in that way)

The Dll on the serversides gives requested data (even if it is the first
time nothing) to the clients and processes returned data.

The database (whatever it is) holds the data.

When there are no more sessions active, than the program ends and you have
to initialize everything new.

I hope this gives an idea

Cor
Ravi - 27 Jun 2005 14:40 GMT
Thanks for that. Yes what you said makes sense if its happening in web
applications then web service is no different.

> Ravi,
>
[quoted text clipped - 22 lines]
>
> Cor

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.