21 Integrating Oracle WebCenter Wiki and Blog Server

This chapter explains how to integrate wiki and blog functionality into a custom WebCenter application.

This chapter includes the following sections:

21.1 Introduction to the Wiki and Blog Services

A wiki is a collection of useful content or information that users can browse and can update and remove, sometimes without the need for registration. This ease of interaction and the variety of operations makes wiki an effective tool for collaborative authoring, where multiple people create written content together using the wiki markup language.

Blogs provide a useful tool for discussing and/or evangelizing any type of idea, strategy, or point of view. Blogs may be projected out to a select group of people or to a wider audience. Typically, blogs invite readers to comment on the overall concepts.

You integrate wikis and blogs into your applications by using the Wiki and Blog services. This section contains the following subsections:

21.1.1 Understanding the Wiki and Blog Services

You can expose the wiki and blog functionality into your existing portal, application, or web site. The Wiki service enables you to incorporate wikis, and the Blog service enables you to expose blogs on your application pages. There is no limitation on the number of wiki pages or blogs you expose in an application.

21.1.2 Requirements for the Wiki and Blog Services

The Wiki and Blog services rely on Oracle WebCenter Wiki and Blog Server. For information about installing Oracle WebCenter Wiki and Blog Server, see the Oracle Fusion Middleware Installation Guide for Oracle WebCenter. For information about configuring the server, see the "Managing the Wiki and Blog Services" chapter in the Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

21.1.3 What Happens at Runtime

When you expose wikis and blogs into your custom WebCenter application, then at runtime you can add, edit, print, and delete wiki pages and blog entries. You can also add and remove blog comments and define the blog authors who can manage a blog. To work with wiki content at runtime, you use wiki HTML Editor controls or the wiki markup language.

The wiki and blog server functionality exposed at runtime in your custom WebCenter application depends on the value that you specify for the inline query string parameter while integrating a wiki or blog into your application. For example, if inline=0, the default user interface of the wiki and blog server is displayed. It includes a toolbar of useful links across the top of the page, a search feature, and additional navigation under the General heading. Figure 21-1 depicts a wiki page rendered with inline=0 in a custom WebCenter application.

For information about the Wiki and Blog services at runtime, see the "Working with Wikis and Blogs" chapter in the Oracle Fusion Middleware User's Guide for Oracle WebCenter.

Figure 21-1 Wiki Page Rendered in Inline=0 Mode

Description of Figure 21-1 follows
Description of "Figure 21-1 Wiki Page Rendered in Inline=0 Mode"

21.2 Basic Configuration for the Wiki and Blog Services

This section describes required steps for adding wikis and blogs to your application or portal. It contains the following subsections:

21.2.1 Adding Wikis or Blogs to Your Application or Portal

You can expose the wiki and blog functionality into your custom WebCenter applications by using any of the following integration methods:

  • Through the Web Clipping portlet or any portlet capable of consuming a URL

  • Through an IFRAME, which you include in a page in your custom WebCenter application

  • Through the use of a custom-built user interface that you can create using the provided web services

Sample portlets that demonstrate some of these integration methods are located on the Oracle Technology Network (OTN). You can download the sample portlets from the Oracle WebCenter Suite 11g Demonstrations and Samples page on the OTN at the following URL:

http://www.oracle.com/technology/products/webcenter/release11_demos.html

From this link, you can learn more about the sample portlets, as well as how to download and install them.

Note:

You can use Oracle Access Manager-based single sign-on, Oracle Single Sign-On (OSSO), and SAML-based security to secure Oracle WebCenter Wiki and Blog Server. For information, see the "Configuring a WebCenter Application to Use Single Sign-On" section in the Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

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

This section contains the following subsections:

21.2.1.1 Adding Wikis or Blogs by Using a Portlet

You can bring a wiki into your application through a Web Clipping portlet or any portlet capable of consuming a URL. For examples of portlets capable of consuming a URL, see the Oracle WebCenter Suite 11g Demonstrations and Samples page on OTN here:

http://www.oracle.com/technology/products/webcenter/release11_demos.html

Oracle WebCenter Framework includes a preconfigured Web Clipping portlet producer. You can register the Web Clipping portlet producer with your custom WebCenter application and add a Web Clipping portlet. For information about adding a Web Clipping portlet, see Chapter 36, "Creating Content-Based Portlets with Web Clipping." Ensure that your application is secured and the user credentials defined in your application match with the user credentials on Oracle WebCenter Wiki and Blog Server.

After adding a Web Clipping portlet, when you run your custom WebCenter 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 for integrating wikis and blogs into your application, see Section 21.2.2, "Oracle WebCenter Wiki and Blog Server URL Endpoints and Query String Parameters."

Figure 21-2 shows a sample wiki portlet integrated into an application.

Figure 21-2 Sample Wiki Portlet in an Application

Description of Figure 21-2 follows
Description of "Figure 21-2 Sample Wiki Portlet in an Application"

21.2.1.2 Adding Wikis or Blogs by Using an IFRAME

You can add wikis and blogs to a page in your application with an IFRAME. Simply reference the desired URL from within an IFRAME, as shown in Example 21-1 and Figure 21-3. For information about URL formats to use, see Section 21.2.2, "Oracle WebCenter Wiki and Blog Server URL Endpoints and Query String Parameters."

Example 21-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>

Where:

server:port refer to the server name and port number of the system where your Oracle WebCenter Wiki and Blog Server is deployed.

domain refers to the name of the wiki domain that you want to integrate into your application.

Figure 21-3 shows an example of how you can use an IFRAME to integrate wiki. This example shows this being done using a portlet.

Figure 21-3 Sample Wiki Portlet in an IFRAME at Runtime

Description of Figure 21-3 follows
Description of "Figure 21-3 Sample Wiki Portlet in an IFRAME at Runtime"

21.2.1.3 Adding Wikis or Blogs by Using Web Services

Oracle WebCenter Wiki and Blog Server provides web services that enable interaction between your application and the wiki server. 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 Oracle WebCenter Wiki and Blog Server. Alternatively, you can just redirect to the prebuilt wiki and blog pages.

For information about how to use web services, see Section 21.2.3, "Oracle WebCenter Wiki and Blog Server Web Services Interface."

21.2.2 Oracle WebCenter Wiki and Blog Server URL Endpoints and Query String Parameters

While integrating a wiki or blog into your application, 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 21-1.

On one of your application pages if you want to add a hyperlink that references a specific wiki page or blog, then use the URL formats provided in Table 21-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 21-3 lists and describes query string parameters you can use in custom WebCenter application wiki and blog URLs.

For information about using these URLs and query string parameters in your custom WebCenter application, see Section 21.2.1, "Adding Wikis or Blogs to Your Application or Portal."

Table 21-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


In Table 21-1, server and port refer to the server and port number where Oracle WebCenter Wiki and Blog Server is installed, and owc_wiki refers to your Oracle WebCenter Wiki and Blog Server deployed application.

Table 21-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 21-3 Query String Parameters Available for Use in Wiki and Blog URLs

Parameter Description

inline

  • Value of 0 sets the view to normal, displaying the default user interface and features of Oracle WebCenter Wiki and Blog Server. This is the recommended mode for wiki administrators.

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

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

For information about how a wiki page looks on Oracle WebCenter Wiki and Blog Server when rendered in different inline modes, see the "Working with Wikis and Blogs" chapter in the Oracle Fusion Middleware User's Guide for Oracle WebCenter.

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. In general, you should include both the domain and the page name to reduce the potential for any ambiguity.

scope

Navigates to the start page within the specified domain. If the specified domain does not exist, then 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 (Welcome Page) and redirects the user to that page.

theme

Dynamically applies the specified wiki theme to the requested page (for usage other than with IFRAMEs, the theme must already exist on both the Oracle WebCenter 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)

  • Midnight (onyx)

  • Flatirons (flatirons)

  • Blue Sky (bluesky)

  • Dew (olive)

  • Dusk (monochrome)

  • Mist (white)

  • Storm (storm)

If you create your own themes, then for your application chrome to render consistently, you must ensure that the CSS files you use reside on both the server containing your Oracle WebCenter installation and the Oracle WebCenter Wiki and Blog Server.

wcURL

Allows you to specify an encoded URL to which a domain and page are appended when Oracle WebCenter 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 Oracle WebCenter Wiki and Blog Server.


All of the URL formats specified in Table 21-1 and Table 21-2 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.

21.2.3 Oracle WebCenter Wiki and Blog Server Web Services Interface

After Oracle WebCenter Wiki and Blog Server is installed, you can access the Oracle WebCenter Wiki and Blog Server Web Services end point with the following URL:

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

Where, the host and port refer to the host name and port number of the system where Oracle WebCenter Wiki and Blog Server is installed.

Oracle WebCenter Wiki and Blog Server Web Services provide access to the content in wiki pages and domains. Web Services also enable the creation, modification, and removal of wiki pages and domains. You can use Oracle JDeveloper (or other tools) 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 Oracle WebCenter Wiki and Blog Server Web Services interface. It contains the following subsections:

21.2.3.1 Definition of the Interface

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

Table 21-4 Data Structures of Oracle WebCenter Wiki and Blog Server Web Services

DomainInfo Bean PageInfo Bean BlogInfo Bean BlogEntryInfo Bean SearchResult Bean
String domain;
String domain;

int entryCount;

String author;

String author;

String description;
String name;

long id;

String blogName;

String domain;

String author;
int revision;

String name;

long blogid;

String fragment;

long created;
int views;

String parent;

int commentCount;

String lastUpdate;

String startPage;
String author;

BlogType type;

String content;

String oid;

 
long created;
 

String created;

String pageName;

 
String editor;
 

String editURL;

String tags;

 
long modified;
 

long id;

String type;

 
String viewURL;
 

String title;

String url;

 
String editURL;
 

String viewURL;

 
     

String wcURL;

 

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

Table 21-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
editDomainInfo (String domainName, String description, String startPage, String key)

Modifies the specified domain with the specified attributes.


Table 21-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)

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

PageInfo

getAllPageInfoBetweenDates (String startDate, String endDate, int maxResults, int offset, String key)

Returns details about all pages created or updated within the specified date range. The default date format is MM/dd/yyyy HH:mm.

String

getTotalPageCount(String key)

Returns the total number of wiki pages across all wiki domains.

String

getTotalPageCountByDate(String startDate, String endDate, String key)

Returns the total number of pages created or updated within a given date range. The default date format is MM/dd/yyyy HH:mm.


Footnote 1 The "restricted to members of the domain" option is displayed only if the wiki administrator has configured a list of domain members. The domain membership is otherwise open to all wiki users.

Footnote 2 The "only admins are allowed to edit" option displays only if the currently authenticated user is a wiki administrator.

Table 21-7 Administrative Methods

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

Logs in a user and obtains the key that is used on all subsequent web service methods. The web service login expires after 30 minutes.

null
logout (String key)

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

null
addRoleToUser (String roleName, String user, String key)

Assigns a role to the specified user.

null
deleteRoleFromUser (String roleName, String user, String key)

Removes the specified role from a user.

null
createRole (String roleName, String key)

Creates a new role.

null
deleteRole (String roleName, String key)

Deletes a role.

null
addPermissionToRole (String roleName, String permID, String key)

Adds the specified permission to a role.

null
removePermissionFromRole(String roleName, String permID, String key)

Removes the specified permission from a role.

null
addUserAsDomainMember(String domainName, String user, String key)

Adds a user as a member of the specified domain.

null
deleteUserAsDomainMember(String domainName, String user, String key)

Removes a user from domain membership.

null
addRoleAsDomainMember(String domainName, String role, String key)

Adds a specified role as the member of a domain.

null
deleteRoleAsDomainMember(String domainName, String role, String key)

Removes a specified role from a domain membership.


Table 21-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).

BlogInfo
getBlog (String blogName, String key)

Returns the following information about the requested blog: entry count (number of blog entries), ID of the blog, blog name, the parent (the user's name or the domain name), and the type (user or domain blog).


Table 21-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.

Only a blog author, a wiki administrator, or users identified as additional blog authors can execute this method. If the blog is a domain blog, then only a wiki administrator can perform this task. For information about additional blog authors, see the "Adding and Removing Additional Blog Authors" in the Oracle Fusion Middleware User's Guide for Oracle WebCenter.

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

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

Only a blog author, a wiki administrator, or users identified as additional blog authors can execute this method. If the blog is a domain blog, then only a wiki administrator can perform this task.

null
deleteBlogEntry (String blogEntryID, String key)

Deletes the specified blog entry.

Only a blog author, a wiki administrator, or users identified as additional blog authors can execute this method. If the blog is a domain blog, then only a wiki administrator can perform this task.

String
getBlogEntry (String blogEntryID, String key)

Returns the content for the specified blog entry.

BlogEntryInfo[]
getBlogEntryObject(String blogEntryID, String key)

Returns a blog entry object that includes meta data about the blog entry as well as the actual content of the entry.

BlogEntryInfo[]
getAllBlogEntryObjects(String blogName, String key)

Returns all blog entry objects within the specified blog.

BlogEntryInfo[]
getAllBlogEntryObjectsByBlogAndDate(String blogName, String startDate, String endDate, String key)

Provides a list of blog entry objects (meta data and content) within the specified blog for entries created or modified between the provided dates.

BlogEntryInfo
getAllBlogEntryObjectsByDate(String startDate, String endDate, String key)

Returns all blog entry objects created or modified between the specified dates.

String[]
getAllBlogEntriesBetweenDates(String startDate, String endDate, String key)

Returns a list of blog entry IDs for entries created or modified in the specified date range.

String[]
getAllBlogEntriesByBlogAndDate(String blogName, String startDate, String endDate, String key)

Provides a list of blog entry IDs within the specified blog for entries created or modified between the provided dates.

String
getTotalBlogEntryCount(String key)

Returns the total number of blog entries.

String
getTotalBlogEntryCountByDate(String startDate, String endDate, String key)

Returns the total number of blog entries created or modified between the provided dates.


Table 21-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 21-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 keywords specified 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 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 are 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=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 returns 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.

21.2.3.2 Oracle WebCenter Wiki and Blog Server Web Services Security

All Oracle WebCenter Wiki and Blog 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 passcode. The passcode is an arbitrary string that an administrator creates in the credential store of the domain in which Oracle WebCenter Wiki and Blog Server has been deployed. As a developer, you need to obtain this shared passcode to use the Web Services interface to access Oracle WebCenter Wiki and Blog Server. For information about the passcode, see the "Generating the Passcode" section in the Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

To create the key, use the following method:

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

Where:

  • username refers to the name of the user on whose behalf Web Services is making the call (for example, the user logged into your custom WebCenter application who is accessing the wiki by means of a portlet).

  • passcode refers to the shared password credential created by the administrator.

21.2.3.3 Generating the Web Services Client Stub

To use the Oracle WebCenter Wiki and Blog Server Web Services client proxy, you must generate the Web Services client stub on Oracle WebLogic Server. After the client stubs have been created, you can use them in a custom WebCenter application.

To generate the Web Services client stub by using Oracle JDeveloper:

  1. In Oracle JDeveloper, create a generic application and add the Web Services project technology.

  2. From the File menu, select New.

  3. In the New Gallery dialog, under Business Tier, select Web Services, and then in the panel on the right, select Web Service Proxy.

  4. In the Create Web Service Proxy wizard, on the Create Web Service Proxy page, click Next.

  5. On the Select Web Service Description page, in the WSDL Document URL field, specify the WSDL for Web Services. For Oracle WebCenter Wiki and Blog Server, enter the WSDL in the following format:

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

    Where server and port refer to the server name and port number of the system where Oracle WebCenter Wiki and Blog server is installed.

  6. Click Next.

  7. On the Select Web Service Description page, in the Package Name field, specify the Java package and click Next.

  8. On the Custom Mappings page, click Next.

  9. On the Defined Handlers page, click Next.

  10. Click Finish.

    The service endpoints interfaces and methods are generated, as displayed in Figure 21-4.

    Figure 21-4 Generating Service Endpoints Interfaces and Methods

    Description of Figure 21-4 follows
    Description of "Figure 21-4 Generating Service Endpoints Interfaces and Methods"

  11. Create a new Java class, specifying the package you selected in step 7.

  12. In the Java class, add the code to access the Web Services interface. A sample code is described in Section 21.2.3.4, "Sample Code for Accessing the Web Services Interface." If you use the sample code, you must specify your own data for details such the user name, passcode, and domain.

  13. Right-click the page source and click Run.

21.2.3.4 Sample Code for Accessing the Web Services Interface

The following code is an example of a Java program that accesses the Web Services interface. This program lists all the page names in the Training domain. You must first create a web service proxy to use this code in a Java class.

package wiki;
import  wiki.WikiService;
import  wiki.WikiServiceService_Impl;
import  wikiservice.PageInfo;
 
public class ListPages {

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

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

We code the domain name in this example.

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

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

      WikiServiceService_Impl myImpl = new WikiServiceService_Impl();

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

      WikiService Service = myImpl.getWikiRemoteService();

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 passcode.

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

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, then the program throws an exception. If the domain does not contain any pages, then 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, then the program captures the error and prints it.

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

For more examples of portlets capable of consuming a URL, see the Oracle WebCenter Suite page on the Oracle Technology Network (http://webcenter.oracle.com).

21.3 Advanced Information for the Wiki and Blog Services

Adding a Search Analyzer

Oracle WebCenter Wiki and Blog Server leverages the Lucene search engine for tokenizing wiki content (that is, to determine what constitutes a word). Lucene enables you to use custom search analyzers, which are language-specific extensions that you can use to add required rules, such as rules for separating words and ignoring the case. For example, Oracle WebCenter Wiki and Blog Server provides out-of-the-box support for multibyte characters. However, the search engine implementation in Oracle WebCenter Wiki and Blog Server does not support the ability to tokenize wiki content on anything other than whitespace. You can add your own search analyzer that provides the ability to search for multibyte characters.

To add a custom search analyzer:

  1. Place the JAR file containing the .class files for your custom analyzer in the WEB-INF/lib folder of your deployed Oracle WebCenter Wiki and Blog Server.

  2. Open the application_config.script file from the WEB-INF/classes folder of your deployed Oracle WebCenter Wiki and Blog Server.

  3. Search for the custom_analyzer entry under wiki.

  4. Update the custom_analyzer entry to include the full package and class name of your search analyzer in which you have added the required rules.

    For example, if you are using the Chinese Sandbox, then the entry should look like:

    custom_analyzer : org.apache.lucene.analysis.cn.ChineseAnalyzer
    

    Note:

    If the custom_analyzer entry does not exist, add the entry in application_config.script.
  5. Save the application_config.script file.

  6. Restart your Oracle WebCenter Wiki and Blog Server.