Feeds

Streamline your search with Yahoo! Web Services and AJAX

Google - not the only fruit

  • alert
  • submit to reddit

Choosing a cloud hosting partner with confidence

Hands on Despite what you might read and hear about Google's web dominance, this is not Google-owned world. Yahoo! may be playing second fiddle to the internet's favorite search and ads service, but it still plays one hell of a tune in terms of numbers of users and the services it offers.

If you use Yahoo! for your web search, then Yahoo! provides web services that may be included in web applications to generate dynamic content for an input.

In this article, I plan to follow up on my earlier addition of Asynchronous JavaScript and XML (AJAX) to your Google search, by looking at adding AJAX to web search using Yahoo! Web Services in Oracle JDeveloper 11g. Why JDeveloper 11g? Because this provides a new feature for web and AJAX development - an integrated JavaScript editor.

Limits of AJAX

AJAX is a web technique to transfer XML data between a browser and a server without reloading the web page. Ajax is implemented using the XMLHttpRequest object.

A limitation of XMLHttpRequest is that AJAX requests may be made only to the same web server that serves the web page from where the AJAX request is sent. If the web application is running on one server and the web service is on another server a XMLHttpRequest request does not get sent. Various methods are available to send an AJAX request to a remote server some of which are digitally signing your scripts and using an alternative XMLHttpRequest API. One of the methods, which we shall discuss in this article, is to use a proxy web server that routes AJAX requests from the web application to the web service.

Yahoo! Web Services provide various web search services and content that may be included to develop dynamic web applications. Yahoo! Web Search AJAX Web Services have an advantage over the Google web search AJAX web services. Yahoo! Web Services have the provision to search within a context; contextual web search. For example, search for the term "Eclipse" in the context of "Java IDE". The various Web Search Web Services provided by Yahoo! are discussed in following Table.

Web service Description
Context search The contextual web search service returns web pages that match a query within a specified context
Related suggestion Provides suggestions for related queries based on the submitted query
Spelling suggestion Provides suggested spellings for a specified term
Web search Provides a web search service using REST (Representational State Transfer)

Before Yahoo! Web Service may be used, register with Yahoo Web Services to obtain an application identity with which Yahoo! Web Services may be accessed.

Create a web application

First, create a JDeveloper application, WebSearchApp, and project, WebSearchWebService. Create a JSP file, input.jsp, in the project. The web application URL, which is used to register with Yahoo! Web Services, is http://127.0.0.1:8988/WebSearchApp-WebSearchWebService-context-root/input.jsp. In the web application we shall use the Contextual Web Search service to submit a context-base web search query.

The request URL for the contextual web search web service is http://search.yahooapis.com/WebSearchService/V1/contextSearch. The required request parameters to a contextual web search query are appid and context. The value of the appid parameter is the application ID provided by Yahoo! Web Services and the context parameter specifies the context string in which the web search query is sent.

Internet Security Threat Report 2014

More from The Register

next story
Preview redux: Microsoft ships new Windows 10 build with 7,000 changes
Latest bleeding-edge bits borrow Action Center from Windows Phone
Google opens Inbox – email for people too thick to handle email
Print this article out and give it to someone tech-y if you get stuck
Microsoft promises Windows 10 will mean two-factor auth for all
Sneak peek at security features Redmond's baking into new OS
UNIX greybeards threaten Debian fork over systemd plan
'Veteran Unix Admins' fear desktop emphasis is betraying open source
Entity Framework goes 'code first' as Microsoft pulls visual design tool
Visual Studio database diagramming's out the window
Google+ goes TITSUP. But WHO knew? How long? Anyone ... Hello ...
Wobbly Gmail, Contacts, Calendar on the other hand ...
DEATH by PowerPoint: Microsoft warns of 0-day attack hidden in slides
Might put out patch in update, might chuck it out sooner
prev story

Whitepapers

Choosing cloud Backup services
Demystify how you can address your data protection needs in your small- to medium-sized business and select the best online backup service to meet your needs.
Forging a new future with identity relationship management
Learn about ForgeRock's next generation IRM platform and how it is designed to empower CEOS's and enterprises to engage with consumers.
Security for virtualized datacentres
Legacy security solutions are inefficient due to the architectural differences between physical and virtual environments.
Reg Reader Research: SaaS based Email and Office Productivity Tools
Read this Reg reader report which provides advice and guidance for SMBs towards the use of SaaS based email and Office productivity tools.
Storage capacity and performance optimization at Mizuno USA
Mizuno USA turn to Tegile storage technology to solve both their SAN and backup issues.