LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

method not allowed http 405 error

Solved!
Go to solution

I built a web service and it contains a static document myvi.html and a web method vi myvi.vi

 

the myvi.html contains a form to post data to myvi.vi by clicking the submit button.

 

When I used http://localhost:8080/servicename/myvi.html to fill the form and submit, the data had been posted to myvi.vi and it worked fine.

 

But when I used http://ipaddress:8080/servicename/myvi.html to fill the form and submit, I got the error 405 : method not allowed.

 

What's the problem? I already turned off all firewalls.

 

Thanks.

0 Kudos
Message 1 of 8
(9,793 Views)

"Method Not Implemented"... Ah, the joys of webservers. Could be that, well, the method (GET, POST, CONNECT) isn't implemented or enabled in the daemon's configuration.  That's not so much of a firewall issue but a server/daemon configuration problem.  I'm most familiar with apache, so YMMV.

 

Default install of the webserver?  You said you turned off firewalls, but is the port actually listening externally? (Use a port scanner to scan the machine, nmap or similar... there's a lot of them out there.)  Can you see anything at http://ipaddress through a web browser?  Is the machine on the same subnet, or are you punching through NAT on a router somewhere?

 

Also see that there aren't any .htaccess files or line items in the configuration restricting access to the server to localhost. 

0 Kudos
Message 2 of 8
(9,786 Views)

SnowMule,

 

Thanks for your reply. You may be right, the trouble probably was caused by the port, but I don't know how to fix it.

 

the web method vi has default port 8080, and the remote front panel port is 8000.

 

My situation is to redirect URL to a remote front panel.

 

1, Use http://localhost:8080/servicename/myvi.html submit data to myvi.vi and redirect to http://ipaddress:8000/myRFP.html, no problem.

2, Use http://ipaddress:8080/servicename/myvi.html then I get 405 error

3, Use http://ipaddress:8080/servicename/myvi.html but redirect it to a test URL with same port 8080, no problem.

 

I tried to set same ports for both RFP and web applicaion, it caused other troubles.

 

Any idea? Thanks,

0 Kudos
Message 3 of 8
(9,722 Views)

Eric,

 

In your static html form, what action are you using for submitting the form? You may see a 405 if your action explicitly says localhost. Instead, you want the form to submit to the same server containing the static html page.

 

In your case, assuming you call your VI with http://ipaddress:8080/servicename/myvi, your html could contain <form action="myvi" ...>, or you could be more explicit and use action="/servicename/myvi". Either way, you want a relative URL in your html.

0 Kudos
Message 4 of 8
(9,700 Views)

Pspangler,

 

I used action="/servicename/myvi" in the static html.

 

In the web method vi, I just wanna redirect URL, which is a web published remote front panel.

 

redirect.png

 

When I bowse http://localhost:8080/servicename/myvi.html, submit form, the redirect method worked fine.

if I changed localhost to ipaddress, I got 405 error.

if the redirect URL is /servicename/othervi or /servicename/other.html, there's no problem

0 Kudos
Message 5 of 8
(9,693 Views)
Solution
Accepted by topic author Eric_LZ

OK, finally, got it done by using Write Response.vi

 

redirect.png

don't know why redirect vi does not work.

0 Kudos
Message 6 of 8
(9,690 Views)

Eric,

 

Now I understand what you are trying to do and what is happening. Since you are submitting the form using POST, the redirect to the remote front panel is also going to be a POST, which is not supported (giving you a 405). The default for the redirect VI is to use a 307 redirect, which will redirect as a POST.

 

Instead, try changing the response code input terminal to 303 (or 302 if you need HTTP 1.0).

 

303 redirect

Message 7 of 8
(9,686 Views)

Pspangler,

 

you are right. I just tried.  It did work.

 

Thank you so much.

0 Kudos
Message 8 of 8
(9,684 Views)