Mashups and Microsoft SharePoint Part 1: Using Standard Web Parts to Publish Mashlets into Microsoft SharePoint

3
Your rating: None Average: 3 (1 vote)

Mashups and Microsoft SharePoint Part 1.1: Using Standard Web Parts to Publish Mashlets into Microsoft SharePoint

This is the first in a many-part series about Mashups and Microsoft SharePoint.  You can read about the entire series at http://www.jackbe.com/enterprise-mashup/blog/mashing-sharepoint-introduction.

Introduction

The below snapshot illustrates an example SharePoint Site homepage. This SharePoint Site, named Jackbe, will be used to illustrate various SharePoint features. The homepage is configured to display a number of standard SharePoint Web Parts, configured to display RSS data supplied by Presto in various forms.

There are a number of standard SharePoint Web Parts that can be used to display Presto Service Data.

 

  • RSS Viewer Web Part
    The RSS Viewer Web Part can be configured to display any Presto Published RSS Service,
    it is capable of displaying a variety of syndicated data feed forms including RSS, RDF and ATOM.
    See Sharepoint Consuming Presto Published RSS
  • XML Web Part
    The XML Web Part can be configured to invoke by URL any Presto Published Mashup.
    The Web Part must be configured with an XSL Stylesheet to transform the returned Mashup data.
    See Sharepoint Consuming Mashups

SharePoint Consuming Mashlets

Probably the quickest way of getting SharePoint to consume service data published by Presto is to configure it to display Mashlets.

The Page Viewer Web Part can be configured to display web content external to SharePoint. The Web part is configured with the URL associated with the web content which is then displayed in a window. The window dimensions and title can be configured.

The Mashlet URL has the following general form:

http://<host>/mashlets/uwa-view.jsp?mid=<mid>&height=<height>

where :

  • host - hostname or ip address and port number of Presto Mashup Server
  • mid - is the published name of the mashlet to be displayed
  • height - the height of the mashlet in pixels.

So to display a mashlet named HelloWorld.Mashlet published on the Presto Mashup Server running at 72.32.185.92:8080 the URL would be:

http://72.32.185.92:8080/mashlets/uwa-view.jsp?mid=HelloWorld.Mashlet&height=300

Mashlet name and height URL properties are mandatory.

By default the mashlet will be displayed without the standard mashlet header toolbar. The toolbar can be displayed by appending the property toolbar=true to the URL. eg:

http://72.32.185.92:8080/mashlets/uwa-view.jsp?mid=HelloWorld.Mashlet&height=300&toolbar=true

uwa-view.jsp is a standard JSP bundled with Presto Mashup Server, on Tomcat installations you'll find it in the webapps/mashlets directory, it will display the mashlet in a similar manner to the way mashlets/standalone.jsp does but without the header and framing, it expects to display a mashlet rendered in an iframe.

Presto.ServiceMashlet

Presto.ServiceMashlets are the particular type of mashlet published by Presto MashletMaker when exposing a Presto published Service with a web UI. This mashlet type is designed to allow mashlets to be configured with specific, primitive, input parameter data, which is required to invoke the underlying Presto Published Service.

Primitive data types supported by Presto.ServiceMashlet are numbers, strings and dates, generally anything that can be represented in the form of a character string. Complex data types, where the parameter is composed of multiple properties are not supported by Presto.ServiceMashlet.

If a Presto.ServiceMashlet type is being configured and if that mashlet supports input parameters then these input parameters can also be included in the mashlet URL. For example, a Stock Quote Mashlet, called MyQuotes, might be configured to accept a single string parameter, named "Symbol" which is a comma separated list of Stock symbols, so we might have a URL such as:

http://72.32.185.92:8080/mashlets/uwa-view.jsp?mid=MyQuotes&height=300&Symbol=ORCL,JAVA,IBM,MSFT

Mashlet Dimensions

The Mashlet dimensions are controlled by the Page Viewer Web Part Appearance settings, where the pixel width and height can be set. Note also that the height of the mashlet must be explicitly passed to the mashlet as part of the mashlet URL. The height specified in the Web Part Appearance property should match the value specified in the mashlet URL. If the 2 height values do not match then a vertical scrollbar may appear or whitespace may appear beneath the mashlet.

Unlike the height property, the width of the mashlet is computed automatically and does not need to be specified in either the Web Part Appearance settings or in the URL. If no width setting is specified then the Web Part and mashlet will just take up whatever horizontal space is available. If a width dimenension is specified in the Web Part Appearance settings then the Web Part width will adjust to that width and the Mashlet will resize automatically to take up that width.

Using Mashlets in Enterprise Portals

All the Mashlet artifacts discussed in these SharePoint articles are reusable in your Enterprise Portal (JSR-168 and WSRP compliant) using our Presto Connector for Enterprise Portal. The Presto Documentation also includes a useful discussion of the pros and cons of using Mashlets or Presto Mashups as base for Enterprise Portlets.