Solved

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

Posted on 2011-09-12
6
697 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
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 …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

830 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