Passing an optional parameter to a webservice in vb.net
Is there a way to pass an optional parameter to a webservice, instead of having to overload the method?
If the webservice user is accessing the webservice directly, I want to do ActionA, if the user is accessing the webservice through my web interface, I want to do Action开发者_StackOverflowA + ActionB.
no, you can't really have optional params for a service.
Even if an input parameter for a Web service method is optional, you must still include it and set the parameter value to null
Supplying Web Service Method Arguments
So, its optional to a degree, that you dont have to supply a value, but you're still going to have to write null
instead. Overloading is the 'normal' way to do this.
精彩评论