That HelloWorld example was good and all but it didn’t have any parameters. All that we need to do in order to add a parameter to our web service is add a parameter to the HelloWorld function. I’ve also changed it to return that same parameter as the response.

Now go and view the web service like we did before. You’ll notice that on the page with the “Invoke” button, it now also has a textbox for the string. You can type in your name into this textbox and when the “Invoke” is clicked, it will return the name like my code shows it should do.
With the parameters for a web service, you can add as many parameters as you need like you would any other function. If your parameters are primitives (ie. String, int…), you can use the test tools for the web service but if the parameters are your own custom objects or even objects like DateTime, the test tools won’t work. If you need to pass a DateTime object though, don’t convert it into a String just so that you can test it. It’s better to just pass the DateTime object.
Here is an example of what it would look like with just a string as the parameter like we've setup above.
Subscribe to
Posts [Atom]