webservices: simple question, accessing webservice members

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: hellrazor (jorge_at_another-world.com)
Date: 11/16/04


Date: Mon, 15 Nov 2004 17:01:25 -0800

Hi, (new to webservices here)

Is it possible to access a class instance variable defined in a webservice?
I want to access this variable, in addition to the data being returned by
the [webmethod].

so let's say I have the following webservice class:

        public class Service1 : System.Web.Services.WebService
        {

                public string hello2;

                public ModelServices()
                {
                        InitializeComponent();
                }

                [WebMethod]
                public string sayHello()
                {
                                    hello2 = "another hello to you!"
                            return "hello there";
                }
        }

...............................

So when I consume this webservice, I want to be able to call the sayHello()
method, and have access to the hello2 variable after having called sayHello
() and thus expecting the "hello2" variable to contain the "another hello
to you!" value:

remoteWS.Service1 ws = new remoteWS.Service1();
string hello1 = ws.sayHello();
string hello2 = ws.hello2;

Is this possible, and how do I go about doing it? thanks!



Relevant Pages

  • webservices: simple question, accessing webservice members
    ... Is it possible to access a class instance variable defined in a webservice? ... So when I consume this webservice, I want to be able to call the sayHello() ... and have access to the hello2 variable after having called sayHello ... string hello1 = ws.sayHello; ...
    (microsoft.public.dotnet.languages.csharp)
  • webservices: simple question, accessing webservice members
    ... Is it possible to access a class instance variable defined in a webservice? ... So when I consume this webservice, I want to be able to call the sayHello() ... and have access to the hello2 variable after having called sayHello ... string hello1 = ws.sayHello; ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: webservices: simple question, accessing webservice members
    ... you can either add another webmethod to return the new value (which is ... public SharedClass SayHello() ... > so let's say I have the following webservice class: ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: webservices: simple question, accessing webservice members
    ... you can either add another webmethod to return the new value (which is ... public SharedClass SayHello() ... > so let's say I have the following webservice class: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: webservices: simple question, accessing webservice members
    ... you can either add another webmethod to return the new value (which is ... public SharedClass SayHello() ... > so let's say I have the following webservice class: ...
    (microsoft.public.dotnet.framework.webservices)