IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  date

    Posted 10/29/02 01:04 PM

    X-Application Version: 3.1.3
    Tamino Version : 3.1.1
    Platform : Win2k
    WebContainer : Tomcat 3.3
    JDK Version : 1.3.1

    hi
    can you send the plugin to put the current date in the variable.

    thanks alot


    #API-Management
    #Tamino
    #webMethods


  • 2.  RE: date

    Posted 10/29/02 03:04 PM

    Hi,

    I assume, that you are aware to the “login example” posted earlier in this community:
    http://tamino.forums.softwareag.com/viewtopic.php?p=13414

    Based on this example I have added a small plugin called : setDateToVariable

        public static void setDateToVariable(BusinessDocumentWorkspace ws, VariablesHandler variables) throws XException {
    Date date = new Date();
    String formatedDate = DateFormat.getDateInstance(DateFormat.LONG).format(date);
    variables.setVariable("currentDate", formatedDate, "session");
    }
    </pre><BR>Before this plugin can be used, you have to register it in xapplication.xml file of your application. Please include following lines:<BR><pre class="ip-ubbcode-code-pre">
    <action name="currentDate" method="WorkspacePlugin.setDateToVariable">
    <arg>variables</arg>
    </action>
    </pre><BR><BR>I have modified your home.jsp with the following line of code in order to show you the manner of operation:<BR><pre class="ip-ubbcode-code-pre">
    <tr><td  width="746" align="right"><xapp:directcommand type="currentDate"/><xapp:getvar name="currentDate"/></td></tr>
    </pre><BR><BR>I have added the result as an extract of a screen shot.<BR><BR>Instead of using two seperate tags, you are also able to modify the plugin with a return statement of type String:<BR><BR><pre class="ip-ubbcode-code-pre">
    public static [b]String[/b] setDateToVariable(BusinessDocumentWorkspace ws, VariablesHandler variables) throws XException {
    Date date = new Date();
    String formatedDate = DateFormat.getDateInstance(DateFormat.LONG).format(date);
    variables.setVariable("currentDate", formatedDate, "session");
    [b]return formatedDate;[/b]
    }
    </pre><BR><BR>The code in your jsp page would look as following:<BR><BR><pre class="ip-ubbcode-code-pre">
    <tr><td  width="746" align="right"><xapp:directcommand type="currentDate"/></td></tr>




    Bye
    Thorsten
    currentDate.gif


    #API-Management
    #Tamino
    #webMethods


  • 3.  RE: date

    Posted 10/30/02 05:38 AM

    hi
    please send the attachment again

    thanks


    #webMethods
    #API-Management
    #Tamino


  • 4.  RE: date

    Posted 10/30/02 05:39 AM

    hi
    please send the attacment again

    thanks


    #Tamino
    #webMethods
    #API-Management


  • 5.  RE: date

    Posted 10/30/02 09:46 AM

    Hi,

    which attachment?

    Bye
    Thorsten


    #Tamino
    #API-Management
    #webMethods


  • 6.  RE: date

    Posted 11/03/02 05:57 AM

    hi
    I send the plugin that I used for application.when I insert the fuction setDateToVariable did not work.!!!(I did all of thing you said must do)

    thanks alot
    WorkspacePlugin.java (3.47 KB)


    #API-Management
    #Tamino
    #webMethods


  • 7.  RE: date

    Posted 11/04/02 08:38 AM

    Hi,

    I believe, that I have found the problem.
    You didn’t write what kind of errors/trouble you have. But the attachment helped me.

    The plugin methode setDateToVariable should contain some formatting tags, in order to help you understanding.
    Unfortunately this went wrong and the formatting tags are included in the java code :wink:

    Therefore, remove this tags (“[ b ]”,“[ /b ]”) out of your source, recompile it and than it should work.

    The source should now look like:

        public static String setDateToVariable(BusinessDocumentWorkspace ws, VariablesHandler variables) throws XException {
    Date date = new Date();
    String formatedDate = DateFormat.getDateInstance(DateFormat.LONG).format(date);
    variables.setVariable("currentDate", formatedDate, "session");
    return formatedDate;
    }
    



    By the way, have you registered the plugin method in you xapplication.xml file?

    Bye
    Thorsten


    #API-Management
    #Tamino
    #webMethods


  • 8.  RE: date

    Posted 11/04/02 09:43 AM

    I just want U to send me .java and .class files of this date plugin , coz I don’t know how to compile a .java to a .class


    #Tamino
    #API-Management
    #webMethods


  • 9.  RE: date

    Posted 11/04/02 03:15 PM

    Hi,

    I have attached a zip file containing both - the source and the class file.

    If you want to maintain the plugin in future then
    you need to compile the source file each time, after doing some changes.

    If you want to learn more about java, servlets, xml or if you would like to have a deeper sight in these topics, then I would recommend you to have a look into a good book, like: “Sams Teach Yourself Java2 in 21 Days”.
    “[…] The book teaches Java 2 programming to beginners and experienced programmers, with an emphasis on how Java is being used today in new areas such as Java servlets and XML processing […]”

    Bye Thorsten

    P.S.: If you are in a dos box then “javac WorkspacePlugin” will compile the file in to WorkspacePlugin.class.
    “javac -?” will give you advice for all compiler options
    The java/bin folder must me set in your path environment
    date_plugin.zip (3.15 KB)


    #webMethods
    #API-Management
    #Tamino