Problem with Getting started with the client side programming model for portlets

The WebSPhere Portal Server 6.1 Infocenter provides this sample code for making an XMLHttpRequest method call

<%@ taglib uri="" prefix="portlet-client-model" %>
<portlet-client-model:require module="ibm.portal.xml.*"/>
<portlet-client-model:require module="ibm.portal.portlet.*"/>
var <%=namespace%>_portletWindow = new ibm.portal.portlet.PortletWindow("<%=portletWindowID%>");

function sendXPR( /*string*/url, /*Function*/callback, /*String*/errMsg ) {
var xpr = <%=namespace%>_portletWindow.newXMLPortletRequest();
var me = this;
xpr.onreadystatechange = function () {
if ( xpr.readyState == 4 ) {
if ( xpr.status == 200 ) {
callback( xpr.responseText );
else {
<%=namespace%>_portletWindow.logError(“The request failed!”, errMsg );

}; "GET", url );
xpr.send( null );

I tried this to make AJAX call to my Portlet and my serveResources() method looks like this

public void serveResource(ResourceRequest request, ResourceResponse response)
throws PortletException, IOException {
System.out.println("XHRSamplePortlet.serveResource() method is called");
response.getWriter().println("This text is returned by XHRSamplePortlet.serveResource()");

The serveResource() method gets called on the servlet but i never get a callback. On debugging i was able to find this in portlet.js
"The XMLPortletRequest will only work for URLs which point to the portlet fragment feed."
From the code it looks like as soon as it gets response the ibm.portal.portlet.XMLPortletRequest is trying to parse it as ATOM feed and since i am returning simple text it does not like that. But it does not throw an error.