Difference between revisions of "Calling On Demand Tasks"

From PresenceWiki
Jump to: navigation, search
Line 11: Line 11:
 
==3: Through the On Demand API==
 
==3: Through the On Demand API==
  
        This is a lightweight implementation, so that the jars you will need for this are
+
This is a lightweight implementation, so that the jars you will need for this are
 
          
 
          
 
         presenceOnDemand.jar
 
         presenceOnDemand.jar
Line 21: Line 21:
 
         xercesImpl.jar
 
         xercesImpl.jar
  
        As well as this you will need a copy of install.inf in a res directory  
+
As well as this you will need a copy of install.inf in a res directory  
        and a copy of presenceconfig.xml into a res\config directoy
+
and a copy of presenceconfig.xml into a res\config directoy
  
        After this you can create OnDemandRequest in your java code
+
After this you can create OnDemandRequest in your java code
  
 
         OnDemandRequest request = new OnDemandRequest();
 
         OnDemandRequest request = new OnDemandRequest();

Revision as of 13:51, 6 April 2009

There are 3 ways to call OnDemand Tasks

1: Via a tag in the web file

         <presence:remote-task presenceHost="presenceserver.com" alias="newtime" />

2: Through the url by referencing the http server followed by 'task' and then the task alias

         http://localhost/task/newtime

3: Through the On Demand API

This is a lightweight implementation, so that the jars you will need for this are

       presenceOnDemand.jar
       presenceCommon.jar
       pbtools57.jar
       pbembedded57.jar
       pbclient57.jar
       log4j-1.2.8.jar
       xercesImpl.jar

As well as this you will need a copy of install.inf in a res directory and a copy of presenceconfig.xml into a res\config directoy

After this you can create OnDemandRequest in your java code

       OnDemandRequest request = new OnDemandRequest();
       request.setTimeOut(3000);
       request.setHost("192.168.1.103");
       request.setPort(8221);
       request.setRequestParameters(null);
       request.setAlias("newtime");
       try
       {
            request.makeRequest();
            System.out.print (request.getResponse());	
       }
       catch (IOException e) 
       {
            e.printStackTrace();	
       }
       catch (GeneralSecurityException gse) 
       {
            gse.printStackTrace();	
       }