I would do that thru the REST protocol, much more elegant.
Take a look here: http://blog.thiseldo.co.uk/?p=599