Why don't you try to implement some of the simple PHP peices of code available out there? https://en.bitcoin.it/wiki/PHP_developer_intro
Because I really dislike php/perl and this script is going to be included in a grails based application. Which means it needs to run on the jam. So groovy/scala/java it is. And there is sadly not a single fully documented java example on the bit coin site as far as I can see.
there is a complete Java bitcoin client here:
http://code.google.com/p/bitcoinj/
Possible you're using the wrong auth method in your code... but I'm totally unfamiliar with 'Groovy'.
Will