Archive for December, 2009

What a Year

December 22, 2009

Our existing website was about 5 years old. After 5 years and uncounted utterances of  “Hey! We have a great new product that needs exclusive top billing on our website!” our web presence was… a bit busy.

We took our time, did our homework, researched, discussed, and planned a long project. In March, Right after we started into what became thousands of man hours, we had ANOTHER cool idea. Right in the middle of a season of economic uncertainty Dave led the team to do an event giving reasons to be hopeful. In early March we had a full workload and an unrelated idea. 2 months later on April 23rd, we had a fully functional website serving 1,000,000 people watching streamed video at 6,000 volunteer locations.

Of course that means that we pushed back launching the main site… right? Well,  no.  Did we work a ton of overtime? Well, we did some but it wasn’t 2 months worth. The new website is now up at www.daveramsey.com, and the side idea is up at www.townhallforhope.com.

I love that we did all of it without staying at the office so much that we forgot who our kids are. It’s been a great year. I’m excited to see what comes next!

Omniture Web Services API Code For ColdFusion

December 10, 2009

We’ve been working on a ColdFusion application that uses the Omniture Web Services API. Omniture’s documentation is pretty light in this area, and the examples were not very applicable to ColdFusion. After pulling together several different blogs, docs, and some trial & error, I have created the following incantation. Hopefully it’ll save another Omniture/ColdFusion user a few minutes.

<cfsilent>
    <cffunction name="getOmnitureWsseRequestHeader" access="private" returntype="Any" output="false"
                hint="Return the header needed to make an Omniture web service request as a SOAPHeaderElement object">
        <cfargument name="strUsername" type="String" required="true" />
        <cfargument name="strSecret" type="String" required="true" />
        <cfscript>
            // Unique random number
            var strNonce = createUUID();
            // Date created in Omniture's required format
            var strCreated  = DateFormat(Now(),'YYYY-mm-dd H:mm:ss');
            // Password encoded according to Omniture's requirements
            var strPassword = ToBase64(Hash("#strNonce##strCreated##arguments.strSecret#", 'SHA').toLowerCase());
            // Start to build header
            var objHeader = CreateObject("java", "org.apache.axis.message.SOAPHeaderElement");
            var nodeUserToken = "";
            var nodePassword = "";
            // Construct XML structure with code
            objHeader.init("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "wsse:Security");
            objHeader.setMustUnderstand(1);
            objHeader.setActor("");
            nodeUserToken = objHeader.addChildElement("wsse:UsernameToken");
            nodeUserToken.setAttribute("wsu:Id", "User");
            nodeUserToken.addChildElement("wsse:Username").setValue(arguments.strUsername);
            nodePassword = nodeUserToken.addChildElement("wsse:Password");
            nodePassword.setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0##PasswordDigest");
            nodePassword.setValue(strPassword);
            nodeUserToken.addChildElement("wsse:Nonce").setValue(strNonce);
            nodeUserToken.addChildElement("wsu:Created").setValue(strCreated);
        </cfscript>
        <cfreturn objHeader />
    </cffunction>

    <cfscript>
        objHeader = getOmnitureWsseRequestHeader("your-username", "your-secret-code");
        objService = CreateObject("webservice", "your-omniture-wsdl-file-url");
        objService.setHeader(objHeader);
    </cfscript>

</cfsilent>

<cfoutput>
<p>objService.companyGetTokenCount(): #objService.companyGetTokenCount()#</p>
</cfoutput>

To use this test code, do the following:

  1. Copy the code to a .cfm file
  2. Replace “your-username” and “your-secret-code” with your Omniture web service user name & shared secret code
  3. Replace”your-omniture-wsdl-file-url” with the URL to your .wsdl file
  4. Run it — it should work!

Don’t forget to use cfdump on the objService variable to see all of the methods you can call with the API!