Posted At : Aug 31, 2010 12:02 PM | Posted By : Ed Tabara
Related Categories: ColdFusion, Amazon

There are many ways SubmitFeed method can be used. Bellow is how i used it for price update:
<cfset signStr2 = "Action=SubmitFeed&FeedType=_POST_PRODUCT_PRICING_DATA_">
<cfsavecontent variable="prodXML"><?xml version="1.0" encoding="iso-8859-1" ?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>#this.merchantID#</MerchantIdentifier>
</Header>
<MessageType>Price</MessageType>
<Message>
<MessageID>1</MessageID>
<Price>
<SKU>#arguments.sku#</SKU>
<StandardPrice currency="USD">#NumberFormat(arguments.price, "_.__")#</StandardPrice>
</Price>
</Message>
</AmazonEnvelope>
</cfsavecontent>
<cfset var gn = GenerateSignedAmazonURL('POST', 'mws.amazonservices.com', '/', signStr2)>
<cfhttp url="#gn#" method="post" useragent="1SmartSolution MWS Component/1.0 (Language=ColdFusion; Platform=Windows/2003)">
<cfhttpparam name="Content-Type" type="header" value="text/xml; charset=iso-8859-1">
<cfhttpparam name="FeedContent" type="body" value="#prodXML#">
<cfhttpparam type="header" name="Content-MD5" value="#ToBase64(BinaryDecode(Hash(prodXML), 'hex'))#">
</cfhttp>
Hope it helps.

Comments Comments (3) | Print Print | Email Send | 292 Views | 1% / 18% Popularity


Posted At : Aug 25, 2010 22:34 PM | Posted By : Ed Tabara
Related Categories: ColdFusion, Amazon

In my previous post about Amazon MWS folrot to mention that before URL generation the following strig should be created:
<cfset signStr2 = "Action=SubmitFeed&FeedType=_POST_PRODUCT_PRICING_DATA_">
Where Actionis set to the needed method and is followed by any other required parameters as being FeedTypefor SubmitFeedmethod.

Comments Comments (0) | Print Print | Email Send | 278 Views | 1% / 0% Popularity


Posted At : Aug 25, 2010 18:50 PM | Posted By : Ed Tabara
Related Categories: ColdFusion, Amazon

There seem to be interest in Amazon MWS and because mostly their customer service is awe-full as well as the documentation, it's a real challenge when it comes to implement it.
First things you are going to need when dealing with MWS is signature generation. Bellow are the functions i use for it:
<cffunction name="HMAC_SHA256" returntype="binary" access="public" output="false">
<cfargument name="signMessage" type="string" required="true">
<cfset var jMsg = JavaCast("string", arguments.signMessage).getBytes("UTF-8")>
<cfset var jKey = JavaCast("string", this.theSecretAccessKey).getBytes("UTF-8")>
<cfset var key = createObject("java", "javax.crypto.spec.SecretKeySpec")>
<cfset var mac = createObject("java", "javax.crypto.Mac")/>
<cfset key = key.init(jKey, "HmacSHA256")>
<cfset mac = mac.getInstance(key.getAlgorithm())>
<cfset mac.init(key)>
<cfset mac.update(jMsg)>
<cfreturn mac.doFinal()>
</cffunction>
<cffunction name="GenerateSignedAmazonURL" returnType="string" output="yes">
<cfargument name="HTTPVerb" required="yes">
<cfargument name="HostHeader" type="string" required="yes">
<cfargument name="HTTPRequestURI" type="string" required="yes">
<cfargument name="RawQueryString" type="string" required="yes">
<cfset var signature = "">
<cfset var encodedQueryString = "">
<cfset var sortedQueryString = "">
<cfset var encodedSignature = "">
<cfset var name = "">
<cfset var value = "">
<cfset var i = "">
<!--- get your timestamp--->
<cfset var thenow = DateConvert("local2Utc", Now())>
<cfset var time_stamp = "#DateFormat(thenow,'yyyy-mm-dd')#T#TimeFormat(thenow,'HH:mm:ss')#.00Z">
<!--- append timestamp to query string --->
<cfset arguments.RawQueryString = arguments.RawQueryString & "&Marketplace=#this.marketplaceID#">
<cfset arguments.RawQueryString = arguments.RawQueryString & "&Merchant=#this.merchantID#">
<cfset arguments.RawQueryString = arguments.RawQueryString & "&SignatureMethod=HmacSHA256">
<cfset arguments.RawQueryString = arguments.RawQueryString & "&SignatureVersion=2">
<cfset arguments.RawQueryString = arguments.RawQueryString & "&Timestamp=#time_stamp#">
<cfset arguments.RawQueryString = arguments.RawQueryString & "&Version=2009-01-01">
<!--- start building signature --->
<cfset signature = arguments.HTTPVerb & Chr(10)>
<cfset signature = signature & LCase(arguments.HostHeader) & Chr(10)>
<cfset signature = signature & arguments.HTTPRequestURI & Chr(10)>
<!--- loop over the list and urlEncode each value --->
<cfloop list="#arguments.RawQuerySTring#" delimiters="&" index="i">
<cfset name = ListGetAt(i, 1, "=")>
<cfset value = "">
<!--- if this item has a value encode it --->
<cfif ListLen(i, "=") gt 1>
<cfset value = Replace(Replace(Replace(ListGetAt(i, 2, "="), ",", "%2C", "ALL"), ":", "%3A", "ALL"), " ", "%20", "ALL")>
</cfif>
<!--- build the new query string with encoded values --->
<cfset encodedQueryString = ListAppend(encodedQueryString, "#name#=#value#", "&")>
</cfloop>
<!--- next we need to canonically order the queryString params --->
<cfset sortedQueryString = ListSort(encodedQueryString, "textnocase", "asc", "&")>
<!--- append to the signature --->
<cfset signature = signature & "AWSAccessKeyId=#this.accessKeyId#&" & sortedQueryString>
<!--- encode the signature --->
<cfset encodedSignature = URLEncodedFormat(ToBase64(HMAC_SHA256(signature)))/>
<cfreturn "https://#arguments.HostHeader##arguments.HTTPRequestURI#?AWSAccessKeyId=#this.accessKeyId#&#sortedQueryString#&Signature=#encodedSignature#">
</cffunction>

The original version of GenerateSignedAmazonURLi found somewhere time ago when working with AWS and i think i slightly changed it.
The call would be like this:
<cfset generatedURL = GenerateSignedAmazonURL('POST', 'mws.amazonservices.com', '/', signStr2)>
A thing to note:POSTin generatedURL should go with POSTtype CFHTTPsand use GETin generatedURL for GETtype CFHTTPs.

Comments Comments (2) | Print Print | Email Send | 314 Views | 1% / 12% Popularity


Posted At : Jul 28, 2010 16:56 PM | Posted By : Ed Tabara
Related Categories: ColdFusion, Amazon

If you are trying to work with Amazon MWS and are getting errors about SignatureDoesNotMatchand The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details., check if in the query string you are trying to sign, the AWSAccessKeyIdparameter goes before ACTION!

I had some headache with it lately, so hope this post will help someone else.

Comments Comments (0) | Print Print | Email Send | 561 Views | 3% / 0% Popularity


Posted At : Jul 14, 2010 18:30 PM | Posted By : Ed Tabara
Related Categories: ColdFusion

No idea if it happened only to me, but installation for ColdFusion 9 Update 1 was the worst from any ColdFusion related installations i did in over 10 years.
First, right after i installed it, i started to get "The DataSource service is not available" errors when trying to load ColdFusion Admin and if trying to open one of the sites, was getting errors about related Datasource not existing. I tried starting/stopping/restarting services. I tried to check the size of "neo-*.xml" files. I tried to restart the server itself. I tried anything that came in my mind at that moment, but NOTHING helped.
Then i tried to reinstall this Update. (yes, without to taking down the previous try). Weird, but that error went away. And i was able to get into ColdFusion Administrator without problems. But started to get other errors when trying to load a site on the server: "The tag handler query does not have a setter for the attribute ormOptions specified in the Tag Library Descriptor" and it was pointing to lines where CreateObject being used first time. And again, i wasn't able to find a solution to it.
Then i found this link and used the process described there as "Uninstall Update 1 from a ColdFusion 9 server configuration on Windows". And yes, did try to restart services AND the server itself, but again without any success.
So, after pulling off my hair for some time, i just uninstalled ColdFusion and installed it from scratch but this time without the Update.

It was far from being my first ColdFusion related installation, but it was indeed a total nightmare.

Comments Comments (14) | Print Print | Email Send | 982 Views | 5% / 82% Popularity


Posted At : Jul 13, 2010 21:58 PM | Posted By : Ed Tabara
Related Categories: ColdFusion

Below is provided a summary of the new and changed features in ColdFusion 9 Update 1.

Area

What?s new and changed

Language

Support for the following:

  • for-in construct (for arrays) in CFScript
  • var declaration within for loop in CFScript
  • Function argument metadata
  • Function equivalents for cfile action="upload" (FileUpload) and cffile action="uploadall" (FileUploadAll)

The following script functions have been implemented as CFCs:

  • dbinfo
  • imap
  • pop
  • ldap
  • feed

Caching

The following enhancements:

  • New function cacheGetSession
  • New parameter template in the function cacheGetMetadata.
  • cacheGetProperties and cacheSetProperties support diskSpoolBufferSizeMB, clearOnFlush, and diskExpiryThreadIntervalSeconds
  • Using user-defined caching regions in all cache functions except cacheGetProperties and cacheSetProperties

IIS 7

IIS 7 configuration for ColdFusion has no dependency on IIS 6 Metabase compatibility.

Ajax

The following enhancements:

  • Support for CFCs outside webroot
  • ColdFusion.FileUpload.getselectedfiles returns the status of upload operation
  • While using cffileupload, the url attribute is now optional and it defaults to cgi.script_name
  • Support for selecting multiple rows in cfgrid
  • Support for turning on/off grid column headers
  • New attribute autoExpand in cfgridcolumn
  • Supports mask attribute for HTML grids
  • The fileupload control now passes session information implicitly to the target page if session management is turned on either in Application.cfc or Application.cfm.

Added the following JavaScript Functions:

  • ColdFusion.Autosuggest.getAutosuggestObject,
  • ColdFusion.Layout.disableSourceBind
  • ColdFusion.Layout.enableSourceBind
  • Coldfusion.fileUpload.setUrl
  • ColdFusion.grid.getSelectedRows
  • ColdFusion.Map.show
  • ColdFusion.Map.hide
  • ColdFusion.Map.refresh
  • ColdFusion.Grid.getTopToolbar
  • ColdFusion.Grid.getBottomToolbar
  • ColdFusion.Grid.showTopToolbar
  • ColdFusion.Grid.hideTopToolbar
  • ColdFusion.Grid.showBottomToolbar
  • ColdFusion.Grid.hideBottomToolbar
  • ColdFusion.Grid.refreshTopToolbar
  • ColdFusion.Grid.refreshBottomToolbar

ORM

You can use multiple data sources for ORM in ColdFusion applications.

Also, the following enhancements:

  • New attribute MappedSuperClass added to cfcomponent/component.
  • New attributes skipCFCWithError and automanagesession added to the ormsettings struct in the THIS scope of Application.cfc.
  • Attribute missingrowignored in cfproperty now supports one-to-one relationship.
  • The function EntityNew takes the property values as struct in a second argument.

Amazon S3 Support

ColdFusion customers can now store data in Amazon S3.

SpreadSheet

Support for the following:

  • New functions SpreadsheetRemoveSheet and SpreadsheetFormatCellRange
  • New attribute excludeHeaderRow in cfspreadsheet
  • Performance improvements for formatting huge number of rows and columns using the SpreadSheet format functions.
  • Preformatting of a cell while you use SpreadSheetformatcell or SpreadSheetformatcellrange
  • Vertical alignment in format struct using the key verticalalignment.

AIR integration

The following enhancements:

  • Support for auto-generating primary keys
  • Support for encrypted database (introduced in AIR 1.5).
  • Cache file used by ActionScript ORM to track the operations on SQLite database is now in the applicationStoragedirectory instead of applicationDirectory. You can specify the location of the cahceDirectory in openSession API on syncmanager.
  • Self Join relationships for one-to-one, one-to-many and many-to-many database relationships.
  • Supports both Array and ArrayCollection for use in ActionScript Entity to represent a collection in a database relationship.
  • ActionScript ORM logs all the SQL statements that ORM uses to persist entities into the SQLite database.
  • New APIs keepClientObject and keepAllClientObjects to ensure that the server updates are not retained when ColdFusion server raises conflict.
  • The class SessionToken is dynamic and therefore, data can be stored on the token returned from the ORM APIs.
  • Supports autocommit mode

Flash Remoting

A channel-definition construct has been introduced in services-config.xml (CF_root/wwroot/WEB-INF/flex/) named serialize-array-to-arraycollection.

BlazeDS 4 and LCDS

Support for the following:

  • LCDS 3 and LCDS 3.1
  • BlazeDS 4.
  • New methods allowSend and allowSubscribe in ColdFusion Messaging Gateway CFCs.

Solr

Apart from overall improvement in the accuracy of indexing, the following enhancements:

  • Displays correct MIME types for all documents
  • Enhanced support for indexing of metadata for binary files
  • Support for the attribute previousCriteria (in the tag cfsearch)
  • Both the tags cfindex and cfsearch support the attribute categoryTree.
  • Option to enable/disable term highlighting for entire document

Logging

The following enhancements:

  • ColdFusion generates log files for the following services: http, ftp, web service, Portlet, Derby, and Feed
  • Enable/Disable logging: A new icon has been added in the Actions column of the Log Files page (ColdFusion Administrator > Debugging & Logging).
  • Support for automatic logging of scheduled tasks.

Server Monitoring

Enhancements in this release help you use Server Monitoring effectively in load conditions.

ColdFusion Administrator has the following monitoring options: Enable monitoring, Enable profiling, and Enable memory tracking.

Configurable seed for password encryption

Option to specify a new seed value to encrypt data source passwords

OEM upgrades

The following versions are supported:

  • Microsoft .NET Framework 4
  • Ehcache 2.0
  • Hibernate 3.5.2
  • ExtJS 3.1
  • Solr 1.4
  • DataDirect Connect for JDBC 4.1
  • MySQL 5.1.11

Other enhancements

  • Application.cfc lets you specify data source authentication details in the attribute datasource.
  • Support for HQL in cfquery
  • New actions for cfpdf AIR Proxy
  • The ActionScript proxy class for PDF service has the following new attributes: extracttext and extractimage
  • CFID, CFTOKEN, and jsessionid are marked httpOnly

Comments Comments (0) | Print Print | Email Send | 615 Views | 3% / 0% Popularity


Posted At : Jun 21, 2010 12:27 PM | Posted By : Ed Tabara
Related Categories: ColdFusion, My Projects

Well... it's not a real heat-map, but rather is a way to see the concentration of available jobs. So it could help someone who is willing to relocate and is looking for the right region. But it also can help those who just want to see jobs in their own region.
Anyway, enough talking. For those interested, here is the link. Note that this is also available now through the JOBS HEAT MAPtop menu link.

Comments Comments (0) | Print Print | Email Send | 573 Views | 3% / 0% Popularity