ColdFusion 9 CFHTTP Connection Failure
I am experiencing and issue when i try to connect to a webservice for the second time. I am getting the Connection Failure message. I have asked a similar question but after pulling together all the info I wanted to clearly ask it differently.
Background: The script below first connects to the API to get an access token. It then takes that access token and places it in the header when it request more data from the same service. I don't think it has anything to do with the authentication token connecting because I get a Status 200 code but the only thing in the body is Connection Failure
.
My Script (I have set the Auth Token statically below for testing):
<cfhttp url="https://mywebsite.com/criminal_api//1.0/oauth/token?grant_type=password&username=ABchecks&password=seven2eleven" method="GET"
username="****" password="****" result="result">
</cfhttp>
<cfset content = deserializeJSON(result.filecontent)>
<cfdump var="#content#">
<cfhttp method="get" url="https://mywebsite.com/criminal_api//1.0/service/requests" result="orderList">
<cfhttpparam type="HEADER" name="Authorization" value="Bearer 82FA1AF6FCBECED1B3D91C48C416AF97">
<cfhttpparam type="header" name="Accept-Encoding" value="*" />
<cfhttpparam type="Header" name="TE" value="deflate;q=0">
</cfhttp>
<cfset CurrentOrders = orderList.filecontent>
<cfdump var="#orderList#">
What I have tried:
I tried changing the encoding type since the webservice uses GZIP compression
<cfhttpparam type="header" name="accept-encoding" value="no-compression"/>
<cfhttpparam type="header" name="Accept-Encoding" value="*" />
<cfhttpparam type="Header" name="TE" value="deflate;q=0">
I have also navigated to the api url from a browser on the webserver and i am not getting any warnings about ssl certs.
My Output:
The code above outputs the following
struct
access_token 82FA1AF6FCBECED1B3D91C48C416AF97
expires_in 6497
refresh_token 2D79C001FD844A361C038D56408355FE
scope read write
token_type bearer
struct
Charset UTF-8
ErrorDetail [empty string]
Filecontent Connection Failure
Header HTTP/1.1 200 OK Connection: close Expires: Wed, 31 Dec 1969 16:00:00 PST Date: Wed, 18 May 2016 16:21:49 GMT Server: hws Pragma: No-cache Cache-Control: no-cache Set-Cookie: X-HR-ClientSessionId=3_12.161.115.226_1463588509419;Secure; path=/; HttpOnly Content-Type: application/json;charset=UTF-8
Mimetype application/json
Responseheader
struct
Cache-Control no-cache
Connection close
Content-Type application/json;charset=UTF-8
Date Wed, 18 May 2016 16:21:49 GMT
Expires Wed, 31 Dec 1969 16:00:00 PST
Explanation OK
Http_Version HTTP/1.1
Pragma No-cache
Server hws
Set-Cookie X-HR-ClientSessionId=3_12.161.115.226_1463588509419;Secure; path=/; HttpOnly
Status_Code 200
Statuscode 200 OK
Text NO
Does anyone know what else could be giving me the Connection Failure error?
When using Fiddler's Composer on the server that host the ColdFusion file I put in the endpoint the only header I added was the Authorization Token and it returned the JSON data successfully.
Below is the Raw headers:
GET https://mywebsite.com/criminal_api//1.0/service/requests HTTP/1.1
User-Agent: Fiddler
Authorization: Bearer 8A34A2398869EC2689514553EFFBE592
Host: mywebsite.com
I am not sure why the coldfusion file still won't work if I put those exact headers in?
链接地址: http://www.djcxy.com/p/31286.html上一篇: HTTPS错误/ X.509 ws