473,378 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Question on object instace & web service

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.

Jul 21 '05 #1
4 1447
Ravi <Ra**@discussions.microsoft.com> wrote:
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.


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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2
Ravi wrote:
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.


You should use remoting.

--
Texeme Textcasting Technology
http://www.texeme.com
Jul 21 '05 #3
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
Jul 21 '05 #4
Thanks for that. Yes what you said makes sense if its happening in web
applications then web service is no different.
"Cor Ligthert" wrote:
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

Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Liza | last post by:
Hi guys, i'm trying to build a web service....... is there such thing as polymorphism in web services? i mean could i have two web services of the same name but different arguments such that i...
4
by: annoyingmouse2002 | last post by:
Hi there, sorry if this a long post but I'm really just starting out. I've been using MSXML to parse an OWL but would like to use a different solution. Basically it reads the OWL (Based on XML)...
0
by: AMDIRT | last post by:
I have a few questions about IssueVision (from WindowsForms) concerning its scalability and performance. Rather, if I were to implement techniques described here into another application, how...
17
by: Zeng | last post by:
I'm trying to comparing 2 objects (pointer to object) to see if they are the "same" as each other. Here is what the definition of being the "same" object type for both objects, object 1, ...
2
by: Chris Becker | last post by:
This is my attempt to rephrase a question I asked earlier that got no response. I suspect it was my poor/unplanned wording. Here is another attempt: I have a form with some drop down lists. I...
6
by: Mike Miller | last post by:
Question: How do you develop a web service that uses unknown types? The ideas is that my web service performs a generic function. I want anyone to be able to consume it, but I can't know what...
4
by: Ravi | last post by:
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....
2
by: et | last post by:
I am new to asp.net. I am writing a program that will revolve around an extensive client database, and wonder what the best way to design the program is, using classes. I have about 10 different...
0
by: =?Utf-8?B?SmVhbi1GcmFuY29pcyBCcmV0b24=?= | last post by:
"siddharthkhare@hotmail.com" wrote: The context is important in this kind of design concern : I assume there's a lot of user and that application will evolve to add richer functionality. My...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.