TomEA
asked on
CFHTTP fails with error: "I/O Exception: null"
Good afternoon,
I'm having some issues with Coldfusion MX7. An http request that worked for quite a long time now fails with "Connection Failure. Status code unavailable. " and errordetail: "I/O Exception: null".
Submitting the url in my browser returns a successful response, so I've no idea what the problem might be...
Here is the original code, which results in "Variable GEOCODED not defined.":
I tried to simplify things so I could track down what might be happening:
This yields the struct:
Any nudges in the right direction would be greatly appreciated!
I'm having some issues with Coldfusion MX7. An http request that worked for quite a long time now fails with "Connection Failure. Status code unavailable. " and errordetail: "I/O Exception: null".
Submitting the url in my browser returns a successful response, so I've no idea what the problem might be...
Here is the original code, which results in "Variable GEOCODED not defined.":
<cfhttp url="http://geocoder.us/service/csv/geocode?zip=#url.zip#" method="GET" timeout="10" name="geocoded" columns="LATITUDE, LONGITUDE, CITY, STATE, ZIP" delimiter="," firstrowasheaders="no">
<cfdump var="#geocoded#" label="geocoded" />
I tried to simplify things so I could track down what might be happening:
<cfhttp url="http://geocoder.us/service/csv/geocode?zip=#url.zip#" method="GET" timeout="10" result="test">
<cfdump var="#test#" label="test" />
This yields the struct:
test - struct
Charset [empty string]
ErrorDetail I/O Exception: null
Filecontent Connection Failure
Header [undefined struct element]
Mimetype Unable to determine MIME type of file.
Responseheader
test - struct [empty]
Statuscode Connection Failure. Status code unavailable.
Text YES
Any nudges in the right direction would be greatly appreciated!
Make sure you are not behind proxy, the error is connection failure. If you are behind proxy then use ProxyPort and ProxyServer attributes for CFHTTP..
ASKER
Good thought, but no proxies here!
I did a test of the above URL and was able to connect.. so it has definitely to do with your network blocking it..
Charset [empty string]
ErrorDetail [empty string]
Filecontent 33.143792, -96.83938, Frisco, TX, 75034
Header HTTP/1.1 200 OK Content-Type: text/plain Connection: close Vary: Accept-Encoding Date: Mon, 12 Sep 2011 14:57:10 GMT Server: Apache/2.2.9 (Debian) mod_perl/2.0.4 Perl/v5.10.0
Mimetype text/plain
Responseheader
test - struct
Connection close
Content-Type text/plain
Date Mon, 12 Sep 2011 14:57:10 GMT
Explanation OK
Http_Version HTTP/1.1
Server Apache/2.2.9 (Debian) mod_perl/2.0.4 Perl/v5.10.0
Status_Code 200
Vary Accept-Encoding
Statuscode 200 OK
Text YES
Charset [empty string]
ErrorDetail [empty string]
Filecontent 33.143792, -96.83938, Frisco, TX, 75034
Header HTTP/1.1 200 OK Content-Type: text/plain Connection: close Vary: Accept-Encoding Date: Mon, 12 Sep 2011 14:57:10 GMT Server: Apache/2.2.9 (Debian) mod_perl/2.0.4 Perl/v5.10.0
Mimetype text/plain
Responseheader
test - struct
Connection close
Content-Type text/plain
Date Mon, 12 Sep 2011 14:57:10 GMT
Explanation OK
Http_Version HTTP/1.1
Server Apache/2.2.9 (Debian) mod_perl/2.0.4 Perl/v5.10.0
Status_Code 200
Vary Accept-Encoding
Statuscode 200 OK
Text YES
Here is what I tried..
<cfhttp url="http://geocoder.us/service/csv/geocode?zip=75034" method="GET" timeout="10" result="test">
<cfdump var="#test#" label="test">
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This led me on the road to the solution! If the zipcode is not found, the web service returns a blank page, which I presume coldfusion was interpreting as a connection failure. I added some logic to determine if a proper response had been returned and went on with my day. Thanks!