Customer is using a third party application written in Java, .Net etc. He is Posting data to an externally available Suitelet but he encounters HTTP 405 Error every time he passes the request to the Suitelet and gets the response.
In order to eliminate the error, user should also specify headers on the request. Below is a sample code in Java to add request headers:
URL url = new URL("https://forms.netsuite.com/app/site/hosting/scriptlet.nl");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
Connection.setRequestProperty("User-Agent", "Mozilla/5.0");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
connection.setRequestProperty("Accept-Language", "en-us,en;q=0.5");
connection.setRequestProperty("Accept-Encoding", "gzip,deflate");
connection.setRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
Connection.setRequestProperty("User-Agent", "Mozilla/5.0");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
connection.setRequestProperty("Accept-Language", "en-us,en;q=0.5");
connection.setRequestProperty("Accept-Encoding", "gzip,deflate");
connection.setRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
Hi,
ReplyDeleteThis is not working for me. I am still facing "Method Not Allowed" HTTP 405 error.
This header made the trick for me:
ReplyDelete"User-Agent", "Mozilla/5.0"
Working fine now
Yes it worked for me too. Thanks
Delete