There are couple of issues here which i was able to find out.
1: We should not use web port which we use to access the web UI. I was using that initially so it was not working. 2: All requests should go to Name node and not anything else. 3: By replacing localhost:9000 in the above request, it started working fine.
One more question I have based on this is that how can I make it to work for domain rather than using for localhost and port. May be the answer to that is you need to change that in core-site.xml file and specify the proper web address rather than localhost there?