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 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.
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:
- 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.
- 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.
- 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
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
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
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.
| Name | Size | Download method |
|---|---|---|
| GoogleMap.war | 12KB | HTTP |
Information about download methods
Learn
-
Read the developerWorks® article, "Mashups: The new breed of Web app."
-
Learn more about Building Google Gadgets on developerWorks.
-
Learn more about interportlet communication in cooperative portlets.
-
Learn more about Rational Application Developer for WebSphere Software.
-
Read the white paper, " Federating SharePoint Sites within WebSphere Portal."
-
Learn about installing and configuring the Mainsoft SharePoint Federator portlets.
-
Read the WebSphere Portal product documentation.
Get products and technologies
-
Download the SharePoint Federator portlets.
-
Download the SharePoint Federator SDK.
-
Download IBM Rational Application Developer for WebSphere v7.5 Open Beta.
-
Download IBM Portlet for Google Gadgets from the WebSphere Portal catalog.
-
Download a trial version of WebSphere Portal Express V6.
Discuss
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)





