Skip to main content
Known Participant
February 18, 2012
Question

CFHTTP Connection Failure

  • February 18, 2012
  • 2 replies
  • 10314 views

Hi,

I've been struggling with reading a 3rd party product feed.

I'm using the following code


<cfhttp url="http://webservices....">

<cfhttpparam type="header" name="accept-encoding" value="deflate;q=0">

<cfhttpparam type="header" name="te" value="deflate;q=0">

</cfhttp>




<cfdump var="#cfhttp#">

It returns with

struct
Charsetutf-8
ErrorDetail[empty string]
FilecontentConnection Failure
HeaderHTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Date: Sat, 18 Feb 2012 13:42:00 GMT Cache-Control: private, max-age=0 X-AspNet-Version: 4.0.30319 Server: Microsoft-IIS/7.0 X-Powered-By: ASP.NET
Mimetypetext/xml
Responseheader
struct
Cache-Controlprivate, max-age=0
Content-Typetext/xml; charset=utf-8
DateSat, 18 Feb 2012 13:42:00 GMT
ExplanationOK
Http_VersionHTTP/1.1
ServerMicrosoft-IIS/7.0
Status_Code200
X-AspNet-Version4.0.30319
X-Powered-ByASP.NET
Statuscode200 OK
TextYES

If use Firefox Live Headers plugin and view the feed in the browser, it displays fine and also the plugin gives me the information

GET /services/products.asmx...... HTTP/1.1

Host: webservices.......

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-gb,en;q=0.5

Accept-Encoding: gzip, deflate

Connection: keep-alive

Cache-Control: max-age=0

HTTP/1.1 200 OK

Cache-Control: private, max-age=0

Content-Type: text/xml; charset=utf-8

Content-Encoding: deflate

Server: Microsoft-IIS/7.0

X-AspNet-Version: 4.0.30319

X-Powered-By: ASP.NET

Date: Sat, 18 Feb 2012 13:34:09 GMT

Content-Length: 9225

I've googled and tried variation of accept-encoding to no avail, I just get connection failure.

Any ideas? Thanks

p.s. also tried

<cfhttpparam type="header" name="accept-encoding" value="no-compression"/>

This topic has been closed for replies.

2 replies

StormpoolAuthor
Known Participant
February 18, 2012

I might have been approaching it wrong, it is a SOAP webservice - so I'm going to try this

http://www.bennadel.com/blog/1809-Making-SOAP-Web-Service-Requests-With-ColdFusion-And-CFHTTP.htm

well actually it supports http requests, soap 1.1 and soap 1.2

even with trying the soap approach I get

struct
Charsetutf-8
ErrorDetail[empty string]
FilecontentConnection Failure
HeaderHTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Date: Sat, 18 Feb 2012 15:01:56 GMT Cache-Control: private, max-age=0 X-AspNet-Version: 4.0.30319 Server: Microsoft-IIS/7.0 X-Powered-By: ASP.NET
Mimetypeapplication/soap+xml
Responseheader
struct
Cache-Controlprivate, max-age=0
Content-Typeapplication/soap+xml; charset=utf-8
DateSat, 18 Feb 2012 15:01:56 GMT
ExplanationOK
Http_VersionHTTP/1.1
ServerMicrosoft-IIS/7.0
Status_Code200
X-AspNet-Version4.0.30319
X-Powered-ByASP.NET
Statuscode200 OK
TextYES
Owainnorth
Inspiring
February 18, 2012

Have you tried with no headers at all? Can you browse the webservice from the ColdFusion server?  It seems a little odd that it's getting a 200 but giving you back "Connection Failure" - that would imply it's something in their software that's throwing that message rather than the HTTP transaction.

Is there any documentation that says what you need to send?

StormpoolAuthor
Known Participant
February 18, 2012

Tried without httpheaders, the same result.

Added throwonerror and it gives the error "Connection Failure: Status Code Unavailable"

I haven't got access to the ColdFusion server, however I tried it on another CF server to the same affect. I'll install the developer edition on my local PC and retry.

I will see if I can find any documentation.

Thanks

--

Tested on local PC with CF9 dev server, same issue.

Documentation does not suggest anything that might help.

BKBK
Community Expert
Community Expert
February 18, 2012

I agree with Owain. The combination of a 200 OK status and cfhttp.filecontent of 'Connection Failure' implies you got a response back, and the response had the message 'Connection Failure' as its only content.

The content-type is XML, which raises the question, is the service expecting your request to be SOAP?  Could we have a look at your cfhttp code?