I tried to use the Apache Ant Get task to get a list of the WSDL generated by another team in our company. They are hosted on the weblogic 9.x server at http: //....com: 7925 / services / . I can go to the page through a browser, but the get task gives me a FileNotFoundException when I try to copy the page to a local file for parsing. I could still get (using the Ant task) a URL without a non-standard port 80 for HTTP.
I looked at the Ant source code and narrowed the error to URLConnection. It seems that URLConnection does not recognize the data, it is HTTP traffic because it is not on the standard port, although the protocol is specified as HTTP. I sniffed the traffic with WireShark, and the page loaded correctly over the wire, but still gets a FileNotFoundException.
Here is an example where you will see an error (with a modified URL to protect the innocent). The error is called on connection.getInputStream ();
import java.io.File; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; public class TestGet { private static URL source; public static void main(String[] args) { doGet(); } public static void doGet() { try { source = new URL("http", "test.com", 7925, "/services/index.html"); URLConnection connection = source.openConnection(); connection.connect(); InputStream is = connection.getInputStream(); } catch (Exception e) { System.err.println(e.toString()); } } }
java urlconnection ant
jeffl8n Jun 02 '09 at 20:08 2009-06-02 20:08
source share