Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Web-callable Properties


Message #1 by "Scott A. Keen" <scott@s...> on Thu, 21 Dec 2000 16:54:51 -0000
Hi all,



I'd like to make a Web Service with web-callable Properties using VB code

in an .asmx file. As you know, you can do this with <WebMethod()> for Functions, but I

can't find any documentation on how to do this with Properties.



I think I may have gotten half-way there with this code:



<%@ WebService Language="VB" Class="test1" %>

Imports System.Web.Services

Class test1

    Private mvarVal1 As Integer

        Public Property Val1 As Integer

            Get <WebMethod>

                Val1 = mvarVal1

            End Get

            Set <WebMethod>

                mvarVal1 = Val1

            End Set

        End Property

End Class



...the problem is that it doesn't maintain the state of the mvarVal1

member variable. I also noticed that I have to set/get the property by

calling it like a method, like this:



Set_Val1( 12345 )

mytestval = Get_Val1( )



Am I totally lost? Can someone just set me straight on creating

web-callable Properties?



Thanks,

Scott A. Keen

scott@s...



---

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

Message #2 by =?iso-8859-1?Q?Fredrik_Norm=E9n?= <fredrik.normen@e...> on Fri, 22 Dec 2000 11:19:54 +0100
Why do you want a Web Service to hold a state ?



The idea of a Web Services is that other companies could offer some services

over the web for you ( Public methods that can be called over the Internet),

for example a compnay offer you a service to get weathers in the local area.



As far as I know, SOAP have no support for properties,

neither does DSL ( DSL describes a Web Service in XML )



/Fredrik Normén



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

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

Sent: den 21 december 2000 17:55

To: ASP+

Subject: [aspx] Web-callable Properties





Hi all,



I'd like to make a Web Service with web-callable Properties using VB code

in an .asmx file. As you know, you can do this with <WebMethod()> for

Functions, but I

can't find any documentation on how to do this with Properties.



I think I may have gotten half-way there with this code:



<%@ WebService Language="VB" Class="test1" %>

Imports System.Web.Services

Class test1

    Private mvarVal1 As Integer

        Public Property Val1 As Integer

            Get <WebMethod>

                Val1 = mvarVal1

            End Get

            Set <WebMethod>

                mvarVal1 = Val1

            End Set

        End Property

End Class



...the problem is that it doesn't maintain the state of the mvarVal1

member variable. I also noticed that I have to set/get the property by

calling it like a method, like this:



Set_Val1( 12345 )

mytestval = Get_Val1( )



Am I totally lost? Can someone just set me straight on creating

web-callable Properties?



Thanks,

Scott A. Keen

scott@s...





---

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

Message #3 by "Scott A. Keen" <scott@s...> on Fri, 22 Dec 2000 10:56:00 -0500
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