This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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();
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