1 Reply Latest reply: Dec 3, 2012 3:35 AM by EJP RSS

    Unable to tunnel through proxy. Proxy returns "HTTP/1.1 400 Bad Request"

    977030
      Hi,
      I am trying to send a request to a web service using an HttpURLConnection and through a proxy as well.
      my Code:
      Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(theHost, thePort));
      URL url = new URL(theUrl);
      HttpURLConnection con = (HttpURLConnection)url.openConnection(proxy);
      con.setRequestMethod("POST");
      con.setRequestProperty("Content-type", "text/xml; charset=utf-8");
      con.setDoOutput(true);
      con.setRequestProperty("SOAPAction", theUrl);
      OutputStream reqStream = con.getOutputStream();

      At this line^ I get: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 400 Bad Request".
      If it's relevant, I am using Tomcat as well and Netbeans,

      Any help with this exception would be appreciated, thanks ...
      Dimitris