Posted 01/20/2010 - 18:20 by MiMi Levine
With a fairly basic knowledge of XSL, XPath and XSL Stylesheets, the SharePoint XML Web Part can provide a front-end for Presto Mashups. The XML Web part can actually be used to invoke any REST-like, XML based, non-SOAP Web Service, where the invocation request is encapsulated in a URI and the response is received as an XML document.
So prerequisites for the Presto Service are:
Any input parameters required by the Service are primitive and can be included as part of the Service URI.
Inclusion of input parameters in the URI does not represent a security threat.
Any authorization credentials reuqired by the Service can be included in the Service URI.
The screenshot below shows an example of a simple Presto Mashup Service being configured for display in an XML Web Part. The Mashup is one of the out-of-the-box RSS Feeds provided by Presto, it returns a summary of Top Rated Presto Published Services. The screenshot shows the XML Web Part in Edit mode.

The Service URI is of the form:
http://host:port/presto/edge/api/rest/PrestoServicesFeed/1.0/getFeed?presto_user=username&presto_password=password&feed=TopRatedServices&count=10
Here is a sample of the returned XML document:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>PrestoServices</title>
<link>http://localhost:8080/presto/feeds.jsp?format=rss&activity=register&item=services</link>
<description>List of services registered in Presto</description>
<language>en-us</language>
<pubDate>2009-01-19T17:04:03.368-06:00</pubDate>
<ttl>60</ttl>
<sy:updatePeriod xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">hourly</sy:updatePeriod>
<item>
<title>salesforce</title>
<guid>salesforce</guid>
<description>Salesforce service</description>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SalesForce</dc:creator>
<dc:provider xmlns:dc="http://purl.org/dc/elements/1.1/">SalesForce</dc:provider>
<dc:type xmlns:dc="http://purl.org/dc/elements/1.1/">WSDL</dc:type>
<dc:Identifier xmlns:dc="http://purl.org/dc/elements/1.1/">salesforce</dc:Identifier>
<dc:subject xmlns:dc="http://purl.org/dc/elements/1.1/">WSDL, Salesforce</dc:subject>
<presto:stats xmlns:presto="http://jackbe.com/presto">
<numberOfRatings>1</numberOfRatings>
<avarageRating>4</avarageRating>
<subjectEntityId>salesforce</subjectEntityId>
<subjectEntityType>Service</subjectEntityType>
<id>16</id>
</presto:stats>
<presto:status xmlns:presto="http://jackbe.com/presto">ACTIVE</presto:status>
</item>
<item>
<title>TechCrunchRSS</title>
<guid>TechCrunchRSS</guid>
<description>TechCrunch</description>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">NONE</dc:creator>
<dc:provider xmlns:dc="http://purl.org/dc/elements/1.1/">NONE</dc:provider>
<dc:type xmlns:dc="http://purl.org/dc/elements/1.1/">RSS</dc:type>
<dc:Identifier xmlns:dc="http://purl.org/dc/elements/1.1/">TechCrunchRSS</dc:Identifier>
<dc:subject xmlns:dc="http://purl.org/dc/elements/1.1/">RSS, Startups, Analysis, News, Technology</dc:subject>
<presto:stats xmlns:presto="http://jackbe.com/presto">
<numberOfRatings>1</numberOfRatings>
<avarageRating>4</avarageRating>
<subjectEntityId>TechCrunchRSS</subjectEntityId>
<subjectEntityType>Service</subjectEntityType>
<id>22</id>
</presto:stats>
<presto:status xmlns:presto="http://jackbe.com/presto">ACTIVE</presto:status>
</item>
....
....
....
</channel>
</rss>
We could use a standard SharePoint RSS Web Part to view this Service data. The RSS Web Part provides an equivalent mechanism for performing XSL transformation of RSS Feed data.
However, we'll use XML Web Part in this case to illustrate how the XSLT stylesheet transformation can be applied.
By placing the Web Part in Edit mode and selecting the XSL Editor we are able to cut and paste an XSLT Stylesheet to transform the RSS Feed document and prepare a HTML table summary of the feed items:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:presto="http://jackbe.com/presto" >
<xsl:template match="/rss/channel">
<html>
<body>
<h2><xsl:value-of select="title" /></h2>
<p><xsl:value-of select="description" /></p>
<table border="0">
<tr bgcolor="#eeeeee">
<th width="160" align="left" >Service</th>
<th width="500" align="left" >Description</th>
<th width="60" align="left" >Type</th>
<th width="100" align="left" >Provider</th>
<th width="60" align="left" >State</th>
<th width="40" align="left" >Rating</th>
<th width="40" align="left" >Ratings</th>
</tr>
<xsl:for-each select="item">
<tr>
<td><xsl:value-of select="title" /></td>
<td><xsl:value-of select="description" /></td>
<td><xsl:value-of select="dc:type" /></td>
<td><xsl:value-of select="dc:provider" /></td>
<td><xsl:value-of select="presto:status" /></td>
<td><xsl:value-of select="*/avarageRating" /></td>
<td><xsl:value-of select="*/numberOfRatings" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Below we have the resulting XML Web Part rendering.

- Login or register to post comments
- Email this page
