if you want your code to be reliable, don't use cfhttp

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Beattie,
Barry
Sent: Thursday, June 26, 2003 2:18 PM
To: CFAussie Mailing List
Subject: [cfaussie] debugging CFHTTP


Hi All.

I'm finally got a chance to work on an idea of Spike's for scripting the
creating of DSN's in the CFMX administrator.

the idea is to use CFHTTP to post the details to the datasources form.

but how do you monitor whether it's working? I'm getting something thanx to
a TRY/CATCH over each part.

login to the administrator: sucess
cfhttp.FileContent = Connection Failure

trying the datasources page: FAILED
cfhttp.FileContent = Connection Failure

cfhttp.MIMEType = text/html

I'm going to go over it with a fine tooth comb to see if I've missed
anything but what else can I do to monitor CFHTTP?

any ideas most welcome
cheers
barry.b

<!--- here's the code that I'm using --->

<!---
auto posting of new DSN info to the CFMX admin datasources
Add New Data Source Name (self-posting form)
http://bluetongue:8500/CFIDE/administrator/datasources/index.cfm
FORM ACTION="/CFIDE/administrator/datasources/index.cfm"
(CFLOCATION to...)
Select The Database File
http://bluetongue:8500/CFIDE/administrator/datasources/msaccess.cfm?dsn=test
FORM ACTION="/CFIDE/administrator/datasources/msaccess.cfm?dsn=test"
--->
<cfset loginPWD = "password">
<cfset dsnInfo = structNew()>
<cfset dsnInfo.class ="macromedia.jdbc.MacromediaDriver">
<cfset dsnInfo.dbtype = "msaccess">
<cfset dsnInfo.driver = "MSAccess">
<cfset dsnInfo.host = "localhost">
<cfset dsnInfo.port = "19998">
<cfset dsnInfo.epassword = "">
<cfset dsnInfo.databaseFile = "c:\CfusionMX\db\test.mdb">
<cfset #dsnInfo.systemDatabaseFile# = "">
<cfset dsnInfo.dsn = "test">
<cfset dsnInfo.originaldsn = "test">
<cfset dsnInfo.UseTrustedConnection = "true">
<cfset dsnInfo.advancedmode = "false">


<!--- try to login to the administrator --->
<cftry>
<cfhttp url="/CFIDE/administrator/enter.cfm" method="post" resolveurl="no">
        <cfhttpparam type="formfield" name="cfadminPassword_required"
value="Password Required">
        <cfhttpparam type="formfield" name="cfadminPassword"
value="#loginPWD#">
        <cfhttpparam type="formfield" name="requestedURL"
value="/CFIDE/administrator/index.cfm">
        <cfhttpparam type="formfield" name="submit" value="Login">
</cfhttp>
<B>login to the administrator: sucess</B>
<cfcatch type="Any"><B>try to login to the administrator:
FAILED</B></cfcatch>
</cftry>

<cfoutput><p>cfhttp.FileContent =
#htmlcodeformat(cfhttp.filecontent)#</p></cfoutput>

<!--- now submit the form values to the datasources page --->
<cftry>
<cfhttp
url="/CFIDE/administrator/datasources/#dsnInfo.dbtype#.cfm?dsn=#dsnInfo.dsn#
" method="post" resolveurl="no">
<!--- origional FORM url
<form name="editdsn"
action="/CFIDE/administrator/datasources/msaccess.cfm?dsn=test"
method="post">
 --->
        <cfhttpparam type="formfield" name="class" value="#dsnInfo.class#">
        <cfhttpparam type="formfield" name="driver"
value="#dsnInfo.driver#">
        <cfhttpparam type="formfield" name="host" value="#dsnInfo.host#">
        <cfhttpparam type="formfield" name="port" value="#dsnInfo.port#">
        <cfhttpparam type="formfield" name="epassword"
value="#dsnInfo.epassword#">
        <cfhttpparam type="formfield" name="databaseFile"
value="#dsnInfo.databaseFile#">
        <cfhttpparam type="formfield" name="systemDatabaseFile"
value="#dsnInfo.systemDatabaseFile#">
        <cfhttpparam type="formfield" name="dsn" value="#dsnInfo.dsn#">
        <cfhttpparam type="formfield" name="originaldsn"
value="#dsnInfo.originaldsn#">
        <cfhttpparam type="formfield" name="UseTrustedConnection"
value="#dsnInfo.UseTrustedConnection#">
        <cfhttpparam type="formfield" name="description"
value="#dsnInfo.description#">
        <cfhttpparam type="formfield" name="advancedmode"
value="#dsnInfo.advancedmode#">
        <cfhttpparam type="formfield" name="adminsubmit" value="Submit">
</cfhttp>
<B>accessing the datasources page: SUCESS</B>
<cfcatch type="Any"><B>trying the datasources page: FAILED</B></cfcatch>
</cftry>

<cfoutput><p>cfhttp.FileContent = #htmlcodeformat(cfhttp.filecontent)#</p>
<p>cfhttp.MIMEType = #cfhttp.MIMEType#</p></cfoutput>

<!--- debug: --->
<cfdump var="#cgi#">
<cfdump var="#cookie#">

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/




---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to