callServer() framework written by some genius iwov expert working only for first replicant

Options

Hi Expert,

 

I am using the callServer() framework written by some genius iwov expert.  Well, I am following it properly(as per the definition) but somehow its  failing to process all the replicants. Its processing only first replicants.

I am calling the callServerDone() method inside my perl code( the script used inside callServerQueue() method).

 

I tried to have an alert call in all the methods of the callServer() farmework and every time alert is getting triggered but callServerQueue() is processing only first record.

 

Please below see  the java script I am calling from my DCT. CallServer.js is the file which has all the callServer() framework method.

 

 

 

<script language="javascript" src="https://www.tdameritrade.com/retail-en_us/resources/javascript/custom_libs/libs/jquery-1.10.1.min.js"/>

        <script language="javascript" src="https://www.tdameritrade.com/retail-en_us/resources/javascript/release/jquery/jquery-ui/js/jquery-ui-1.10.4.custom.min.js"/>

        <script language="javascript" src="/iw/js/personalization/CallServer.js"></script>

        <script language="javascript" location="template-type" src="/guiupdate/guiupdate.js"/>

        <script language="javascript" src="/iw/js/personalization/personalization.js"/>

        <script language="javascript" src="/iw/js/personalization/repdelete.js"/>

        <script language="javascript" src="/iw/js/personalization/logictemplate.js"/>

        <script language="javascript" src="/iw-cc/base/widget/calendar/calendar_init.js" type="text/javascript"/>

 

 

The perl script where I am calling the callServerDone() method.

 

#!C:\Interwoven\TeamSite/iw-perl/bin/iwperl -w

use strict;

use warnings;

use File::Copy;

use TeamSite::Config;

use CGI;

use TeamSite::CGI_lite;

 

my $timestamp = localtime(time);

my $logFile                         = "C:/Interwoven/TeamSite/local/logs/FileCopy.log";

open(LOG, ">>$logFile") or die "Unable to open logfile:$!\n";

print LOG "Entering FileCopy - TEMP.ipl \n";

 

#This file requires source and destination parameters.

my $in = new CGI;

my $source_file =$in->param('source');

print LOG "source file is  : $source_file \n";

my $target_file = $in->param('target');

print LOG "Target file is  : $target_file \n";

 

                copy($source_file,$target_file) or die "File cannot be copied: $!";

               

close LOG;

               

print <<"END";

<!DOCTYPE html>

<html>

<head>

<title>TD Ameritrade - Teamsite</title>

<body>

//<script language="javascript" src="http://devctwvcmsapp01.pte-am.ameritrade.com/iw/js/personalization/personalization.js"></script>

<script language="javascript" src="http://devctwvcmsapp01.pte-am.ameritrade.com/iw/js/personalization/CallServer.js"></script>

<script>

                callServerDone();

                //alert("done");

 

</script>

END

exit 0;

 

 

 

The below method I am calling from my js file.

 

callServerQueue("http://devctwvcmsapp01.pte-am.ameritrade.com/iw-bin/FileCopy.ipl", param,true);             

 

 

Regards,

Ajay Tyagi

 

Comments

  • OK, you are missing the code that actually calls the callserver. 

     

    More importantly you need to say what you want to happen.  Are you planning to pass all items in the replicant to the callserver or are you expecting to call it for each replicant ?  Looking at the IPL you posted, I assume it is the latter, though that is a horrid way of doing it.

     

     

  • Thanks Andy!

     

    Well, first i tryed to create a list of object and passed to the call server that also did not work. Yes, in the ipl which i sent, i am calling callServer() for each replicant on OnSaveValid event.

  • I forgot to add that i am looping it trough with all the replicant and passing the object.

  • Your IPL will not handle multple instances of itself.  

    When the 2nd instance starts, it will dies because the 1st alread has the log open.

     

     

    Building a list and sending that to the callserver is the best approach. 

  • Thanks again for your reply!

     

    Well, i tryed like a below but it works fine till i have 29 files attached in my DCR. When i checked the size of the object and found that its getting failed when object size goes beyond 8080 bytes.

     

     

     var ruleCount = IWDatacapture.getItem("/personalization_root_container/personalization_container").getChildren().length;
        // showLoadingIndicator(true,ruleCount);
       
        //alert("rulecount="+ruleCount);
       
        var fileList = [];
        for(var count=1;count<=ruleCount;count++)
        {
         var src=IWDatacapture.getItem("/personalization_root_container/personalization_container["+count+"]/src").getValue();
         var dest=IWDatacapture.getItem("/personalization_root_container/personalization_container["+count+"]/dest").getValue();   
         fileList.push(src + ',' + dest);
         //fileList.push(src);  
                            
        }
        fileList = fileList.join("|");
        //alert("Ajay" + fileList);
        
          alert("Ajay" + fileList.length);
        
        IWDatacapture.callServer("/iw-bin/Filecopy.ipl  ", { source: fileList }, true); 
       return true;

  •  

    Well you can either write an IPL that allows mulitple instances of itself, though I am not certain of what it does so that may not be possible, or you can wait for the callserver to return (they are async by default) within the callback routine and kick off the second one. 

     

    Lastly, you can adjust how you send the data to your current IPL.  Instead of full paths,  send WA relative paths and then the WA itself.  That may allow you to send more than 29 in hte 8080 characters. 

  • Thanks Andy!

     

    By sending the relative path i am able to cut the object size around 70% and now i am good to process my all the files.

     

     

TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs