Solved

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

Posted on 2011-09-12
6
685 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
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.

 
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

Suggested Solutions

Title # Comments Views Activity
need some regex help 15 27
Using Coldfusion to create a CSV file 13 94
Coldfusion subreport - passing parameters 2 59
How can I use EncodeForURL() in ColdFusion with CFGRID 5 33
The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now