Using a CFC with wirebox [CB 3.81]

Hey everyone,

I’m having a bit of a challenge calling a cfc that I thought I should/could wire up in wirebox.

This site is on an older version of CB 3.81 and the CFC is cffedexshipper. When I wire this up I get an error that It needs a license key which is provided by the cfarguments in the cfc. Normally that would be called:

<cfset fedexShipper = new FedexShipper(
	key = "AUTHENTICATION_KEY",
	password = "AUTHENTICATION_PASSWORD",
	accountNo = "ACCOUNT_NUMBER",
	meterNo = "METER_NUMBER",
	sandbox = true
) />

Is there a way to provide that to wirebox so that this can be used?

Thanks

Mallory,

You need to pass init arguments in to the getInstance() method:

wirebox.getInstance( name=”FedexShipper”, initArguments={…} );

Alternately, if this is a singleton, you can map it and the init arguments with the binder in your Wirebox config.

map( “FedexShipper” )

.to( “path.to.FedexShipper” )

.asSingleton()

.initArg( … )

.initArg( … )

.initArg( … )

.initArg( … )

.initArg( … );

Lastly, the “most Coldbox” way to do this would be to dispense of those as init arguments, altogether, and inject them from your settings file. Then use an onDIComplete() method to bring those settings in to the variables scope.

HTH,

Jon

Thanks Jon. I’ll look into the coldbox way first.

Really appreciate it