Debt Consolidation - Submit articles - Debt Consolidation - Self Improvement Articles Directory - Rome hotels

PDA

View Full Version : Help with Yahoo API


onentwoo
Mar 13th 2005, 9:51 am
Greetings
Well i am ready to give up - it taking me a lot of time learning how to use Yahoo API.
after with forums help i realized that i need to download all kind of JAXB and JAXME jars.
I finally was able to go without errors - until i got the :

java.net.UnknownHostException: api.search.yahoo.com

My program is simple (java one):

try
{
SearchClient x = new SearchClient("myCode");
WebSearchRequest u = new WebSearchRequest("test word");

WebSearchResults z;
WebSearchResult d;

x.webSearch(u);
d = z.listResults()[0];
System.out.println(d.getTitle());
}
catch (SearchException v)
{
System.out.println(v.toString() );
}
catch (IOException v)
{
System.out.println(v.toString() );
}


So why does it throw this exception ? and how come others use it so quickly ?
I don't remember having such a hard time with Google API.

anyone know ?

Thanx in advance

digitalpoint
Mar 13th 2005, 7:03 pm
Do you really need to use Java as your mechanism to query the API? It's much easier to just make an HTTP request to it and you get nicely formatted XML as a result.

onentwoo
Mar 14th 2005, 10:35 pm
However the java thing cover the XML for me so i do not use to do any analysis
(like google api)

I am not yet familiar with the XML mechanizm in java.

However i'll be happy to see a sample how to work with the Yahoo API XML
*there is an example in their site - but they do not show how to analyze the XML.

Maybe this will be easier