Software Technology Tips

 To test a web method present inside a web service we need to call the web service through the browser and then invoke the web method. If the web method take some parameter then we have to provide it in the supplied text box as demonstrated in the picture below.


WebMethodTest

 

 

In the above example, I have a web method called “HelloUser(string) defined in “WebserviceTest” web service. It takes a string variable as parameter named as name. So when I want to invoke the web method for testing then I have to provide the parameter value in the text box as shown above.

    But with a little modification to the WebConfig file we can also pass the parameter in the url itself. The process is described as follow:

  • We have to add the following line of code inside the <system.web> tag of the WebConfig file.

    <webServices>

          <protocols>

            <add name="HttpGet"/>

         </protocols>

    </webServices>

Then we can pass the parameter value by appending it to the url.

  • Ex: http://localhost:1115/v150/WebserviceTest.asmx/HelloUser?name=MFS

[Hope this will help you with your web method testing.]


Related Tags:

Web Service, WebMethod, Webconfig

Author: Madhusmita Rout

ASP.NET

Let us Connect!

iso 9001 QA25 Red Herring STPI D&B Fastest Growing SME 2013 Award zinnov Nasscom

copyright (c) Mindfire Solutions 2007-2014. Login