[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HTTP/1.1 405 Method not allowed



Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>

I get "HTTP/1.1 405 Method not allowed" when i try this (rpg code) on port 8080, but it works with Internet Explorer Url: http://demo.geomatikk.no:8080/SB1SF/servlet/GeoLocator2?PLACENAME=Nedreveien&HOUSENO=28&MUNICIPALITY=STAVANGER

Unless you put this URL in a <FORM METHOD=POST> HTML tag, Internet Explorer won't use the POST method. It'll use the GET method.


If you want to try to do the same thing in HTTPAPI, you also need to use the GET method. To do that, remove the "http_url_post_raw" from your code, and replace it with this:

      c                   eval       rc=http_url_get_raw(
      c                               'http://demo.geomatikk.no:8080' +
      c                               '/SB1SF/servlet/GeoLocator2?' +
      c                                %trim(data):
      c                                1: %paddr('INCOMING'))

This will behave more like the way Internet Explorer does.

Also, you're not encoding your variable data. This won't cause a problem with the particular example that you sent to the mailing list because the words "Nedreveien", "28" and "STAVANGER" are all URL-friendly words.

However, I urge you to encode your data. If you ever have a placename like "New York" where there's a space in the middle, your code won't work unless you encode the data. Similarly, if you ever have &, +, =, or / characters in the data, it won't work unless it has been encoded. Depending on the way the server was written, there are a few other characters as well.

Please use the encoder. That's what it's for.

When I switch to port 8081 in the rpg, it works fine. But now it does not work with Internet Explorer url: http://demo.geomatikk.no:8081/SB1SF/servlet/GeoLocator2?PLACENAME=Nedreveien&HOUSENO=28&MUNICIPALITY=STAVANGER

I'm not in a position to know anything about the way the people at demo.geomatikk.no have set up their services.


I suspect that they've put GET requests on port 8080, and POST requests on port 8081. This seems like a strange thing to do, but I assume they had their reasons?


It must be a http server config problem, or?



I don't think it's a "problem", per se. Just an unusual way to do things. The genuine problem is that you're using a POST request from HTTPAPI when the server expects a GET request, and vice-versa when working with IE.


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------