The problem with me is that when I downloaded and ran the same code on my machine, it worked. But when I modified and integrated it into my application, it was unable to access sampleserver3 through my proxy file. I am using proxy.jsp (latest version) that I downloaded from the arcgis resources. I have already added the service url to my proxy page.