开发者

curl issue with URL not connecting

So I'm not a very good network person so I was hoping someone could p开发者_高级运维oint me in the right direction to figuring out what I am doing wrong.

I am trying to use curl to post a SOAP message. I am running the following:

curl -d "string of xml message" -H "Content-Type:text/xml; charset=utf-8" "[ip]:[port]/[service]"

This results in a 'Connection refused' message.

So I try pinging ip by itself...no problems. Then I think maybe I need http://[ip]:[port]/[service] so I tried pinging http://[ip] and I get: unknown host http://[ip] yet if I ping the IP by itself I get no issues.

Any thoughts on where to start debugging this issue?


First of all, ping can't use the HTTP-protocol, you can only ping domain names. Have a look at ping at wikipedia to learn more.

Curl normally doesn't need anything fancy, just begin by typing curl [protocol]:[host]:[port]/[service] and see if you get a response at all. I think that's what you're looking for when you tried to ping the remote address.

Judging by the response of the cURL attempt, you'll know if your attempt was successfull. It probably won't be since it is indeed the connection that was refused, you didn't include bad parameters.

Now, assuming it's a connection problem, try curling something else (a regular domain, like Google.com) to make sure you don't have a connection problem. Then, to learn whether the remote server has a problem, perform the same Curl attempt from another server somewhere (or ask someone else to do it) and see if they, too, are refused to connect. This is a good attempt to circle in around the problem and gain more clarity.


Ping (or ICMP) traffic runs (usually) on a different port than HTTP traffic. HTTP typically runs on port 80.

Try to telnet to the service (the ip and the port) using the following command:

telnet (ip) 80 (without the parens).

If you are able to connect to the service then you have some other issues, however, if the service doesn't let you connect, then you know the service is blocking you from the port (usually 80 for http) on which the service is running.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜