views:

242

answers:

2

Hi, I'm fairly new to WebService developement and have just set up my own webservice (ASP.Net 3.5, Visual Studio 2008 .asmx file). I can not find a way of setting up my webservice to take parameters on the constructor. If i create a constructor that takes parameters, it is not then shown when i hook up to the webservice from my application (it only shows a parameterless constructor). Am i missing something blatently obvious, or is this not possible (and why not)?

Thanks.

A: 

it is meaningless to have parameters of web service constructor. web service communicate with client only on requests. constructor is called by web server internals automatically

Andrey
+1  A: 

When you say "constructor for my webservice", do you mean "constructor for the proxy that communicates with my webservice"?

You may need to write a wrapper for the proxy if you need to handle authentication tokens and the like (this is the approach that the Flickr.Net open source project took)

Rowland Shaw
By "need to", I mean "want to", of course -- depends how much you like the consumers of your service...
Rowland Shaw
Ah, i was missing the fact that it's the proxy that needs the constructor. I will make the Webservice authenticate every request, and create a wrapper for the proxy for use on the client that has a constructor taking authentication details. Cheers
Ben