0

how to do a safe search using http://search.yahooapis.com/WebSearchService/V1/webSearch

I am trying to do a safe search using the following code. Is there an option I need or what is the syntax for doing this?

public String searchYahoo(String query, String format) {
try {
snippet = beginHTML;
String epr = "http://search.yahooapis.com/WebSearchService/V1/webSearch";

ServiceClient client = new ServiceClient();
Options options = new Options();
client.setOptions(options);
options.setTo(new EndpointReference(epr));

options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
options.setProperty(Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_GET);
options.setProperty(Constants.Configuration.MESSAGE_TYPE,org.apache.axis2.transp
ort.http.HTTPConstants.MEDIA_TYPE_X_WWW_FORM);

//if post is through GET of HTTP
OMElement response = client.sendReceive(getPayloadForYahooSearchCall(query, format));
generateSnippet(response);
return snippet;

} catch (Exception e) {
e.printStackTrace();
snippet = "<H2>Error occurred during the invocation to Yahoo search service</H2>" +
"<p>" + e.getMessage() + "</p>" + endHTML;
}
return null;
}

by
1 Reply
This forum is locked.

Recent Posts

in Y!OS SDKs