This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Server returned HTTP response code: 405 for URL
 
Similar Threads
Unable to read the Japanese character from HTTP Response
Unable to access URL using HttpURLConnection
Japanese character from the request stored in question mark in the DB
How Do I Forward/Redirect Extra Parameters From JSP To ASP via POST?
HTTP 405