Revision as of 08:44, 29 June 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Archived:Example Http Service on WidSets

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Created: User:Mirsilla (26 May 2008)
Last edited: hamishwillee (29 Jun 2012)

This script code does a HTTP GET search to Google and prints the resulting HTML content to a log.


  const String URL = "http://www.google.com/search";
  void startWidget()
    setMinimizedView(createMinimizedView("viewMini", getStyle("default")));

  Shell openWidget()
    return null;

  void fetch()
    //http parameters to be used in get-query
    Value params = [
      "q" => "widsets",
      "meta" => ""

    //widsets http service parameters
    Value arg = [
      "url" => URL,
      "params" => params
    call(null, "httpService", "get", arg, ok, nok);

  void ok(Object state, Value ret)
    setBubble(null, "Got "+ret.size()+" bytes of html");
    //printing html to log

  void nok(Object state, String error)
    setBubble(null, "Http get failed: "+error);

} //class


<?xml version="1.0" encoding="utf-8"?>
<widget spec_version="2.0">
    <shortdescription>Http Service Example</shortdescription>
    <longdescription>Http Service Example</longdescription>
    <tags>example httpservice</tags>
    <parameter name="widgetname">Http Service</parameter>

    <service type="http" id="httpService"/>
    <code src="http_service.he"/>
      mini {
        background: solid white;
        color: black;
        align: vcenter hcenter;
      maxi {
        background: solid white;
        padding: 5 5 5 5;
      flow {
        background: solid white;
  <layout minimizedheight="2em">
    <view id="viewMini" class="mini">
      <label class="mini">${widgetname}</label>

Note. You can search for certain parts from html-pages by defining Archived:WidSets Filter expressions reference -filters to your http-service.

This page was last modified on 29 June 2012, at 08:44.
64 page views in the last 30 days.