fedex rates

View: New views
4 Messages — Rating Filter:   Alert me  

fedex rates

by Chad Gray-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I am using some code I got from this web site (not sure who the author is) to tap into FedEx's rate API.
http://cfsearching.blogspot.com/2007/12/how-heck-do-you-use-fedex-rate-web.html 


If I try to put a CF variable in the second line below it errors out.  If I put a 1 or 2 in there statically it works fine.  The list has one entry in it so the list is fine.

<cfset objNonNegInteger = createObject("java", "org.apache.axis.types.NonNegativeInteger") />

<cfset data.requestedShipment.packageCount = objNonNegInteger.init("#listLen(attributes.PkgWeights)#")>


Here is the error:
Unable to find a constructor for class org.apache.axis.types.NonNegativeInteger that accepts parameters of type ( java.lang.Integer ).


Is CF processing the objNonNegInteger function before it processes the ListLen() function?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324091
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: fedex rates

by cfSearching :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> Unable to find a constructor for class org.apache.axis.types.
> NonNegativeInteger that accepts parameters of type ( java.lang.Integer
> ).


NonNegativeInteger is expecting a string (ie java.lang.String).  Apparently listLen(..) returns a java.lang.Integer:

<cfoutput>
ListLen() object type = #listLen(attributes.PkgWeights).getClass().name#
</cfoutput>

So you must convert that value to a "string" first:

<cfset attributes.PkgWeights = "1,2">
<cfset objNonNegInteger = createObject("java", "org.apache.axis.types.NonNegativeInteger") />
<cfset result = objNonNegInteger.init( javacast("string", listLen(attributes.PkgWeights) ) )>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324092
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

RE: fedex rates

by Chad Gray-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


DOH... needed JavaCast().  

Nevermind.


> -----Original Message-----
> From: Chad Gray [mailto:cgray@...]
> Sent: Tuesday, June 30, 2009 4:40 PM
> To: cf-talk
> Subject: fedex rates
>
>
> I am using some code I got from this web site (not sure who the author is)
> to tap into FedEx's rate API.
> http://cfsearching.blogspot.com/2007/12/how-heck-do-you-use-fedex-rate-
> web.html
>
>
> If I try to put a CF variable in the second line below it errors out.  If
> I put a 1 or 2 in there statically it works fine.  The list has one entry
> in it so the list is fine.
>
> <cfset objNonNegInteger = createObject("java",
> "org.apache.axis.types.NonNegativeInteger") />
>
> <cfset data.requestedShipment.packageCount =
> objNonNegInteger.init("#listLen(attributes.PkgWeights)#")>
>
>
> Here is the error:
> Unable to find a constructor for class
> org.apache.axis.types.NonNegativeInteger that accepts parameters of type (
> java.lang.Integer ).
>
>
> Is CF processing the objNonNegInteger function before it processes the
> ListLen() function?
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324093
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: fedex rates

by Matthew Williams-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


You could also try this CFC... http://code.google.com/p/cffedexrates/.  
I've tested it as of last night, and it works fine.


Matthew Williams
Geodesic GraFX
www.geodesicgrafx.com/blog

Chad Gray wrote:

> I am using some code I got from this web site (not sure who the author is) to tap into FedEx's rate API.
> http://cfsearching.blogspot.com/2007/12/how-heck-do-you-use-fedex-rate-web.html 
>
>
> If I try to put a CF variable in the second line below it errors out.  If I put a 1 or 2 in there statically it works fine.  The list has one entry in it so the list is fine.
>
> <cfset objNonNegInteger = createObject("java", "org.apache.axis.types.NonNegativeInteger") />
>
> <cfset data.requestedShipment.packageCount = objNonNegInteger.init("#listLen(attributes.PkgWeights)#")>
>
>
> Here is the error:
> Unable to find a constructor for class org.apache.axis.types.NonNegativeInteger that accepts parameters of type ( java.lang.Integer ).
>
>
> Is CF processing the objNonNegInteger function before it processes the ListLen() function?
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324345
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4