Skip Headers
Oracle® Discussions Application Developer's Guide
10g Release 1(10.1.2)
B28208-02
  Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

15 Understanding the RSS URL Service

RSS (Rich Site Summary) protocol RSS is a Web content syndication format. RSS aggregators reduce the time and effort needed to regularly check the Web sites of interest for updates, creating a unique information space. An aggregator is able to subscribe to a feed, check for new content at user-determined intervals, and retrieve the content. The content is sometimes described as being pulled to the subscriber.

Oracle Discussions provides RSS feeds for containers, topics and other elements of Oracle Discussions. An aggregator can be used to subscribe to the feed published by Oracle Discussions. The aggregator polls Oracle Discussions server and pulls the latest feed. These new updates are shown as a pop-up window on the system tray on the desktop.

RSS URL Service returns the URLs of various RSS feeds provided by Oracle Discussions.

Retrieving a RSS URL

The following is an example for retrieving a RSS URL for a category and a forum:

Example 15-1 Retrieving a RSS URL

import java.util.Date;import java.io.*;import java.util.*;import javax.mail.*;import javax.mail.internet.*;

import org.apache.axis.transport.http.HTTPConstants;import oracle.discussions.ws.exceptions.TdWSException;import oracle.discussions.ws.beans.*;import oracle.discussions.ws.AuthenticationServiceServiceLocator;import oracle.discussions.ws.AuthenticationServiceSoapBindingStub;import oracle.discussions.ws.AuthenticationService;import oracle.discussions.ws.RssUrlServiceServiceLocator;import oracle.discussions.ws.RssUrlServiceSoapBindingStub;import oracle.discussions.ws.RssUrlService;

public class WSClient{  private static AuthenticationService as = null;    public static String getCookie() throws Exception  {      //STEP - 0: User Login      //Create the service locator for authentication service. The locator
      //contains information about the web Services endpoint              AuthenticationServiceServiceLocator assl = new
                             AuthenticationServiceServiceLocator();            //Get the handle to the actual webservices interface.             as = assl.getAuthenticationService();            //Indicate to the server that the client is interested in maintaining
            //session.            //HTTP is stateless and the user state is maintained in the session.            //Unless the user is willing to participate in a session, user state
            //cannot be preserved.             ((AuthenticationServiceSoapBindingStub)as).setMaintainSession(true);            //Invoke the actual login webservices call.              as.login("td_superuser","welcome1");            //Retrieve the cookie. The cookie is set on successful authentication
             String cookie = (String)((AuthenticationServiceSoapBindingStub)as)
                                  ._getCall().getMessageContext()
                                  .getProperty(HTTPConstants.HEADER_COOKIE);             System.out.println("Cookie : " + cookie);             return cookie;         }        public static void main(String args[])         {          try          {             //STEP - 0: User Login             String cookie = getCookie();                //STEP - 1: Locate the web services end point            //The web services locator contains the webservices end point address            //Hence instantiate the service locator             RssUrlServiceServiceLocator russl = new
                                RssUrlServiceServiceLocator();            //Get a handle to the actual web service.             RssUrlService rus = russl.getRssUrlService();            //Indicate to the server that the user is willing to participate in
            //the session.            //Since HTTP is stateless, all the client data is maintained in the
            //session.             ((RssUrlServiceSoapBindingStub)rus).setMaintainSession(true);            //Set the cookie retrieved in the call to login webservice.            //The cookie asserts user's identity to the server.
             ((javax.xml.rpc.Stub)rus)._setProperty(HTTPConstants.HEADER_
                                                     COOKIE,cookie);            //Invoke the actual web services call. Change the ID accordingly             System.out.println("Url :" + rus.getContainerRssUrl(11212));            //STEP - 2: User Logout             logout();           }           catch(TdWSException ex)           {            System.out.println("Error Code :" + ex.getErrorCode());            System.out.println("Error Message :" + ex.getErrorMessage());            String[] trace = ex.getServerStackTrace();            if(trace != null)            {              for(int i = 0 ; i < trace.length ; i++)                 System.out.println("trace[" + i + "]" + trace[i]);             }            }     catch(Exception ex)     {
         System.out.println("Never went into tdex :" + ex.getMessage());           ex.printStackTrace();     }   }   public static void logout() throws Exception   {       System.out.println("User logout.");       //Once all the webservices operations are done, invoke logout        //operation.       //On logout, user state is destroyed and the cookie is invalidated.       as.logout();       System.out.println("Done");    }
}

The getContainerRssUrl() method returns the RSS URL of the container depicted by the supplied container ID. RSS URL depicting a category or forum is returned, depending on if the supplied container id corresponds to a category or forum. On copying the category URL into a browser, RSS feed with details about all the containers in the category is printed on the browser screen. On copying the forum URL, a feed with all the topics in the forum is printed.

The sample output for Example 15-1 is as follows:

Cookie : JSESSIONID=8c57046a22b8492acb2e79ef4e6db6d9a0ee83eeb356The Rss Url : http://stacx01.us.oracle.com:7777/discussions/rss/fid=11212