Wednesday, April 06, 2011

Exposing the Service Helper page for ASMX web-services

When you access an ASMX based web-service from a browser on the machine that hosts the web-service, you will typically be shown the Service Helper page. The Service Helper page is useful for testing if the webservice is working correctly and provides you with a basic form with text-boxes for every parameter used by the web-service and an Invoke button that allows you to call the web-service method with the provided parameters.

Here is what it may look like:

image

The  service helper page (or as I call it, the Service Invoker page) is not displayed if you attempt to browse to the asmx page from a system other than the hosting webservice. The reason for this is security.

But this is very useful tool for the purpose of debugging and sometimes you just need to be able to access this service helper page from a different machine. Fret not, you can expose the service-helper page via the web.config.

Within the System.Web node add the following lines:

<webServices>
   
<protocols>
       
<add name="HttpSoap12"/>
       
<add name="HttpSoap"/>
       
<add name="HttpGet"/>
       
<add name="HttpPost"/>
   
</protocols>
</webServices>

For more information: MSDN: Configuration Options for XML Web Services Created using ASP.Net

No comments: