2008年9月30日 星期二

How to diagnose web connection with Telnet on UNIX

Problem:
My application need to send XML Soap message to the third-party application. How can we make sure the connection is good?

Solution:
In general, we can use web browser to test web connection on PC, but when our product running on UNIX, we can use Telnet to test the web connection.

For example, the URL of XML Soap server is http://192.168.1.99/PMS_Webservice/XMLSoapEventServices.asmx
1. Verify the connection.
Please key in the command:
telnet 192.168.1.99 80
IF you see this message, the connection is fine.
Connected to 192.168.1.99.
Escape character is '^]'.
IF you see this message, the connection is not work. Please check the IP or Port
Trying 192.168.1.99...
telnet: Unable to connect to remote host: Connection refused

2. Verify the web page of XML Soap services.
Please key in the GET command:
GET /PMS_Webservice/XMLSoapEventServices.asmx
IF you see this message, the web page is ok.
HTTP/1.1 200 OK
IF you see this message, the web page is not found. (Service not online)
HTTP/1.1 404 Object Not Found

Example:


themcs001 /usr2/class> telnet 192.168.1.99 80
Trying 192.168.1.99...
Connected to 192.168.1.99.
Escape character is '^]'.
GET /PMS_Webservice/XMLSoapEventServices.asmx
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Wed, 17 Sep 2008 03:13:42 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/html; charset=utf-8
Content-Length: 3340




Connection to 192.168.1.99 closed by foreign host.




themcs001 /usr2/class> telnet 192.168.1.99 80
Trying 192.168.1.99...
Connected to 192.168.1.99.
Escape character is '^]'.
GET /PMS_Webservice/XMLSoapEventServices.php
HTTP/1.1 404 Object Not Found
Server: Microsoft-IIS/5.1
Date: Wed, 17 Sep 2008 03:19:27 GMT
Content-Length: 3878
Content-Type: text/html


Connection to 192.168.1.99 closed by foreign host.

沒有留言: