title: java.io.IOException: Server returned HTTP response code: 500 for webservices
body: <p>I am getting a java.io.IOException when I tried to access webservices insdie a jsp page.</p>
  
  <blockquote>
    <p>java.io.IOException: Server returned HTTP response code: 500 for URL:</p>
  </blockquote>
  
  <p>It shows null when I tried printing out the error. </p>
  
  <p>Webservices are working fine when I access it through postman. Also this worked fine before using https.</p>
  
  <p>Below is my code.</p>
  
  <pre><code>HttpURLConnection connection = (HttpURLConnection) url.openConnection();
          connection.setRequestMethod("POST");
          System.out.println("logged in url parameter");
          String urlParameters = "args0={username}&amp;args1={password}".replace("{username}",wsUsername).replace("{password}",wsPassword);
          System.out.println(urlParameters);
          System.out.println("wsUrl");
          System.out.println(wsUrl);
          connection.setDoOutput(true);
          DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
          wr.writeBytes(urlParameters);
          wr.flush();
          wr.close();
  
  
          BufferedReader input = new BufferedReader(new InputStreamReader(connection.getInputStream()))
          Pattern pattern = Pattern.compile(".+&lt;ns:return&gt;(.+)&lt;/ns:return&gt;.+");
  </code></pre>
  
  <blockquote>
    <p>java.io.IOException: Server returned HTTP response code: 500 for URL: <a href="https://xxx.xxx/nyx/services/ServiceManager/getFormCategories?args0=DEU&amp;args1=&amp;response=application/json" rel="nofollow noreferrer">https://xxx.xxx/nyx/services/ServiceManager/getFormCategories?args0=DEU&amp;args1=&amp;response=application/json</a>
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1913)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at java.base/sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1501)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at java.base/sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1499)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at java.base/java.security.AccessController.doPrivileged(Native Method)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at java.base/java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:793)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:245)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at java.base/java.net.URL.openStream(URL.java:1117)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.jsp._005fws.getFormCategories_jsp._jspService(getFormCategories_jsp.java:318)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at nl.planon.tomcat.ForgotPasswordFilter.doFilter(ForgotPasswordFilter.java:78)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at nl.planon.webrequestsigner.WebRequestSignerFilter.doFilter(WebRequestSignerFilter.java:67)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at nl.planon.owasp.valve.WhitelistHTTPMethodsValve.invoke(WhitelistHTTPMethodsValve.java:72)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:610)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:291)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at nl.planon.owasp.valve.WhitelistHTTPMethodsValve.invoke(WhitelistHTTPMethodsValve.java:72)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at nl.planon.owasp.valve.XSSProtectionHeaderValve.invoke(XSSProtectionHeaderValve.java:175)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at nl.planon.tomcat.AddHeaderValve.invoke(AddHeaderValve.java:117)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at nl.planon.tomcat.ClickjackHostValve.invoke(ClickjackHostValve.java:107)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    INFO   | jvm 1    | 2019/09/17 11:38:29 |   at java.base/java.lang.Thread.run(Thread.java:834)</p>
  </blockquote>