![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
The Web Service isn't REALLY a class. .NET just uses the class mechanism to make it easy for us to create them. But the web service standard has no knowledge of what we are doing and is really just letting us call the individual methods in them. You'll notice there isn't any ability to call a property either. What we create as an object on the client side is just a proxy to call the web service. All the web service or the client knows about really are the methods in our class that we've marked with the "WebMethod" attribute and are public. Dave Bush http://blog.dmbcllc.com It seems like this should be easy but I must be missing something...I'm trying to create a web service class that accepts is instantiated with parameters but I always get just the new() option (parameterless). Here's a very simple example of what I've tried. ------Web Service---------- System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _ System.Web.Services.WebServiceBinding(ConformsTo:= WsiProfiles.BasicPr ofile1_1) _ ToolboxItem(False)> _ Public Class Service1 Inherits System.Web.Services.WebService Private _text As String Protected Sub New() End Sub Public Sub New(ByVal Text As String) _text = Text End Sub WebMethod()> _ Public Function GetText() As String Return _text End Function End Class --------------------------- I added the Protected New sub because I read that you must have one parameterless constuctor to create a serializable class and it certainly gives an error if you don't. The above code looks simple enough to me but when I try to call it in my client it doesn't show a class that can be created with parameters. If I add a reference to the web service called 'ws', then in my code when I try to do somethign like "dim s as New ws.Service1("text")" is says "too many arguments to 'Public Sub New()' (which I knew because Intellisense doesn't show any parameters when I typed ws.Service1). But why does it even see 'Public Sub New()' when I set it to Protected and why doesn't it see 'public sub new (by val text as string)'? I've been Googling it to death and I can't find anything on this. I see examples that seem to instantial the web methods with parameters but not working code. The code above is from a brand new web service project and a windows client calling it so I don't know how to simplify it any more. Thanks for any help. John John<nospam>@GTSolutions.us |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |