Lotus Notes-to-webMethods Communications

Overview

This chapter provides instructions for creating Lotus Notes-to-webMethods (outbound) transaction services. To create Lotus Notes-to-webMethods services, you set up your Lotus Notes Designer to implement shared code. You also set up your Integration Server to handle the messages as they arrive from the Domino Server.

This chapter provides sample code to implement your outbound transactions. Additionally, it provides information about how to configure your Lotus Notes system to communicate with the Integration Server using SSL and describes how to monitor your outbound Lotus Notes request messages at run time.

For a detailed description of Lotus Notes-to-webMethods communications, see Lotus Notes-to-webMethods Communications.

Setting Up the Domino Server for Outbound Transactions

To set up the Domino Server to enable outbound communications to webMethods, perform the following steps:

Set the Classpath in the Lotus Notes notes.ini File

About this task

To set the Classpath in the Lotus Notes notes.ini file to compile shared code

Procedure

  1. From the Domino Server directory, open the notes.ini file.
    Note: The Classpath should be set on the server and not on the client.
  2. Add the following line in the notes.ini file:
    JavaUserClasses= 
    						  IBMwebMethods_directory\common\lib\wm-isclient.jar;  LotusNotesDesigner_directory\Notes.jar

    Replace Integration Server_directory and LotusNotesDesigner_directory with the appropriate directory in which the products are installed.

    If the client.jar file is not available locally, copy the file to a local directory and add that directory to the Classpath.

Write Shared Agent Code

Lotus Notes provides the option of using Java or LotusScript to programmatically manipulate data within the database. The Java or LotusScript code is stored in modules called Agents. Agents can be called manually or through some automated method such as a trigger in response to a specific database event, or at a scheduled time.

For information about building a Java client, see the IBM webMethods Service Development Help for your release. For information about working with agents, see the Lotus Domino Toolkit for Java/CORBA documentation.

Complete the following instructions to create the agent code in Java or LotusScript.

Using Sample Shared Agent Code in Java

About this task

To implement the sample shared agent code in Java :

Procedure
  1. Open the Lotus Notes Designer.
  2. Open a database.
  3. Click Shared Code, then click Agents.
  4. Click the New Agents tab and enter a name for the new agent, then close the dialog box.
  5. In the Agent window, select Java from the drop-down menu.
  6. Copy and paste the following sample code.
    import lotus.domino.*;//STANDARD DOMINO CLASSES  
    import java.io.*;//INPUT OUTPUT CLASSES  
    import java.util.*;//UTILITIES PACKAGES  
    import com.wm.app.b2b.client.*;  
    import com.wm.data.*;  
      
    public class JavaAgent extends AgentBase {  
    public void NotesMain() {  
    try {  
       //SETUP MAIN OBJECTS  
       Session oSession = getSession();  
       AgentContext oAgentContext = oSession.getAgentContext();  
       Database oDatabase = oAgentContext.getCurrentDatabase();  
      
                 //CALLING VendorDB:getVendorList  
                 Context c= new Context();  
                 c.connect("localhost:5555", "Administrator", "manage");  
                 IData results = c.invoke("VendorDB", "getVendorList", null);  
      
       //CREATE AGENT OUTPUT CLASS  
       PrintWriter oPrint = getAgentOutput();  
      
      
       //GET WEB DOCUMENT  
       Document oWebDocument = oAgentContext.getDocumentContext();  
    //SETUP DATE OBJECT FOR TIME STAMP  
                DateTime oDate = oSession.createDateTime("Today");  
      
       oDate.setNow();  
       //VARIABLES  
       Double vLoop = new Double(0);  
       String vHTML = new String("");  
       String vUNID = new String("");  
       int vLoop1= 5  
      
      
                //******** PROCESS SELECTED DOCUMENTS ******************  
      
                vHTML = vHTML + "<FONT Face=verdana SIZE=4><B>List of 
    Vendors</B></FONT><BR><BR>;  
       vHTML = vHTML + "<TABLE STYLE=\"font:8ptVerdana\">";  
        vHTML = vHTML +  
    "<TR><TD><B>Name</B></TD>  
         <TD><B>Company</B></TD>  
         <TD><B>Status</B></TD></TR>";  
      
      
              if (results!=null)  
             {  
            IDataCursor _cursor = results.getCursor();  
            IData[]  _vendor= IDataUtil.getIDataArray(_cursor, "Vendors");  
                     IDataCursor _vendCursor= null  
            if (_vendor.length >0)  
            {  
               for (int i=0; i < _vendor.length; ++i)  
               {  
                  _vendCursor = _vendor[i].getCursor();  
                  vUNID=IDataUtil.getString(_vendCursor, "Id");  
                  vHTML = vHTML + "<TR><TD>";  
                  vHTML = vHTML + vUNID + "</TD><TD >  
      
       <a href=./VendorDetails?OpenForm&Name="+IDataUtil.getString(_vendCursor,  
         "Name")+">" + IDataUtil.getString(_vendCursor, "Name")+ "</a></TD><TD>";  
                  vHTML = vHTML +IDataUtil.getString(_vendCursor, "Company")+ 
    "<TD><FONTCOLOR=\"red\">"+IDataUtil.getString(_vendCursor,  
    "Status")+"</FONT><BR>";  
                  vHTML = vHTML + "</TD></TR>";  
             } //end-for  
            } //end-if(_vendor)  
            _vendCursor.destroy();  
          _cursor.destroy();  
          } //end-if  
                   // PROCESS DOCUMENT  
         vHTML = vHTML + "</TABLE>";  
         oPrint.println(vHTML);  
               } catch(Exception e)  
               {  
         e.printStackTrace();  
              }  
         }  
    }  
    --------------------------------------------------------------------------------------------------------------------------------------------
  7. Save your changes and the code will compile.
  8. Work with your Lotus Domino application developer to ensure that the shared agent is executed according to your integration needs. You may also need to set up the Domino Server to put in place the mechanisms to initiate the events that the shared agent will use to start the service.

Using Sample Shared Agent Code in LotusScript

If you would like to implement Lotus Notes-to-webMethods communications in C/C++, Integration Server provides the webMethods.dll for the Windows platform. For the UNIX platform, webMethods provides the corresponding so/sl files.

Starting with Integration Server 7.1, the pre-built C library files are no longer included in Integration Server, or Designer. You must build the C library files for your system using the SDK. For information about building a C or C++ client, see the IBM webMethods Integration Server C/C++ API Reference or IBM webMethods Service Development Help for your release.

After you complete your development, you may execute it from your LotusScript.

Using SSL to Communicate with Integration Server

Before you set up your Lotus Notes system to use SSL to communicate with the Integration Server, you must first configure the Integration Server to enable an HTTPS port. If you need instructions for setting up an HTTPS port, see the IBM webMethods Integration Server Administrator’s Guide for your release.

For more information about the methods for setting the SSL option on the agent clients, see the com.wm.app.b2b.client.BaseContext class and the com.wm.app.b2b.client.Context class in the IBM webMethods Integration Server Java API Reference.