Skip to main content

Building enterprise mashup applications using Mainsoft SharePoint Federator and IBM WebSphere Portal

Roy Sheinfeld (roys@mainsoft.com), Product Manager, Mainsoft Corp.
Roy Sheinfeld (roys@mainsoft.com) works as the Product Manager for Mainsoft SharePoint Federator for WebSphere Portal, taking responsibility for defining the requirements and specifications for this new product. He is also part of a larger team working on Mainsoft's Java EE product suite. Roy started in the software industry eight years ago as a C++ and .NET developer; he has spent the last five years at Mainsoft, developing Microsoft-Java interoperability products.

Summary:  In this article, you learn to create a composite application that integrates the contents retrieved from a Microsoft SharePoint site with a custom Javaâ„¢ portlet running on IBM WebSphere Portal.

Date:  19 Aug 2008
Level:  Intermediate
Activity:  476 views

There are a number of reasons why you might want to incorporate content and data originally intended for Microsoft® SharePoint into WebSphere Portal. You might, for example, want to share Microsoft SharePoint content stored on a departmental server with enterprise users by exposing the data in an IBM® WebSphere® Portal server.

This article introduces Mainsoft SharePoint Federator, which can help you to easily incorporate SharePoint content inside WebSphere Portal. We take you through the steps of creating a composite application that integrates SharePoint content with a Google Map portlet.

The article assumes that you have some experience in developing portlets for WebSphere Portal.

Mainsoft SharePoint Federator

Mainsoft SharePoint Federator for WebSphere Portal offers ready to-use portlets that you can use to integrate SharePoint contents, such as document libraries, announcements, contacts, tasks, and customized lists, into WebSphere Portal.

The Federator offers two ready-to-use portlets: the SharePoint List Viewer portlet and the SharePoint Item Viewer portlet. The List Viewer portlet, which we use in this application, displays lists and documents stored in SharePoint sites. The SharePoint Item Viewer portlet displays the details of a single item from a SharePoint list.

You can use the SharePoint portlets to aggregate SharePoint lists and documents from multiple SharePoint sites and create a single, secure point of access. Data stored on SharePoint sites can fully participate in interportlet communications and composite applications.


Building mashups

The mashup application we build here retrieves a list of contacts from a SharePoint site and displays the address of a selected contact person on a map. It reflects what might actually be needed in an environment where SharePoint is used to store collaborative content, and when you want to incorporate this content into a WebSphere Portal composite application.

The mashup application consists of two portlets. The SharePoint List Viewer portlet, provided by Mainsoft, displays the SharePoint contacts list. The Google Map portlet, developed using IBM Rational® Application Developer, displays the address of a selected contact person on a map. Both portlets run natively on WebSphere Portal and interact using interportlet communication.

Interportlet communication refers to the capability of portlets to interact with each other by sharing information. One or more target portlets can automatically react to an action or event in the source portlet, so that users are not required to make repetitive changes or actions in other portlets on the page.

In this application, the SharePoint List Viewer is designed as a source portlet that interacts with other portlets using interportlet communication. When you click an item in the SharePoint list, the List Viewer portlet sends the item's details to all wired portlets, enabling them to automatically react, manipulate, and display the item in a customized way. In this application, the Java Google Map portlet serves as the target portlet, receiving the contact item details from the List Viewer portlet and displaying the contact person address on a map.


Creating the mashup application

To create this mashup application, you need to do the following:

  1. Install and configure the SharePoint List Viewer portlet to retrieve a contact list from a SharePoint site and display it in the WebSphere Portal environment.
  2. Develop a Google Map Java portlet using Rational Application Developer or IBM WebSphere Portlet Factory. The portlet receives a contact’s information and displays the contact's address on a map. The source listings for the GoogleMap.war file are included in this article. You can import the portlet application to Rational Application Developer and customize it, or you can use it as-is.
  3. Integrate the Google Map Java portlet with the List Viewer portlet using interportlet communication.

Install and configure the List Viewer portlet

Download the MainsoftSharePointFederator.war Web module from the Mainsoft Developer Zone, and install it. Assign the SharePoint List Viewer portlet to a page, and start configuring it by selecting Edit Shared Settings.

The first thing to configure is the URL for the SharePoint site, from which you want to take the contacts list. Click the Site URL configuration property, and supply a URL for an available SharePoint site. The format of the URL should be as follows:

http://<SharePoint-server>/<SharePoint-site>

Make sure that you do not supply a page name in the site URL.

For testing purposes, you can configure the portlet to use Mainsoft’s demo SharePoint site:

http://demo.mainsoft.com:8080/sites/sharepoint/

Next, supply the credentials to be used to authenticate users of the mashup application using SharePoint to provide a single sign-on user experience. The easiest way to set the credentials is to click Authentication and then click the Personalize your credentials link. Supply a user name and password for the SharePoint site. The supplied credentials are safely stored in WebSphere Portal, and they are used to retrieve the contacts list from the SharePoint site.

The user name for Mainsoft’s demo SharePoint site is sharepoint, and the password is sharepoint. See figure 1.


Figure 1. Configure the SharePoint site credentials
 Configure the SharePoint site credentials

To learn about the other authentication methods, read the white paper, "Mainsoft SharePoint Federator portlets."

Finally, click the List configuration property, and select a contact list from the drop-down list. If you are using Mainsoft’s demo SharePoint site, select the SharePoint Contacts list.

Click OK to view the contacts list of your SharePoint site within your WebSphere Portal environment.

Developing a Google Map Java portlet

The Google Map Java portlet gets contact details from the selected contact, retrieves the address information of the selected contact, and displays it on the map. You can use the portlet as-is, develop a similar portlet using WebSphere Portlet Factory, or import the GoogleMap.war file into Rational Application Developer to further customize it.

To receive the item information from the List Viewer portlet, the Google Map portlet uses a Web Services Description Language (WSDL) file that describes the shared parameter received from the List Viewer portlet.

The WSDL file used in the Google Map portlet looks like the code shown in listing 1.


Listing 1. WSDL file
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="ItemDetails_Service"
  targetNamespace="http://www.mainsoft.com/sharepointfederator"
  xmlns="http://schemas.xmlsoap.org/wsdl/"
  xmlns:portlet="http://www.ibm.com/wps/c2a"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:tns="http://www.mainsoft.com/sharepointfederator"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<types>
  <xsd:schema targetNamespace="http://www.mainsoft.com/sharepointfederator">
    <xsd:simpleType name="ItemDetailsType">
      <xsd:restriction base="xsd:string">
      </xsd:restriction>
    </xsd:simpleType>
  </xsd:schema>
</types>

<message name="ItemDetailsRequest">
  <part name="ItemDetails" type="tns:ItemDetailsType"/>
</message>

<portType name="ItemDetails_Service">
  <operation name="GetItemParameters">
     <input message="tns:ItemDetailsRequest"/>
  </operation>
</portType>

<binding
    name="GetItemParametersBinding"
      type="tns:ItemDetails_Service">
  <portlet:binding/>
  <operation name="GetItemParameters">
    <portlet:action name="ShowItemDetailsAction" type="standard" 
    caption="ShowItemDetails.action" description="Show Item Details"
    actionNameParameter="ACTION_NAME"/>
    <input>
      <portlet:param name="PrmItemDetails" partname="ItemDetails" 
      caption="ItemDetails"/>
    </input>
  </operation>
</binding>
</definitions>

The item details that are received from the List Viewer portlet come in the format of encoded XML. The XML contains all the fields and values of the selected item that are retrieved from the SharePoint site.

Listing 2 is an example of an XML string describing one of the selected contacts.


Listing 2. XML string describing one of the selected contacts
<ItemDetails>
  <Field name="ContentTypeId" value="0x0106006B44770AA0E44147B67E8B1803AC40B5" /> 
  <Field name="Title" value="Smith" /> 
  <Field name="_ModerationComments" value="" /> 
  <Field name="File_x0020_Type" value="" /> 
  <Field name="LastNamePhonetic" value="" /> 
  <Field name="FirstName" value="Ted" /> 
  <Field name="FirstNamePhonetic" value="" /> 
  <Field name="FullName" value="Ted Smith" /> 
  <Field name="Email" value="ted@somecompany.com" /> 
  <Field name="Company" value="SomeCompany" /> 
  <Field name="CompanyPhonetic" value="" /> 
  <Field name="JobTitle" value="Sales" /> 
  <Field name="WorkPhone" value="(490)567-5389" /> 
  <Field name="HomePhone" value="490-507-296305" /> 
  <Field name="CellPhone" value="490-523284900" /> 
  <Field name="WorkFax" value="490-8-9219389" /> 
  <Field name="WorkAddress" value="333 E. 48th New York NY" /> 
  <Field name="WorkCity" value="NYC" /> 
  <Field name="WorkState" value="NYC" /> 
  <Field name="WorkZip" value="12345" /> 
  <Field name="WorkCountry" value="USA" /> 
  <Field name="WebPage" value="http://www.blogspot.com, Ted blog" /> 
  …
</ItemDetails>

After the Google Map portlet receives the XML file, it extracts the address value, WorkAddress, from the string using a simple XPath expression:

public static final String ADDRESS_XPATH =
"//Field[@name='WorkAddress']/@value";

Listing 3 shows the code used to extract the address.


Listing 3. Extracting the address
/**
 * Reads the item details XML and returns the value of a specific field
 */
private static String getValueFromItem(String itemXml, String xpath) throws Exception {
	DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
	factory.setNamespaceAware(true);
	DocumentBuilder builder = factory.newDocumentBuilder();
	Document doc = builder.parse(new InputSource(new StringReader(itemXml)));
	doc.getDocumentElement().normalize();
	Node node = XPathAPI.selectSingleNode(doc, xpath);
	return node.getNodeValue();
}

The extracted address data is stored into the portlet’s session bean as shown in listing 4.


Listing 4. The portlet's session bean
//Handle the data that came from SharePoint List Viewer IPC 
try {
//Read the SharePoint contact
String contactDetails = StringUtils.decodeXML(request.getParameter(SHAREPOINT_ITEM));
//Find the contact's work address 
String address = getValueFromItem(contactDetails, ADDRESS_XPATH);
//Set the work address in the session bean
sessionBean.setAddress(address);
} 
catch (Exception ex) {
//Ignore errors for now
System.err.println(ex);
}

Then, when the portlet is rendered, the address is fetched from the session bean and passed to the JavaScriptâ„¢ method that renders the Google map.

Integrating the Google Map portlet with the List Viewer portlet

Now, let’s wire the two portlets together. First, assign the Google Map portlet to a page, either to the same page as the List Viewer portlet or to another page. Use the Portlet Wiring Tool to wire the List Viewer and Google Map portlets together. Click the Edit Page link of the page with the List Viewer portlet, and then click the Wires link. Create a Public wire, where the source portlet is the List Viewer and the target portlet is the Google Map that you have just created. The parameter passed between the portlets is called ItemDetails. See figure 2.


Figure 2. Wiring the portlets
Wiring the portlets

To see your application in action, click a contact person in your contacts list, and you see that person's address display on the map as shown in figure 3.


Figure 3. The mashup application in action
The mashup application in action

Conclusion

In just a few steps, you can use Mainsoft SharePoint Federator to create mashup applications that combine content stored on a SharePoint site with a Java portlet running on WebSphere Portal.

Now, you are on your way to using Mainsoft’s SharePoint federation technology to expose and integrate your SharePoint sites to enterprise or external audiences within your secured and scalable WebSphere Portal environment.



Download

NameSizeDownload method
GoogleMap.war12KBHTTP

Information about download methods


Resources

Learn

Get products and technologies

Discuss

About the author

Roy Sheinfeld (roys@mainsoft.com) works as the Product Manager for Mainsoft SharePoint Federator for WebSphere Portal, taking responsibility for defining the requirements and specifications for this new product. He is also part of a larger team working on Mainsoft's Java EE product suite. Roy started in the software industry eight years ago as a C++ and .NET developer; he has spent the last five years at Mainsoft, developing Microsoft-Java interoperability products.

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=330653
ArticleTitle=Building enterprise mashup applications using Mainsoft SharePoint Federator and IBM WebSphere Portal
publish-date=08192008
author1-email=roys@mainsoft.com
author1-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Rate a product. Write a review.

Special offers