Posted 11/15/2008 - 10:42 by kishores
Would'nt it be nice if there was a way to convert any data to RSS/Atom format ? How is RSS relevant to enterprises ? Traditionally, RSS feeds have been used to subscribe to news and other information in the consumer web. However, RSS is slowly but surely finding its way into the Enterprises. There are very good reasons why it should. To me, there are at least a few reasons for data to be formatted in the RSS format:
- All the popular browsers and email clients have a built-in RSS Reader. This means that if the data is available in the RSS format, the client can render the data in a human-readable form immediately without IT or any other developer getting involved.
- More often than not, users "read" data and the RSS format lends itself very well to this.
- Data changes often and users want to be notified of the changes. Again, the RSS readers poll the RSS feeds automatically for data updates every "n" number of minutes.
- Access to information in a mobile device such as Blackberry or iPhone. These devices have a built-in Email and RSS reader and hence RSS is a good way to push enterprise information to the mobile user.
Here are some use cases/scenarios where a RSS feed of the data could be very useful and handy:
- User must be notified of changes to an Issue that the user is observing.
- User subscribes to a feed of new Sales Leads generated in a specific region.
- List of Contacts in a specific Account OR List of contacts across all Accounts for a user (e.g. Sales Manager).
- User wishes to subscribe to be notified of changes to some data under a specific condition.
One of the key characteristic of data that lends itself to RSS format is to provide relevant Summary information and a link to get to the detailed information if required. I feel there are many data out there in the Enterprise that will fit this classification. Email notifications are currently used but there is a good chance that the user will be bombarded with emails from all the systems and the information will be rendered useless ("too much data = very little information").
So, how would we convert Enterprise data to RSS?
- Data is scattered across various systems and data stores - Database, Legacy systems, exposed as WSDL Services, POJOs, text files etc.
- Users must be allowed to create their own feeds from data that is relevant to them. It is impossible for IT to create feeds that are relevant to each user community. It is better for IT to provide a tool to the users to create their own feed. IT will still provide some of the common/generic feeds.
Lets see how this can be achieved with Presto.
ConvertToRSS EMML Macro
We implemented a Macro block using EMML that can be plugged into Wires to allow end users to create their own feeds.
Here are the steps to install this Macro:
- Copy the contents of ConvertToRSS.macro into the global.emml-macros file. This file can be found under: presto-install-dir/server/apache-tomcat-5.5.20/webapps/presto/WEB-INF/classes
- Restart Presto Server.
- Login to Wires - http://server:port/wires and navigate to the "Actions" Tab. You should see the "ConvertToRSS" listed as one of the Action blocks.


Using the ConvertToRSS block in your Mashup
Lets use the ConvertToRSS block to generate a RSS feed for the list of Unread Leads from Salesforce. The Salesforce WSDL service is already part of your Presto install. To install the "salesforce" service, please run the "registersamples.sh" file from presto-install-dir/prestocli. For the purpose of this blog, Iam going to use a Mashup Service that I have implemented that queries Salesforce for Unread Salesforce leads (see EMML attachment). But you can use just about any service in a similar way.
1) Wire the output of Salesforce_UnreadLeads (WSDL based Mashup - created from the attached EMML) to the ConvertToRSS block.

2) Configure the Macro block

- Select the "itemPath". This must be mapped to the Array or the Collection within the source. This maps to "item" within the RSS format
- Other RSS Items such as itemTitle, itemDescription etc can be Strings that combine literals with Tokens. Eg: 'Name: [*:name], Source: [*:leadsource].
- Note: In this version of the ConvertToRSS block, all fields are required and tokens have to be specified using [*:token]. We will fix this in a subsequent version.
3) Run the ConvertToRSS Block and view the results in the RSS tab

4) Save and publish the Service. Lets say you saved it as: "SalesforceUnreadLeadsRSS". By default, Wires creates an operation by name "runMashup". Now go back to the home page - http://loalhost:8080/presto. You should see the newly created mashup listed under the "Mashup" section. Click on the link to see the Service description.

5) Click on the "Invoke REST API" button to invoke the Service using a URL. It should bring up a new browser window with the following URL: feed:http://localhost:8080/presto/edge/api/rest/SalesforceUnreadLeadsRSS/runMashup?presto_user=$session.presto_username&presto_password=$session.presto_password
6) If you have already logged in to Presto, you can remove the presto_user and presto_password: feed:http://localhost:8080/presto/edge/api/rest/SalesforceUnreadLeadsRSS/runMashup
7) If you have not logged in, you can pass in your username/password to this URL: feed:http://localhost:8080/presto/edge/api/rest/SalesforceUnreadLeadsRSS/runMashup?presto_user=admin&presto_password=adminadmin
8) See the output as RSS. Your browser should automatically format the output of this Service as a RSS feed. You can now bookmark this link to access this RSS anytime

Summary
We saw how easy it was for the end user to create a RSS feed out of a relatively complex WSDL based Service. We were able to "connect" the user to the data in a way that was previously tedious, time-consuming and in many cases, not possible.












