network-programmingsoapcurl

curl issue with URL not connecting


So I'm not a very good network person so I was hoping someone could point 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?


Solution

  • 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.