AquaLogic User Interaction Development Guide

     Previous Next  Open TOC in new window   View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Initiating a PRC Session to Use IDK Remote APIs

To use the IDK's Programmable Remote Client (PRC) Remote APIs, you must first establish a session with ALI or Ensemble.

The session is used to manipulate objects via the PRC. Once you have initiated a session, you can use PRC methods to manipulate AquaLogic objects.
Note: Before writing any code, you must prepare a custom project that references the standard IDK library (idk.jar/idk.dll).
To establish a session with the portal, acquire a reference to an IRemoteSession object. The simple code examples below do the following:
  1. Create a new class (HelloWorldSession).
  2. Create a new remote session using RemoteSessionFactory. The code below logs in with a user name of "administrator" and no password. You can also access an IRemoteSession through the IDK portlet and proxy APIs (IPortletContext.GetRemoteSession or IProxyContext.GetRemoteSession).
    Note: You must configure ALI or Ensemble to send a login token to any pagelet that uses the PRC. In ALI, the login token option is on the Advanced Settings page of the Web Service editor. In Ensemble, this option is on the CSP tab in Resource configuration.
  3. Print out the portal API version from the remote session.

Java:

import java.net.URL;
import com.plumtree.remote.prc.*;
public class HelloWorldSession
{
public static void main(String[] args) throws Exception
{
try
{
IRemoteSession session = RemoteSessionFactory.getExplicitLoginContext(
new URL("http://portalserver/ptapi/services/QueryInterfaceAPI"),
 "administrator","");

 System.out.println(session.getAPIVersion());
 }
 catch(Exception e)
 {
 System.err.println(e.getMessage());
 e.printStackTrace(System.err);
 }
 }
}

.NET (C#):

using System;
using Plumtree.Remote.PRC;
public class HelloWorldSession
{
 public static void Main(string[] args)
 {
 try
 {
 IRemoteSession session = RemoteSessionFactory.GetExplicitLoginContext(
 new Uri("http://portalserver/ptapi/services/QueryInterfaceAPI"),
 "administrator","");

 Console.Out.WriteLine(session.GetAPIVersion());
 }
 catch(Exception e)
 {
 Console.Error.WriteLine(e.Message);
 Console.Error.WriteLine(e.StackTrace); 
 }
 }
}

.NET (VB):

Imports System
Imports Plumtree.Remote.PRC
Module HelloWorldSession

 Sub Main()
 Try
 Dim session As IRemoteSession
 session = RemoteSessionFactory.GetExplicitLoginContext( _
 New Uri("http://portalserver/ptapi/services/QueryInterfaceAPI"), _
 "administrator", _"")
 Console.Out.WriteLine(session.GetAPIVersion())
 Catch e As Exception
 Console.Error.WriteLine(e.Message)
 Console.Error.WriteLine(e.StackTrace)
 End Try
 End Sub

End Module

  Back to Top      Previous Next