SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software

Kodyaz Development Resources

Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Windows, Windows Phone, SAP and ABAP, like SAP UI5, Screen Personas, etc.




How to Test Web Service from a Remote Machine by using HTTP POST and HTTP GET Protocols


Assume that an ASP.NET developer create web service by using the ASP.NET web service project template in Visual Studio .NET 2003. ASP.NET developer is able to test web service on the localhost by browsing the web service url. But testing web services on remote machine can cause an error during web service test process.


Testing Web Services on Localhost

All you should do to test web service method is just browsing the web service address on localhost using a web browser. Then select the operation or web service method you want to test whether it is working successfully or not. When you click on the operation listed on the .asmx web service page, you will be redirected to the operation description page.

how to test web service from remote machine using http post and http get protocols





For example, I develop web services for CTI applications for a call center application. Here I named the web service as HPPC. And one of the web service methods or functions of this web service is CTI_AGENT_DIAL. The description of this web service function is explained on the operation detail page also. On this page, if you are calling this web service address from local computer you will see a web service test form and an Invoke button which enables you to test web service medhots and functions.

By pushing the Invoke button, ASP.NET web service developers will be able to test web service by using HTTP POST protocol.


How to Test Web Services on Remote Machine

Unfortunately, to test web services ability is disabled if you call web service method hosted on a remote machine. With .NET Framework 1.1 HTTP GET method and HTTP POST methods are disabled on the webserver by default. In .NET Framework 1.0 both methods as well as SOAP were enabled. A remote machine can not display or see the Invoke button for testing a web service function or an operation you have developed on hosting on your computer. If you call the remote machine address of the web service method, the test form will not be displayed by default. The message the remote computer will see or get will be as :

"The test form is only available for requests from the local machine."

This simple test method is very useful and is necessary during the development process of your web service. You will frequently get use of this test method. To enable testing a web service from a remote machine or computer, you can edit the web.config configuration file in your web service project or if you want to enable this test for all the web services running on the same web server you can edit the machine.config configuration file. By editing one of the two configuration files, you will enable HTTP POST and/or HTTP GET protocols.

If you decide to edit the web service application's web config file, you can add the below configuration settings between the <system.web> and </system.web> tags.

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

If you want to edit the machine.config file you can add the two protocols, HttpPost and HttpGet by the following line of codes. You can find the machine.config file in C:\WINNT\Microsoft.NET\Framework\v1.1.4322\CONFIG\ folder for .NET Framework 1.1

<protocols>
   <add name="HttpPost"/>
   <add name="HttpGet"/>
</protocols>

These changes will enable testing web services and provide a web service test tool for .NET developers.




download SQL Server 2012 for free evaluation






Copyright © 2004 - 2017 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems