Skip to main content link. Accesskey S
  • Log In
  • Help
  • IBM Logo
  • IBM Mashup Center wiki
  • All Wikis
  • All Forums
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
Community Articles Product Documentation Learning Center IBM Redbooks This category IBM Mashup Center 3.0.0.1 Documentation Custom Search Scope...
Search
  • New Article
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

Anna G O'Neal
Contribution Summary:
  • Articles authored: 175
  • Articles edited: 274
  • Comments Posted: 34

Recent articles by this author

Maintaining page IDs when importing spaces

After exporting a space to one server and then importing that space to another server, you might notice that the original IDs for that space and all its pages and widgets change. In cases where you do not want the IDs to change, you can run a stableid import command to import the space ZIP file ...

Adding a custom widget to the mashup builder

You can add a custom widget to the mashup build directly from the Add to Mashup Builder window in the catalog. Do the following steps: 1. Open the catalog.xml file for the widget in edit mode, and add the line in italic font: definition ...

IBM Mashup Center Trial Edition, Version 3.0.0.1

This is an evaluation version of IBM Mashup Center, version 3.0.0.1. The product media contains all the functionality of a fully licensed version of IBM Mashup Center, except for the following limitations: This software is valid for 60 days from installation. This software is only available for ...

Date formats do not match browser settings for language

When browser settings for language are set to engb, certain widgets that display start and end dates of events might incorrectly display the dates in American English format ((MMDDYYYY)) instead of United Kingdom English format (DDMMYYYY). For example, when you view a series of events in the ...

Connecting to the Mashup Center WebDAV when working with themes and skins

This topic provides information on WebDAV, including how to connect to the file store to work with Page Builder 2 static resources.

Community articleWorking with payload types

Added by Anna G O'Neal | Edited by IBM contributor Anna G O'Neal on December 6, 2008 | Version 59
expanded Abstract
collapsed Abstract
No abstract provided.
Tags: data, data types, event, wire
When you wire widgets together, you create the communication line that allows data to pass from one widget to another. This data is defined by the event name, the payload (the actual content), and the payload type. The event name provides descriptive information about the event. For example, the event name News breaks can describe an event that fires when users click a link that displays a set of news articles. In this case, the news articles themselves are the payload of the event name News breaks.

So how does the payload type fit into this event-payload model?

The payload type defines the format of data that is passed between widgets when an event occurs. The sending and receiving widgets must both be able to interpret and process a common payload type in order to be wired together successfully. Essentially, the payload type serves as an "interpreter" that determines whether or not two widgets speak the same language. Similar to two humans conversing with one another, two widgets must share a common method of communication if they are to understand each other. If the widgets do not share a common payload type, they cannot be wired together.

For example, let's say that you are creating a mashup for your human resources department. One widget (Widget A) in your mashup is designed to handle employee information. In order to uniquely identify employees, you have designed Widget A to receive an employee's e-mail address when an event occurs on the page. The event name can be something similar to processEmployeeInfo, and the payload type is email. This way, only the widgets that expose email as their payload type can be wired to Widget A.

In order to address the issue of two widgets needing a common payload type, Lotus Mashups has defined a list of common types. Lotus Mashups payload types are defined and associated with events in the widget definition file that is located inside each widget's WAR package. Each definition file contains a string similar to the following:

<iw:eventDescription id="RowClick
" payloadType=“text“/
 


Most of the payload types supported by Lotus Mashups are simple types, for example text, person, phone, and address. You can combine two simple payload types to provide a more complete payload type. For example, you can combine the currency payload type with the countrycode payload type so that the currency value can be associated with that country's monetary system. Combined data types are created in this format: payloadtype1.payloadtype2. For more details about combining payload types, see the Special payload types section below.  

For more complicated data, such as data in XML format, Lotus Mashups supports complex payload types, for example xml, atom, and json. Lotus Mashups also supports special payload types that you can use for custom or unknown payload types. See the following sections for more details.

This article is designed to help you understand the types of payloads that Lotus Mashups supports, including both simple and complex payload types. We also explain which payload types are compatible with each other and how you can implement a public API to create and customize your own payload type when you cannot use of the types provided with Lotus Mashups.

Simple payload types


Simple payload types define common, non-complex data that is typically not used as a container to hold other data. See the following table for a list of simple payload types that are supported in Lotus Mashups:
Payload type Description
text A string that contains plain text content, for example Hello World.
url A string that points to a Web resource, for example http://www.ibm.com. See the discussion about combined data types in the Special payload types section below for more information about how to combine the url payload type.
html A string that is a fragment of HTML markup, for example <h2
 
This is a title</h2
 
.
image A DOM node or DOM node ID that represents an image on the client side. Can also be combined as url.image to represent an image on the Web.
number A number, for a example an integer, float, or double. To see an example of a number payload type, see the wiring interface of the Action Timer widget.  
countrycode A string that represents an A3 ISO 3166 country code, for example USA or CHN.
languagecode A string that represents an ISO 639-2 language code, for example en, es, and fr.
currency A number that indicates a monetary value, for example 100 or 200. Typically, the currency data type is combined with a country code so that the value can be associated with that country's monetary system, for example currency.USA or currency.CHN.
boolean A true or false value.
email A string that represents an e-mail address, such as henry@acme.com.
person A string that represents a person, such as John Smith or Salvador Gonzales.
postalcode A string that represents a postal code, for example 27612.
phone A string that represents a phone number, such as 1-888-555-5555.
address A string that represents an address, for example 100 Main Street, Boston, Massachusetts, 25443.
date A string that represents a date in one of the following formats:
  • YYYY-MM-DD
  • YYYYMMDD
  • YYYYMM
  • YYYY
where YYYY is the year, MM is the month, and DD is the day.
To see an example of a date payload type, see the wiring interface of the Action Timer widget.
time A string that represents the time in one of the following formats:
  • hh:mm:ss.mmmm
  • hh:mm:ss
  • hh:mm
  • hh
where hh is the hour, mm is the minute, ss is the second, and mmmm is the millisecond.
To see an example of a time payload type, see the wiring interface of the Action Timer widget.
timestamp A string that combines the date and time payload types into one of the following formats:
  • YYYY-MM-DD hh:mm:ss.mmmm
  • YYYYMMDD hhmmss
  • YYYYMMDDThhmmss
To see an example of a timestamp payload type, see the wiring interface of the Action Timer widget.







Complex payload types


A complex payload type is usually a composite of two other payload types. For example, consider the data in a typical mailing address:


  • Street number, street name

  • City, state, postal code

  • Country



  • Each of the six pieces of data in the mailing address can be defined individually using the simple payload types provided with Lotus Mashups. However, in order to combine all the data into a single payload that can be interpreted and passed to and from widgets in your mashup, you must define a complex payload type such as mailingaddress that specifies all the pieces of data it supports. You can even combine the mailingaddress data type with additional simple payload types to create a second complex payload type, for example:


    • Last name, first name

    • Home phone, work phone

    • Mailing address



    • See the following table for a list of complex payload types that are supported in Lotus Mashups:
      Payload type Description
      table A piece of text in comma-separated value (CSV) format that appears in rows. Note the following behaviors:

      • The items in the first row make up the column header.

      • The data types of each column are denoted with a bracket, for example firstName<text
         
        , age<number
         
        , home<address
         
        . If no data type is specified for a column, the text data type is used as the default.

      • If a column uses a comma as part of its data, you must add double quotes (") to the value for that column, for example “109 Hickorywood Blvd., Cary, NC 27590”.

      • If a column uses double quotes as part of its data, for example John "the leader" Doe, you must insert one set of double quotes before the first occurrence and two sets of double quotes after the second occurrence, for example John ""the leader""" Doe.
      atom A piece of text in Atom format, for example an XML file.
      xml A piece of text in XML format, for example:
      <data type=“table”
       

      Id<number
       
      ,title<text
       
      ,age<number
       
      ,height<number
       
      ,heightUnit<text
       

      101,engineer,49,2.1, meter
      209,manager,34,4.3, feet
      201,director,45, 5.9, feet
      </data
       

      Note the following behaviors:

      • The XML must comply with the W3C XML specification, located at http://www.w3.org/TR/REC-xml/.

      • The XML element may have a payload type that indicates its data type, for example <first_name type=“text”
         
        john</first_name
         
        or <home type=“address”
         
        888 Mountview Parkway, SomeTown, CA 99019
        .

      • If the XML element does not have a payload type attribute, the data type defaults to text.

      • If the XML element does have a data type attribute, but the value of the attribute is not recognized, then the type defaults to text.

      json A piece of text in JavaScript Object Notation (JSON) format.























      Creating customized payload types


      As a widget developer, you can implement the following public data model application programming interface (API) and create your own customized payload types:

      com.ibm.mashups.data.model


      When you use a customized payload type, you must update the following string in the widget definition file so that the payload type is set to modeldata, for example:

      <iw:eventDescription id="RowClick
      " payloadType=“modeldata“/
       


      The com.ibm.mashups.data.model API provides the following methods:

      • getValue

      • getValueType

      • getValues

      • getAttributes

      • hasAttribute

      • isItem

      • fetch

      • serialize



      • This API also supports the method fetch callback function:

        • onBegin (size, request)

        • onItem (item, request)

        • onComplete (items, request)

        • onError (errorData, request)



        • For more information about how to implement this API, see the IBM Lotus Mashups API Reference.

          Note
          : As you create new payload types, be sure that you do not use any payload type names that are reserved for Lotus Mashups. If you specify a payload type name that is already supported by Lotus Mashups, your mashup will produce errors at runtime.

          Special payload types


          In addition to the simple and complex payload types described above, Lotus Mashups also offers the following three specialized payload types. See the table for more information.
          Payload type Description
          modeldata A payload type designed to interpret customized data types that you create using the com.ibm.mashups.data.model public API.
          any A common payload type that can support any type of data. The any data type is useful in cases when you are not sure what format of data the event will produce. It is also useful in cases where the event payload may change, for example when sending event data to the Event Explorer widget from other widgets that may support various data types.
          combined A payload type that combines two or more payload types into one. For example, if your event payload is a URL that always points to an image, you can combine the url and image data types into the following combined data type: url.image. In a different scenario, you can also combine the url payload type with a simple payload type and either the countrycode or languagecode payload types to further define the data, for example:
          • url.simplepayloadtype.countrycode
          • url.simplepayloadtype.languagecode























          Understanding compatible payload types


          Certain payload types can communicate with other payload types. For example, when sending a URL from one widget to another widget, and that URL payload is defined with the url simple payload type, any receiving widget that accepts the text payload type can process the URL. Learning which payload types are especially important when attempting to create automatic wiring by dropping widgets onto other widgets. If the payload types are the same or are compatible, then the wiring will take place successfully. However, if the payload types either do not match or are not compatible, the wiring will not be created and your mashup will not function properly, even though you may have not gotten any type of error indicating a problem.

          See the following table to learn which simple data types are compatible:
          Receiving payload type Sending payload type
          The text data type can receive the following data types:

          • url

          • html

          • number
          •  

          • countrycode

          • languagecode

          • currency

          • boolean

          • date, time, timestamp

          • email

          • postalcode

          • phone

          • address
          •  

          • person

          • feed

          • json
          • The date and time data types can receive the following data type: timestamp























            Simple payload types can also receive a combined payload type but only when it can ignore the suffix, allowing it to create a match. For example, the url payload type can receive a url.text payload type. The combined payload type can never receive other payload types. Finally, complex payload types can only receive matching payload types.
            expanded Attachments (0)
            collapsed Attachments (0)
            expanded Versions (16)
            collapsed Versions (16)
            Version Comparison     
            VersionDateChanged by              Summary of changes
            66Mar 29, 2010 8:35:15 AMAnna G O'Neal  IBM contributor
            65Aug 17, 2009 12:30:28 PMAnna G O'Neal  IBM contributor
            64Aug 12, 2009 9:58:59 AMAnna G O'Neal  IBM contributor
            63Aug 12, 2009 9:45:11 AMAnna G O'Neal  IBM contributor
            62Aug 12, 2009 9:41:53 AMAnna G O'Neal  IBM contributor
            61Jan 18, 2009 11:39:01 AMAnna G O'Neal  IBM contributor
            60Dec 6, 2008 12:04:41 PMAnna G O'Neal  IBM contributor
            This version (59)Dec 6, 2008 11:59:20 AMAnna G O'Neal  IBM contributor
            58Dec 6, 2008 11:57:49 AMAnna G O'Neal  IBM contributor
            57Dec 6, 2008 11:56:18 AMAnna G O'Neal  IBM contributor
            56Dec 6, 2008 11:54:54 AMAnna G O'Neal  IBM contributor
            55Dec 6, 2008 11:53:00 AMAnna G O'Neal  IBM contributor
            54Dec 6, 2008 11:51:52 AMAnna G O'Neal  IBM contributor
            53Dec 6, 2008 11:50:53 AMAnna G O'Neal  IBM contributor
            51Nov 21, 2008 11:44:30 AMAnna G O'Neal  IBM contributor
            36Sep 15, 2008 4:22:09 PMCraig Lordan  IBM contributor
            Copy and paste this wiki markup to link to this article from another article in this wiki.
            Go ElsewhereStay ConnectedHelpAbout
            • IBM Collaboration Solutions wikis
            • IBM developerWorks
            • IBM Software support
            • Twitter LinkIBMSocialBizUX on Twitter
            • FacebookIBMSocialBizUX on Facebook
            • ForumsLotus product forums
            • BlogsIBM Social Business UX blog
            • Community LinkIBM Collaboration Solutions
            • Wiki Help
            • Forgot user name/password
            • Wiki design feedback
            • Content feedback
            • About the wiki
            • About IBM
            • Privacy
            • Accessibility
            • IBM Terms of use
            • Wiki terms of use