File not found Exception when calling Yahoo Search via REST and Java
Any ideas as to why I may get this when I call the Yahoo search service .
I set a proxy.
System.setProperty("proxyHost", "SOME_PROXY");
System.setProperty("proxyPort","8080");
and then a baisc search call :
URL url = new URL(MessageFormat.format(WEB_SEARCH_URL_FORMAT,new Object[]{URLEncoder.encode(APPLICATION_ID, "utf-8"),
URLEncoder.encode(query, "utf-8")}));
// Create an XPath engine.
XPath xpath = XPathFactory.newInstance().newXPath( );
// Execute the query.
Document responseDocument = null;
try {
// We need a Document to use XPath.
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
responseDocument = builder.parse(url.openStream());
}
catch (IOException e)
{ERROR CAUGHT HERE}
Request URL = http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=SOME_APP_ID&query=QUERY_STRING
Error calling the service: java.io.FileNotFoundException: http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=SOME_APP_ID&query=QUERY_STRING
java.io.FileNotFoundException: http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=SOME_APP_ID&query=QUERY_STRING
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1303)
at java.net.URL.openStream(URL.java:1009)
at org.ofcom.industry.search.YahooSearch.main(YahooSearch.java:69)
by
0 Replies