wood burning stoves 2.0*
The moose likes Sockets and Internet Protocols and the fly likes  Server returned HTTP response code: 405 for URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark " Server returned HTTP response code: 405 for URL" Watch " Server returned HTTP response code: 405 for URL" New topic
Author

Server returned HTTP response code: 405 for URL

Pavan K K
Greenhorn

Joined: Jul 25, 2002
Posts: 3
I have a httpURLconnection class, if i try to call the method conn.getInputStream() it returns
"Server returned HTTP response code: 405 for URL"
Please let me know the solution,
code is given below.
Pavan

String url="http://www.flash-b.com/services/ws/siteInspect.wsdl";
URL target=new URL(url);
conn = (HttpURLConnection)target.openConnection();
conn.setRequestProperty("Proxy-Authorization", auth);
conn.setAllowUserInteraction(true);
conn.setRequestProperty("content-type","text/xml");
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches (false);
conn.setDefaultUseCaches (false);
conn.setRequestMethod("GET");
PrintWriter out = new PrintWriter(conn.getOutputStream());
StringBuffer sc = new StringBuffer();
String line = null;
conn.getInputStream();
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Code 405 means "HTTP method not allowed". In this case the method is GET, which is a bit odd. All I can think of is that either the service is not supporting GET, or your proxy is trying to do clever stuff that the web server doesn't like.
Any more thoughts?
- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Server returned HTTP response code: 405 for URL