Skip Headers
Oracle® WebCenter Wiki and Blog Server Installation, Configuration, and User's Guide
10g Release 3 (10.1.3.4.0)
E14106-01
  Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
 

6 Integrating Oracle WebCenter Wiki and Blog Server

Oracle WebCenter Wiki and Blog Server includes features that enable you to incorporate wikis and blogs into an application or portal. This chapter explains how to integrate wiki and blog functionality into your applications at design time.

This chapter includes the following sections:

6.1 Adding Wiki or Blogs to Your Application or Portal

You can add wikis or blogs to your application by using the following methods:


Note:

You can use Oracle Access Manager-based single sign-on to secure Oracle WebCenter Wiki and Blog Server. For information, see Chapter 4, "Configuring Single Sign-On".

The users you set up for your applications must match the user credentials on the Oracle WebCenter Wiki and Blog Server. Once a user is authenticated, if the user does not exist within the Oracle WebCenter Wiki and Blog Server, the user is created and a default role is assigned to the user.


6.1.1 Adding Wiki or Blogs by Using a Portlet

You can bring a wiki into your application through the Web Clipping portlet or any portlet capable of consuming a URL. For examples of portlets capable of consuming a URL, see the Oracle WebCenter Additional Services 10g Release 3 (10.1.3.4.0) page on OTN (http://webcenter.oracle.com).

Oracle WebCenter Framework includes a preconfigured Web Clipping portlet that you can register with your WebCenter application. You should also ensure that your application is secured, and that the login information of the users match that of the Oracle WebCenter Wiki and Blog Server.

Once you run your application to your browser, you can use the Web Clipping Studio to consume the desired URLs into your application. For information about the URL formats to use, see Section 6.2, "Wiki and Blog Server URL Endpoints and Query String Parameters".

You can also use a portlet to consume the URL. For more information about sample portlets that consume the URL, see the Oracle WebCenter Additional Services 10g Release 3 (10.1.3.4.0) page on OTN (http://webcenter.oracle.com).

Figure 6-1 Sample Wiki Portlet in an Application

Description of Figure 6-1 follows
Description of "Figure 6-1 Sample Wiki Portlet in an Application"

6.1.2 Adding Wiki or Blogs by Using an iFrame

You can add wiki and blogs to a page in your application by using an iFrame. To do so, simply reference the desired URL from within an iFrame, as shown in Example 6-1 and Figure 6-2. For information about URL formats to use, see Section 6.2, "Wiki and Blog Server URL Endpoints and Query String Parameters".

Example 6-1 Referencing a Wiki URL from an iFrame

<iframe src="http://server:port/owc_wiki/page/show.jz?inline=1&scope=domain"
width="100%"></iframe>

In this code, replace the server and port number with those of the Oracle WebCenter Wiki and Blog Server.

Figure 6-2 Sample Wiki Portlet in an iFrame at Runtime

Description of Figure 6-2 follows
Description of "Figure 6-2 Sample Wiki Portlet in an iFrame at Runtime"

6.1.3 Adding Wiki or Blogs by Using Sample Portlets

In your applications, you can add the sample portlets available on the Oracle Technology Network at the following URL:

http://webcenter.oracle.com

On the Oracle WebCenter Additional Services 10g Release 3 (10.1.3.4.0) page, you can learn more about the sample portlets, as well as how to download and install them.

6.1.4 Adding Wiki or Blogs by Using Web Services

Oracle WebCenter Wiki and Blog Server provides Web Services that enable interaction between your application and the wiki. You can add wikis and blogs to your applications by calling Web Services along with a custom-built user interface. This requires you to call the Web Services directly and create the user interface for interactions with the wiki and blog server. Alternatively, you can just redirect to the prebuilt wiki and blog pages.

To view sample portlets that call the Web Services, see the Oracle WebCenter Additional Services 10g Release 3 (10.1.3.4.0) page on OTN (http://webcenter.oracle.com).

For information about how to use Web Services, see Section 6.3, "Oracle Wiki Server Web Services Interface".

6.2 Wiki and Blog Server URL Endpoints and Query String Parameters

When you reach the point where you enter the wiki or blog source in the URL-consuming portlet or in the iFrame, use the formats provided in Table 6-1.

If you want to add a hyperlink that references a specific wiki page or a blog, on one of your application pages, use the URL formats provided in Table 6-2.

You can use wiki and blog query string parameters to define context (within the application context or external to it), and look and feel (page background colors and fonts). Query string parameters are bits of information you add to a URL to refine the behavior of the URL target. Table 6-3 lists and describes query string parameters you can use in custom WebCenter application wiki and blog URLs.

For more information about using these URLs and query string parameters in your application, see Section 6.1, "Adding Wiki or Blogs to Your Application or Portal".

Table 6-1 URL Formats for Exposing Wikis and Blogs in Applications

Type URL Format

Wiki

http://server:port/owc_wiki/page/show.jz?inline=1&scope=domain

General Blog

http://server:port/owc_wiki/blog/list.jz?inline=1&name=domain

Personal Blog

http://server:port/owc_wiki/blog/list.jz?inline=1&name=user


Table 6-2 Formats for Hyperlinks to Wikis and Blogs

Target URL Format

Wiki

http://server:port/owc_wiki/page/show.jz?inline=1&page=domain:wikiPageName

General Blog

http://server:port/owc_wiki/blog/list.jz?inline=1&name=domain

Personal Blog

http://server:port/owc_wiki/blog/list.jz?inline=1&name=user


Table 6-3 Query String Parameters to Use in Application Wiki and Blog URLs

Parameter Description

inline

  • Value of 0 sets the view to normal, displaying the default user interface and features of the wiki and blog server. This is the recommended mode for wiki administrators.

  • Value of 1 strips away nonessential wiki and blog chrome. It also renders left-side navigation that lists all wiki pages within the current domain. This is the recommended mode when integrating with an application or portal.

  • Value of 2 is similar to inline=1, except it turns off left-side navigation.

For information on how a wiki page looks on Oracle WebCenter Wiki and Blog Server when rendered in different inline modes, see Section 7.1, "What You Should Know About Wiki and Blog Modes".

name

Facilitates navigation to a specific blog, attributed either to a particular domain or user.

page

Facilitates navigation to a specific page in a specified domain. This variable follows the syntax: page=domain:wikiPageName.

scope

Navigates to the start page within the specified domain. If the specified domain does not exist, it automatically creates a new domain with the name specified for the scope variable.

If the scope variable creates the domain on the fly, it also creates the home page (WelcomePage) and redirects the user to that page.

theme

Dynamically applies the specified wiki theme to the requested page (the theme must already exist on both the wiki and blog server and the application server).

  • default applies the default theme specified on the server.

  • theme_name applies the specified wiki theme/CSS to the wiki page and all its children.

Oracle WebCenter Wiki and Blog Server provides seeded wiki themes, which you can include in your wiki and blog URLs. Use any one of the following (use the value in parenthesis in the session variable):

  • Deep Sea (deepsea)

  • Sand (sand)

  • WebCenter (webcenter)

  • Wiki Default (default)

  • Red (red)

  • Blue (blue)

  • Tech Gray (tech_gray)

  • Bighorn (bighorn)

  • Onyx (onyx)

  • Flat Irons (flatirons)

To ensure that your application chrome renders consistently, you may want to additionally place a copy of all seeded CSS files on your application server.

wcURL

Allows you to specify an encoded URL to which a domain and page are appended when the wiki and blog server renders links to wiki pages. This applies only when inline=1.

This parameter is useful for integrating wiki pages into a portal when you want wiki links to navigate to a portal location with an embedded wiki page rather than directly to the page on the wiki and blog server.


All of these URL formats can take query string parameters to focus the result provided on the target page. Parameters, such as inline and theme, are session-level variables. Once the URL passes session-level variables to the target, the variable values continue to apply, even if you leave and return to the original target page. Also, session-level variables are applied even when the parameter is not included in subsequent URLs.

6.3 Oracle Wiki Server Web Services Interface

Once you have installed the wiki and blog server, you can access the Web Services end point by using the following URL:

http://host:port/owc_wiki/services/WikiRemoteService

Note:

In this URL, the host and port information refers to the computer where you installed your wiki and blog server.

Oracle WebCenter Wiki Web Services provide access to obtain information and content from wiki pages and domains. It also enables the creation, modification, and removal of wiki pages and domains. You can use Oracle JDeveloper to create a proxy for the Web Services from the WSDL definition, located here:

http://host:port/owc_wiki/services/WikiRemoteService?WSDL

This section describes the Web Services interface. For information about the Web Services security, refer to Section 6.3.2, "Web Services Security".

6.3.1 Definition of the Interface

Some of the methods return information in JavaBeans. Table 6-4 shows the attributes of the DomainInfo and PageInfo beans. You can also use the getter methods of the described attributes, for example, long getCreated().

Table 6-4 Web Services Data Structures

DomainInfo Bean PageInfo Bean
String domain;
String domain;
String description;
String name;
String author;
int revision;
long created;
int views;
String startPage;
String author;

long created;

String editor;

long modified;

String viewURL;

String editURL;

The Web Services methods include methods for accessing and performing actions on the domains and pages in the wiki, the blogs, and blog entries, as described in the following tables.

Table 6-5 Domain-Related Methods

Return Type Method Description
DomainInfo[]
getAllDomainInfo(int maxResult, int offset, String key)

Returns a list of all domains.

DomainInfo
getDomainInfo(String domainName, String key)

Returns information about the specified domain.

void
createDomain (String domainName, String description, String startPage, String key)

Creates a domain with the specified attributes.

void
deleteDomain(String domainName, String key)

Deletes the specified domain.

PageInfo[]
getAllPageInfo (String domainName, int maxResult, int offset, String key)

Returns a list of all pages within a domain.

editDomainInfo
null editDomainInfo (String domainName, String description, String startPage, String key)

Modifies the specified domain with the specified attributes.


Table 6-6 Page-Related Methods

Return Type Method Description
PageInfo
getPageInfo (String domainName, String pageName, String key)

Returns information about the specified wiki page.

void
createPage (String domainName, String pageName, PageEditMode mode, PageType type, String key)

Creates a wiki page with the specified attributes.

This method supports different editing modes. These are editable by everyone, restricted to logged in users, restricted to members of the domainFoot 1 , and only admins are allowed to edit.Foot 2  The method also supports two page types: HTML and wiki markup.

void
deletePage (String domainName, String pageName, String key)

Deletes the specified wiki page.

String
getPlainPage (String domainName, String pageName, String key)

Returns the page content in the wiki markup format.

String
getRenderedPage (String domainName, String pageName, String key)

Returns the content rendered to HTML.

void
savePage (String domainName, String pageName, String content, String key)

The String content parameter takes text in the format that you specified in the type parameter while creating the wiki page.


Footnote 1 If the Wiki administrator has specified a list of members in Domains > Manage Members, "restricted to members of the domain" displays. The domain membership is otherwise open to all Wiki users.

Footnote 2 This option only displays if the currently authenticated user is an administrator of the Wiki.

Table 6-7 Administrative Methods

Return Type Method Description
String key
login (String username, String passcode)

Logs in a user and obtains the key that will be used on all subsequent Web service methods.

null
logout (String key)

Logs out the current user as defined by the passed key.


Table 6-8 Blog-Related Methods

Return Type Method Description
boolean
enablePersonalBlog (String description, boolean enable, String key)

Creates a personal blog for the user associated with the passed key (if it does not exist already). If the personal blog already exists, then this method does nothing.

String[]
getListofBlogs (BlogType type, String keyword, int maxResults, int offset, String key)

Returns a list of all blogs on the server (if BlogType is set to all), all personal blogs (if BlogType is set to user), or all blogs associated with domains (if BlogType is set to domain).


Table 6-9 Blog Entry-Related Methods

Return Type Method Description
String[]
getAllBlogEntries (String blogName, String key)

Returns a list of blog entries within the specified blog.

null
createBlogEntry (String blogName, String title, String content, String key)

Creates a blog entry in the specified blog with the specified title and content.

null
editBlogEntry (String blogEntryID, String title, String content, String key)

Modifies a specified blog entry with the specified title and content.

null
deleteBlogEntry (String blogEntryID, String key)

Deletes the specified blog entry.

String
getBlogEntry (String blogEntryID, String key)

Returns the content for the specified blog entry.


Table 6-10 Blog Comment-Related Methods

Return Type Method Description
String[]
getAllBlogEntryComments (String blogEntryID, String key)

Returns all comments on a blog entry.

void
createBlogEntryComment (String blogEntryID, String text, String key)

Creates a comment on the blog entry.


Table 6-11 Search-Related Methods

Return Type Method Description
SearchResult
SearchResult[] search (String searchText, SearchType type, int maxResults, String key)

Returns URLs to wikis and blog objects that contain the specified keywords (in searchText). You can constrain the size of the results, if desired. Valid values for SearchType are all, wiki, or blog, which specifies the type of content to search.


The APIs: getAllDomainInfo(), getAllPageInfo(), search(), and getListOfBlogs() support pagination. These APIs support the notion of “block fetch,” where the clients can specify the maximum number and block of results that should be returned.

The getAllDomainInfo(), getAllPageInfo(), and getListOfBlogs() APIs support two parameters, maxResults and offset, from which the desired (maximum) number of results will be returned. However, the calling client must maintain the state of offset or the cursor. Clients should choose and provide a fixed value for maxResults in repeated calls to the API to get the correct result.

For example, setting maxResults = 10, and offset set to 1, the first call returns the first 10 rows (if present). Subsequent calls increment the offset parameter (being maintained at the client side) with maxResults fixed at 10. The subsequent calls return rows from 11-20, 21-30 and so on until it returns all rows.

A value of <= 0 for maxResults returns the full result set in one call, without pagination. Also, offset <= 0 will also return the full result set in one call (without pagination), starting from the first row.

The search() method supports the maxResults parameter, which you can use to restrict the number of rows returned.

6.3.2 Web Services Security

All Oracle Wiki Server Web Services methods are protected to prevent unauthorized access. Every method contains a String key parameter to ensure authorized access. This key is generated as a function of a user's name and a preconfigured passphrase. The passphrase is an arbitrary string that the administrator sets up in the Oracle WebCenter Wiki and Blog Server application after installation. As the wiki and blog server developer, you need to obtain this passphrase in order to use the Web Services interface to access the wiki. For information about passphrase, see Section 3.7, "Generating the Passphrase".

To create the key, use the following method:

String key = client.login(username, passphrase); 

Note:

In this method, the username refers to the name of the user on whose behalf the Web Services is making the call (for example, the user logged into your WebCenter application who is accessing the wiki by means of a portlet) and passphrase refers to the parameter key that you configured, as described in Section 3.7, "Generating the Passphrase".

6.3.3 Example Java program

The following code is an example of a Java program that accesses the Web Services interface. This program will list all the page names in the Training domain.

package oracle.webcenter.wiki.ws.test;
import  oracle.webcenter.wiki.ws.*;
import  oracle.webcenter.wiki.security.*;
 
public class ListPages
{

In this example, because we have deployed the wiki to a server, using port 8888. We will hard code the Web Services end point to this URL. You can, however, parameterize the end point.

  private static final String endpoint =
    "http://localhost:6688/owc_wiki/services/WikiRemoteService";

Each Web Services method must authenticate the caller to the Web Services. Authentication consists of a user name and a preconfigured passphrase. In this example, we will hard code these values.

  private static final String username = "jsmith";
  private static final String passphrase = "passphrase";

We will also hard code the domain name in this example.

  private static final String domain = "Training";
 
  public static void main(String[] args) throws Exception
    {
      try
      {

Next, we will create a client-side proxy to access the Web Services.

      WikiRemoteServiceClient client =
          new WikiRemoteServiceClient();

We then set the end point of the proxy to the actual location where we deployed the Web Services.

      client.setEndpoint(endpoint);

Each Web Services method must pass a security key to authenticate the user and call the method. We can generate this key by calling the login Web service using the user's name and the Web Services-configured passphrase.

       String key = client.login(username, passphrase);

Using the Web Services proxy, we fetch into an array the information about all the pages in the selected domain: If there is no such domain, the program will throw an exception. If the domain does not contain any pages, the program returns an empty array.

      PageInfo[] pages = client.getAllPageInfo(domain, key);
      System.out.println("Pages in " + domain + " domain:");

Throughout the pages array, print the name of each page using the getter method getName().

      for (int i = 0; i < pages.length; i++)
      {
        System.out.println("  " + pages[i].getName());
      }
    }
  }

If there is an exception, the program captures the error and prints it.

    catch (Exception e)
    {
      System.out.println("Exception: " + e);
    }
  }

}