Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm programming an Android application that read an XML file that sits on my server. I'm using POST method in order to simply get the content of the XML (or any other file for that matter) using simple POST and RESPONSE methods.

// java code
HttpPost httpPost = new HttpPost(XML_FILE);
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();

it works fine on one of my linux servers but when I tried on my Windows 2003 IIS 6 server I get a

HTTP Error 405 - The HTTP verb used to access this page is not allowed.
Internet Information Services (IIS)

I tried to add

<protocols>
      <add name="HttpGet"/>
      <add name="HttpPost"/>
</protocols>

to my web.config file but the results are the same.

I think the problem is that POST methods are disabled by defualt by I cant figure out how to enable them. do you think thats really is my problem? if so, how to I enable it?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Generally this means that you are trying to POST to a page that only has a static handler (like a .html file).

You need to ensure that your ISAPI plugin for the language you're posting to (.net or php or whatever) needs to be set up correctly and enabled.

share|improve this answer
    
can you elaborate on this? where do I need to look exactly? and i'm posting directly to the xml file. –  Joe Dec 22 '11 at 7:27
    
@Joe - you can't post to an XML file, because IIS has no idea how to deal with that. An XML file is a static handler. You need to have something in the middle to do the translation from a web request to the XML file. As to how to do this, I'm afraid that's not something I can help with as it depends entirely on your programming language, and what you're trying to do. –  Mark Henderson Dec 22 '11 at 7:58
    
well.. it's not really the POST action it is more of the RESPONSE.. because if you post to a webpage (any web page) where it allows to receive post methods then you get the entire page in the RESPONSE. therefor you can post a blank post to an XML file and get it as is. just like you can view it on the browser.. –  Joe Dec 22 '11 at 8:10
    
Ohh ok I only just saw your code snippet at the top (not sure how I missed that?), you should just be using HTTP GET, because POST with a blank POST is much the same. Obviously the Linux server you were testing it against wasn't as strict about the verbs you can use –  Mark Henderson Dec 22 '11 at 8:22
    
at first I wasn't sure whether I should use get or post .. I figured it is more "standard" to use post since it seemed funny to me to use GET for an entire file.. do you think it is legit (using GET)? would I encounter any restriction or problems with it? –  Joe Dec 22 '11 at 8:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.