Avatar of digitalwise
digitalwise
 asked on

cfscript and cfc not working

I have a line

variables.usps = New usps(isProduction=true, isSecure=false, uspsUserID=variables.uspsUserID);

variables.RateV4 = variables.usps.RateV4(
	Service = 'FIRST CLASS',
	FirstClassMailType = 'PARCEL',
	ZipOrigination = '99212',
	ZipDestination = '22193',
	SIZE = 'REGULAR',
	Pounds = '0',
	Ounces = '3.5'

Open in new window


that works just fine in development (which is CF9) but when I load this to live it doesn't work (which is CF8).    Why doesn't that work on CF8??
ColdFusion Language

Avatar of undefined
Last Comment
_agx_

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
_agx_

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Randy Johnson

Any error messages you can share?
digitalwise

ASKER
As usual - thanks for the help!   Wandering between CF10 and this old CF8 site is a huge pain!    Completely missed it.   Now the problem is the CFC was written for CF9 so I have to fix that stuff too!
_agx_

I hear you! I really wish they would make older versions available for developers, so they don't have to depend on the "publish-it-and-hope-it-doesn't-break" method ;-)
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Randy Johnson

Here is an unofficial repo containing all the old cf installer downloads.

http://www.gpickin.com/cfrepo/
digitalwise

ASKER
So I am working through this mess and getting the error:  Variable SETURLTEST is undefined.

<cffunction name="init" access="public" returntype="USPS" output="false" hint="Initializes the USPS CFC">
		<cfargument name="isProduction" type="boolean" required="false" default="#getIsProduction()#">
		<cfargument name="isSecure" type="boolean" required="false" default="#getIsSecure()#">
		<cfargument name="uspsUserID" type="string" required="false" default="#getUspsUserID()#">
		<cfscript>
			// set constants (CF9 fix)
			setURLTEST("http://testing.shippingapis.com/ShippingAPITest.dll");
			setURLTESTSECURE("https://secure.shippingapis.com/ShippingAPITest.dll");
			setURLPROD("http://production.shippingapis.com/ShippingAPI.dll");
			setURLPRODSECURE("https://secure.shippingapis.com/ShippingAPI.dll");

			// set production and secure flags
			setIsProduction(arguments.isProduction);
			setIsSecure(arguments.isSecure);
			setUspsUserID(arguments.uspsUserID);

			// configure url based on flags
			if(getIsProduction()){
				if(getIsSecure()){
					setUrl(getURLPRODSECURE());
				}
				else{
					setUrl(getURLPROD());
				}
			}
			else{
				if(getIsSecure()){
					setUrl(getURLTESTSECURE());
				}
				else{
					setUrl(getURLTEST());
				}
			}

			return this;
		</cfscript>
	</cffunction>

Open in new window

_agx_

Which line is throwing the error? I don't see anything that looks CF9 specific, so I'm guessing the problem is in one of the functions.  Any chance this CFC is public btw - so I could look a the whole thing?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
digitalwise

ASKER
_agx_

<cfproperty name="isProduction" type="boolean">
<cfproperty name="isSecure" type="boolean">
<cfproperty name="uspsUserID" type="string">
<cfproperty name="url" type="string">
<cfproperty name="URLTEST" type="string">
<cfproperty name="URLTESTSECURE" type="string">
<cfproperty name="URLPROD" type="string">
<cfproperty name="URLPRODSECURE" type="string">

Open in new window


Hm... I wonder if it's cfproperty stuff.  I know in later versions it creates the setters/getters automatically. I don't remember how it behaved in CF8.

Edit: Yeah, that's the problem. You'll have to create the getters/setters manually.
_agx_

Edit: Yeah, that's the problem. In CF9+ cfproperty creates the getter/setter's automatically. Not so much in CF8 :/. You have to create those methods manually.

<cffunction name="setURLTEST" access="public" returntype="void">
    <cfargument name="value" type="String" required="true">
    <cfset variables.URLTEST = arguments.value />
</cffunction>
...

Open in new window

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck