Home All Groups Group Topic Archive Search About

Web Service Question

Author
17 Dec 2006 8:26 PM
Ryan Smith
I have a web service that I have written and can't seem to get it working
properly.  I have a function that is exposed as a WebMethod() that is working
great.  The problem is that i have several variables that need to be set
before calling the function.  How can I go about setting those variables?

Could I use a public function exposed as a webmethod such as:

<WebMethod()> Public Sub SetIncome(ByVal Value as Integer)
             iIncome = Value
End Sub

I tried creating properties with Get and Set but could not figure out how to
expose those publically.  Any help is greatly appreciated!

Author
17 Dec 2006 8:54 PM
Karch
Keep in mind that the nature of web services or SOA is stateless, or should
be in most cases - that means that your operations, in most cases, should be
atomic. In other words, if you need to set properties when you call the
method, then pass them as parameters. If you are concerned about the number
of possible parameters, then serialize an object/structure that contains
those values. You can set the properties on the object before sending it
across the wire to the service.


Show quoteHide quote
"Ryan Smith" <RyanSm***@discussions.microsoft.com> wrote in message
news:3FB57F16-4319-449D-8DD7-11B1C604D166@microsoft.com...
>I have a web service that I have written and can't seem to get it working
> properly.  I have a function that is exposed as a WebMethod() that is
> working
> great.  The problem is that i have several variables that need to be set
> before calling the function.  How can I go about setting those variables?
>
> Could I use a public function exposed as a webmethod such as:
>
> <WebMethod()> Public Sub SetIncome(ByVal Value as Integer)
>             iIncome = Value
> End Sub
>
> I tried creating properties with Get and Set but could not figure out how
> to
> expose those publically.  Any help is greatly appreciated!
>

Bookmark and Share