Solved

cfhttp error

Posted on 2004-09-10
6
3,121 Views
Last Modified: 2013-12-24
I'm trying to pass some values to a secure site, but i'm getting an error,
here is the http tag
<cfhttp  name="redirect" redirect="yes"  url="https://www2.2checkout.com/2co/buyer/purchase" method="post" resolveurl="yes" >
                                          <cfhttpparam name="sid" type="formfield" value="3423432">
                                          <cfhttpparam name="total" type="formfield" value="#Total1[4]#">
                                          <cfhttpparam name="cart_order_id" type="formfield" value="#invoicenumber.Invoice# ">
                                          <cfhttpparam name="demo" type="formfield" value="Y">
                                    </cfhttp>  

and here is the error
Column names must be valid variable names. They must start with a letter and can only include letters, numbers, and underscores.
any ideas?
0
Comment
Question by:MMsabry
  • 4
  • 2
6 Comments
 
LVL 9

Expert Comment

by:Jerry_Pang
ID: 12032485
You need to specify the 'column' attribute.

[quote]
columns
 First row of response contains column names.
 The column names for the query, separated by commas. Column names must start with a letter. The remaining characters can be letters, numbers, or underscores (_).
...
If the number of columns specified by this attribute does not equal the number of columns in the HTTP response body, ColdFusion generates an error.
[\quote]

Since you're specifying a "name" attribute, you're trying to return a query... but since you don't specify column names in a "columns" attribute, you're telling CFHTTP that the first row of the returned query (dataset) will contain the column names.

http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-p58.htm
0
 

Author Comment

by:MMsabry
ID: 12033715
can you give me an example?
0
 
LVL 9

Expert Comment

by:Jerry_Pang
ID: 12040620
try removing the
< name="redirect" >

try this

<cfhttp  redirect="yes"  url="https://www2.2checkout.com/2co/buyer/purchase" method="post" resolveurl="yes" >
                                   <cfhttpparam name="sid" type="formfield" value="3423432">
                                   <cfhttpparam name="total" type="formfield" value="#Total1[4]#">
                                   <cfhttpparam name="cart_order_id" type="formfield" value="#invoicenumber.Invoice# ">
                                   <cfhttpparam name="demo" type="formfield" value="Y">
                              </cfhttp>  

if you specify the column attribute, try
columnnames = columns of the queries

cfhttp  name="redirect" column = "columnname1,columnname2" redirect="yes"  url="https://www2.2checkout.com/2co/buyer/purchase" method="post" resolveurl="yes" >
                                   <cfhttpparam name="sid" type="formfield" value="3423432">
                                   <cfhttpparam name="total" type="formfield" value="#Total1[4]#">
                                   <cfhttpparam name="cart_order_id" type="formfield" value="#invoicenumber.Invoice# ">
                                   <cfhttpparam name="demo" type="formfield" value="Y">
                              </cfhttp>  

the site i gave has more examples, discussions and issues about cfthttp.
http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-p58.htm

this site, has examples about POST method of cfthhp
http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/remotes6.htm
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 9

Expert Comment

by:Jerry_Pang
ID: 12040697
the site i gave has trouble using https with cfhttp

"I'm finding that for most of our internal SSL sites I need to manually import
each web servers SSL certificate into the keystore for the JRE used by CFMX
in order to enable HTTPS communication either by CFHTTP of CFLDAP"

read more for recommendation..
http://www.houseoffusion.com/cf_lists/index.cfm/method=messages&threadid=13865&forumid=4%3E%20&threadid=13865&forumid=4&threadid=13865&forumid=4

anyways, i found your other question post about https and redirection.
from the documentation, if you read the comments and post in
http://.....tags-p58.htm, it very similar to you problems about https,redirection and your post about columnnames.
0
 

Author Comment

by:MMsabry
ID: 12042235
Jerry_Pang,
both of the last links i could not access,
0
 
LVL 9

Accepted Solution

by:
Jerry_Pang earned 500 total points
ID: 12050999
i will post it below


***********************
*about HTTPS and cfhttp
***********************
[quote]
farDesi said on Mar 23, 2004 at 3:29 PM :
If you can't get https working with cfhttp then take a look at

http://www.houseoffusion.com/cf_lists/index.cfm/method=messages&threadid=13865&forumid=4%3E%20&threadid=13865&forumid=4&threadid=13865&forumid=4 

Author: Stacy Young
Short Link: http://www.houseoffusion.com/lists.cfm/link=m:4:13865:72003

This may or may not be in the docs but I haven't seen any references to it
yet aside from a technote concerning CFLDAP and SSL communication. I'm
finding that for most of our internal SSL sites I need to manually import
each web servers SSL certificate into the keystore for the JRE used by CFMX
in order to enable HTTPS communication either by CFHTTP of CFLDAP. I think
this needs to be highlighted *somewhere* because with CF5 this was not the
case...this had me believing there was a bug in CFMX throughout the entire
beta testing cycle and has caused me to waste countless hours !!!  :-(

Here's what to do if you're having SSL com problems:

*  Goto a page on the SSL server in question
*  Double click on the lock icon
*  Goto details tab
*  Click on COPY TO FILE
*  Choose base64 option and save the file
*  Copy the CER file into  C:\CFusionMX\runtime\jre\lib\security  (or
whichever JRE CFMX is using)
*  Run this commandline in that same directory (keytool.exe is located
in C:\CFusionMX\runtime\jre\bin)

keytool -import -keystore cacerts -alias giveUniqueName -file filename.cer

*  Default password is "changeit" or "change it"
*  Upon successful import restart CFMX and now CFHTTP and CFLDAP over
SSL will work with that particular site


Stacy Young

System Integration Specialist, Architecture

[\quote]


***********************
*about redirection
***********************
[quote]
csteinola said on Sep 24, 2003 at 11:41 AM :
I've never been able to get redirect to behave as expected.

Posting page:
<html>
<head>
<title>Untitled</title>
</head>

<body>
Here I am on the posting page<br />
<CFHTTP url="http://localhost/form_ok.cfm" method="POST" resolveurl="yes" throwonerror="yes" redirect="yes">
<CFHTTPPARAM type="HEADER" name="User-Agent" value="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)">
<CFHTTPPARAM type="HEADER" name="Connection" value="Keep-Alive">
<CFHTTPPARAM type="HEADER" name="Cache-Control" value="no-cache">
<CFHTTPPARAM type="FORMFIELD" name="test1" value="Hello">
<CFHTTPPARAM type="FORMFIELD" name="test2" value="World">
</CFHTTP>
</body>
</html>

form_ok.cfm page:
<html>
<head>
<title>Untitled</title>
<CFHEADER name="Location" value="http://localhost/form_ok.cfm">
</head>

<body>
Here I am on the ok page<br />
<CFDUMP var="#FORM#">
</body>
</html>

I would expect that the CFHTTP would follow the redirect="yes" attribute, and, since the response header contains a Location field, the form_ok.cfm page should be displayed.
But it doesn't. All I ever see is "Here I am on the posting page". If I check CFHTTP.FileContents, the ok page is there. And if I check cfhttp.responseHeader, the Location field contains the URL to the ok page.

Has anybody gotten this to work?

  halL said on Sep 24, 2003 at 2:34 PM :
With respect to the redirect attribute:
When ColdFusion executes a page with a CFHTTP tag with redirect="Yes", and it receives a redirection message in response to the HTTP request, it sends a request to the redirection target and handles the response as if it had been the result of the original request.
Also, the page should state ColdFusion does the redirection only if it receives both a Location header AND a 300-series (redirection) status code.
The example from csteinola tries to use a cfheader tag to force a redirection, but this does not send a 300 status, and therefore does not force the redirection.
(The cflocation tag does generate an HTTP 302 resonse with the url attribute as the Location header value.)

[\quote]




***********************
about column names errors
***********************
[quote]
No screen name said on Jan 27, 2004 at 5:20 AM :
I buildt a customtag to check a forumusers posts and nick in a forum on cf 5.0
When executing the same cfhttp code in cfmx 6.1 (on linux)
I get this error:
"The column name "<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN>" is invalid.

Column names must be valid variable names. They must start with a letter and can only include letters, numbers, and underscores."

the code:
<cfparam name="request.userid" default="0" type="numeric">

<cfhttp url="http://server/index.php?showuser=#request.hw_no_id#" method="post" name="hGetHWInfo">
<cfhttpparam name="hardwaremember_id" type="cookie" value="value">
<cfhttpparam name="hardwarepass_hash" type="cookie" value="value">
</cfhttp>
No screen name said on Feb 20, 2004 at 3:21 PM :
<CFHTTP> Tag

I have a file that uses the <CFHTTP> tag and it work perfect in Cold Fusion 5.0 & 4.51. However using the same file in Cold Fusion MX 6.01 it does not respond the same way as it did in 5.0.

Any reason why this tag would work in Cold Fusion 5.0 or lower but not in MX 6.01?
csteinola said on Feb 24, 2004 at 11:19 AM :
> Any reason why this tag would work in Cold Fusion 5.0 or lower but not in MX 6.01?

Many reasons. Most of them involve bugs in 5.0 that let the CFHTTP tag work when it really shouldn't have.

Check out the "ColdFusion MX 6.1" and "ColdFusion MX" sections at the top of this page. That might provide clues.
csteinola said on Feb 24, 2004 at 11:10 AM :
[i]I get this error:
"The column name "<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN>" is invalid.

Column names must be valid variable names. They must start with a letter and can only include letters, numbers, and underscores."

the code:
<cfparam name="request.userid" default="0" type="numeric">

<cfhttp url="http://server/index.php?showuser=#request.hw_no_id#" method="post" name="hGetHWInfo"> .... [/i]

Since you're specifying a "name" attribute, you're trying to return a query... but since you don't specify column names in a "columns" attribute, you're telling CFHTTP that the first row of the returned query (dataset) will contain the column names.

In this case, it looks like your server/index.php file is returning a full HTML page, including DOCTYPE header, probably HTML, HEAD and BODY tags as well. For whatever reason, ColdFusion doesn't like the DOCTYPE header as a column name. But that's okay... because that's probably not what you intended anyway.

If you're truly trying to return a query, your server/index.php page should only return data... not any of the HTML tags.

And if you're not trying to return a query, then you shouldn't use the "name" attribute of CFHTTP.
[\quote]
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 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

24 Experts available now in Live!

Get 1:1 Help Now