This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Server returned HTTP response code: 405 for URL  RSS feed

 
Pavan K K
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!