Consolidating SharePoint file lists with Lotus Connections widget

Source: Internet
Author: User
Tags web services java web wsdl

Brief introduction

As social software plays a more and more important role in enterprise work, the Lotus connections (LC), as an IBM enterprise user-oriented social collaboration software, has been deployed by many enterprises to improve productivity and manage internal resources. Microsoft SharePoint is also a popular enterprise collaboration platform in the industry, and its advantage lies in its efficient document management. In a business where both LC and SharePoint are deployed, to integrate the advantages of both, we can use the LC Flexible widget system to display the list of files in SharePoint in the widget for the LC. This allows users to obtain Cross-platform SharePoint Document information in LC homepage.

This article describes how to develop a homepage Widget to display a list of files for my Site in SharePoint in a typical environment that has SharePoint and LC installed. The reader can be familiar with the widget/iwidget development of Lotus connections through the examples given in this article.

The implementation of the project is divided into two parts: 1 use SharePoint-provided Web Services to get file-related information from the SharePoint MySite file list. 2 in Lotus connections, the development of a homepage Widget using the available file information. Customers can add this Widget to Lotus Connections's homepage to get their own list of files in SharePoint, and can go directly to SharePoint to download and edit the file by clicking on the link in the file list. All of the source code mentioned in this article can be obtained in the last download of the article.

accessing SharePoint Web Services

This section describes SharePoint Web services and how to access SharePoint Web services.

The SharePoint Web service is based on ASP.net, which opens up a series of WEB service interfaces to support interoperability and remote invocation. Most of the day-to-day tasks, such as site management, directory management, and data search, are available for SharePoint Web Service.

This article will use the list service in the SharePoint Web service (the lists Web service). With the list service, we can access lists and list data in SharePoint sites, such as files, file types, and so on. We will also invoke the Web Service provided by SharePoint through a JAVA client. In fact, all clients and platforms that can consume Web service can be used to access SharePoint-provided Web service.

The JAVA client here is based on the open source Apache project Axis (Version1.4). Axis is a widely used Java Web Service library that implements commonly used SOAP protocols, WSDL specifications, and so on. With Axis, we can implement the consumption and release of Web Service. Below we will detail how to access the list services in the SharePoint Web service.

The first step is to generate client interface files and proxy files based on WSDL.
Axis provides a tool "Wsdl2java" to generate the above file, you can find this tool in the Axis class library ("Org.apache.axis.wsdl.WSDL2Java"), its common usage is:

% java Org.apache.axis.wsdl.WSDL2Java (wsdl-file-url)

The wsdl-file-url here refers to the URL address of the list service in the SharePoint Web services, such as the WEB service address used in this article:

http://% Ip_address%/personal/phil/_vti_bin/lists.asmx

The second half of this address "/_vti_bin/lists.asmx" is a convention, and the first part is taken from your site name. You can verify that the URL is accurate by entering this address in your local browser.

Wsdl2java This command is successfully executed, you can import the generated Java class into the project, or you can compile it directly, package it into a jar package and put it into the project's Classpath.

The second step is to access the SharePoint list service based on the Java class/jar package that was generated earlier

The Java class Sharepointwsclient is created to encapsulate the specific invocation logic of the SharePoint Web Service. The core logic of this class is explained below:

Listing 1. Create proxy class instance for access list service

Contruct the WSDL 

address    
String 

wsdl_address=siteurl+ "personal/" +loginname+ "/_vti_bin/lists.asmx" ;    
          
Contruct the proxy    
Lists listservice = new Listslocator ();    
Listssoapstub proxy = (listssoapstub) listservice.    
Getlistssoap (New Java.net.URL (wsdl_address));    
       
Set Username/password for passing the Web service authentication    
proxy.setusername (accountname);    
Proxy.setpassword (Accountpass);

Listing 2. Call a specific list service method through this proxy class instance

Call to the SharePoint List Web service through proxy    
getlistitemsresponsegetlistitemsresult result = Proxy.getlistitems (    
        listname, "", NULL, NULL, ROWLIMIT, NULL, 

"");

Listing 3. Processing return results

messageelement element = Result.get_any () [0];    
Iterator it = element.getchildelements ();    
while (It.hasnext ()) {    
  messageelement dataelement = (messageelement) it.next ();    
  Iterator it2 = dataelement.getchildelements ();    
  while (It2.hasnext ()) {    
  messageelement entryelement = (messageelement) it2.next ();    
  Docentry doc = new Docentry ();      
  Doc.setdocname (Entryelement.getattribute ("Ows_linkfilename"));    
  Doc.setdoclink (Siteurl+entryelement.getattribute (

"Ows_fileref"). Substring (3));    
      try{    
       doc.setlastmodified_date (dateutils.parsedate    
              entryelement.getattribute ("ows_modified"), DateFormat));  

  
  } catch (Exception e) {}}}}    

Development IWidget

The IWidget specification is developed by IBM to define and standardize the browser-side component model. The IWidget specification is widely used in multiple IBM product lines, such as Lotus connections, Mushup Center, and so on.

In Lotus connections, you can see that many user interface components are made up of widgets. Currently Lotus connections V2.5 supports iWidget1.0 specifications. Here we'll explain how to develop a user-defined widget and deploy it on the Lotus Connections home page.

Since widgets are essentially a Web application, we first need to build a Web project. The following IBM Rational application Developer 7.0 for example. Create a Dynamic Web project. (Figure 1)

Figure 1. Create a project in IBM Rational application Developer 7.0

The widget consists primarily of two key files, an XML description file that contains the definition of the widget; The other is the JavaScript file, which contains the functional logic of the widget. So we're going to create these two files separately under Project Web content: Sharepoint_widget.xml,sharepoint_widget.js.

In addition to creating these two key files, we also need to add DOJO's JavaScript library. Although the IWidget specification does not specify what specific technology to use to implement IWidget, but because Lotus connections is based on dojo to achieve IWidget specification, we also use Dojo to help us implement the core functions of the Widget 。 The structure of the project after joining the DOJO library is as shown in (Figure 2)

Figure 2. Project structure after joining the DOJO library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.