On the server I used for testing, in my bitcoin.conf:
walletnotify=/home/btcdev/walletnotify.sh %s
blocknotify=/home/btcdev/blocknotify.sh %s
The %s in the command line gets replaced with the (ASCII) hex string of the transaction hash, just like -blocknotify replaces it with the block hash.
And the program can be as simple or as complicated as you like. Here is a simple shell script:
#!/bin/bash
F=/home/btcdev/wallet_transaction_log
D=`date +"%Y%m%d%H%M%S"`
echo ${D} - ${1} >> ${F}
which gives lines like:
20130513123015 - 6fa6c8ff08f122327b7a0a329d7632f243038f0fc96cce1248cb4948d0509ecf
You aren't limited to shell scripts, of course.
A pipe would have been better, but they aren't portable. Even if we had been willing to limit it to just UNIX-ish systems, there would have been horrible locking problems, and these notices simply weren't worth the effort to work around them*. If you want similar behavior, you can fake a pipe with netcat, so that you could have a long running service that accepts TCP connections from localhost, and just call netcat to dump the txid to that socket.
*
Did you know that named pipes can stall in both directions, potentially DOSing one of the client threads? There are ways around it, of course, but you have to throw out a lot of the abstractions, so there would have been a very un-C++ chunk of code in the bitcoin client, just for dealing with the pipes. At least that was how it looked to me when I was researching it. I don't do much with C++, so I'm hoping that someone in the audience is more skilled than I am, and will read this and say "You dumbass, why didn't you just do X?", or even better, rewrite it for me. 
Hey, anybody else has issue in bitcoind with walletnotify that on first confirmation it shoots the curl twice immidiately and when checking the wallet_transaction_log file, there is also same txid written twice. so the issue is not in my built API server, but in bitcoind. any clues?