This is exactly, including using URL class, how I do it in an YCTV widget that has made it most of the way through the Yahoo! QA process. However, if you are creating new server side code it is much better to return JSON than XML. The TV's parse JSON much more quickly than XML and I've seen hints of bugs in the XML parsing.