Solved

CFHTTP fails with error: "I/O Exception: null"

Posted on 2011-09-12
6
690 Views
Last Modified: 2012-05-12
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.":
    <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" />

Open in new window



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" />   

Open in new window


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 

Open in new window


Any nudges in the right direction would be greatly appreciated!
0
Comment
Question by:TomEA
  • 3
  • 2
6 Comments
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 36523084
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..
0
 
LVL 1

Author Comment

by:TomEA
ID: 36523174
Good thought, but no proxies here!
0
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 36523220
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
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 36523232
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">

Open in new window

0
 
LVL 36

Accepted Solution

by:
SidFishes earned 250 total points
ID: 36523381
I can confirm you code works for me.

what I tried

  <cfhttp url="http://geocoder.us/service/csv/geocode?zip=90210" method="GET" timeout="10" name="geocoded"
columns="LATITUDE, LONGITUDE, CITY, STATE, ZIP" delimiter="," firstrowasheaders="no">        
    <cfdump var="#geocoded#" label="geocoded" />


which returned
geocoded - query
        CITY       LATITUDE       LONGITUDE       STATE       ZIP
1       Beverly Hills       34.088808       -118.40612       CA       90210


I can cause an 500 server error (which might be displayed as a connection failure with debugging off) by not passing in a value for url.zip so maybe hard code a value to check that...
0
 
LVL 1

Author Closing Comment

by:TomEA
ID: 36524786
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!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question