Hi All,
I am trying to call a IPl file from call server, which fetch the information from the DB.
Below is the DCT code:
function languageChange()
{
var language = IWDatacapture.getItem("/navigation/lang");
language = (language.getOptions()[parseInt(language.getValue())].value);
var params = new Object();
params.lang = language;
var workarea = IWDatacapture.getWorkarea();
params.workareas = workarea;
alert("workarea" + workarea);
//alert the user that an external call is being made.
IWDatacapture.displayMessage("Retrieving the Zone from the Database");
top.hiddenFrameRunning = true;
var server = window.location.hostname;
//call the get_zone.ipl file
IWDatacapture.callServer("http://"+server+"/iw-bin/get_zone.ipl",params,true);
}
IPL file code:
#This is a sample program to return the validation name according to the language type provided in cfg file.
$ENV{ORACLE_HOME} = '/usr/lib/oracle/10.2.0.3/client/lib';
$ENV{LD_LIBRARY_PATH}='/usr/lib/oracle/10.2.0.3/client/lib';
BEGIN {
$ENV{LD_LIBRARY_PATH}='/usr/lib/oracle/10.2.0.3/client/lib';
$ENV{ORACLE_HOME} ='/usr/lib/oracle/10.2.0.3/client/lib';
}
$ORACLE_HOME ='/usr/lib/oracle/10.2.0.3/client/lib';
$LD_LIBRARY_PATH ='/usr/lib/oracle/10.2.0.3/client/lib';
use DBI;
use DBI qw(:sql_types);
use CGI;
use XML:

OM;
use XML::XQL;
use XML::XQL:

OM;
open(LOG, ">/iw-home/ts-home/httpd/iw-bin/getzone.log");
### variable declaration #####
my $site_id;
my $option_label;
my $option_value;
my $option_listid ;
my $option_listname;
my $i = 0;
my $j = 0;
my $error;
my $vPath = "";
## End ###
## getting the values from cfg file ###
my $in = new CGI;
my $language = $in->param('lang');
print LOG "language : $language \n";
my $workareasPath = $in->param('workareas');
print LOG "workareasPath : $workareasPath\n";
if ($workareasPath) {
$workareasPath =~ /^.*(\/default\/main\/.+\/WORKAREA\/[^\/]+).*$/;
$vPath = $1;
}
print LOG "Vpath : $vPath\n";
$vPath = "/default/main/web/www_abc_com/WORKAREA/work" if $vPath eq "";
print LOG "Vpath of workarea : $vPath\n";
print "Content-type: text/html\n\n";
# my $filename = "$vPath/templatedata/Configuration/Properties/data/properties_$language.xml ";
my $filename = "$vPath/templatedata/Configuration/Properties/data/properties_en.xml ";
print "filename: $filename\n\n";
print LOG " filename : $filename\n";
eval{
open(FILE, $filename) or die "Could not able to open validation_list.xml file";
};
### Print Error message ####
if($
@) {
$error =1;
print LOG "$@";
}
## Code for error handling...
if($error==0)
{
print LOG "inside file open properly----->>";
my $xml = new XML:

OM:

arser->parsefile($filename);
my
@ids = $xml->xql("/properties/property[substring-before(\
@id,'_site_zone')]/\
@id");
for my $id_node (
@ids) {
my $id = $id_node->getFirstChild()->getNodeValue();
print LOG "id: $id \n\n";
$site_id = ($xml->xql("/properties/property[\
@id='".$id."']"))[0]->getFirstChild()->getNodeValue();
print LOG " label of the Sidesss--->: $site_id \n\n";
}
### Code to fetch the Sites Id from the Xml file end###
### Code to get the Zone from the Database###
#### db information used below is that for PEF Dev server ####
print LOG "before DB connection----->>";
my $dbh = DBI->connect("dbi

racle:host=$oracle_server;port=$oracle_port;sid=$oracle_sid", $oracle_user, $oracle_password)
or die "Impossible de se connecter à la base Oracle : " . DBI->errstr;
## End ###
print LOG " After coonection--->:\n\n";
print LOG "query: SELECT ID,NAME FROM ZONES WHERE SITE=$site_id";
#my $sth = $dbh->prepare("SELECT ID,NAME FROM ZONES WHERE SITE=$site_id")
my $sth = $dbh->prepare("SELECT ID,NAME FROM ZONES WHERE SITE=90")
or die "Impossible de preparer la requette: " . $dbh->errstr;
$sth->execute()
or die "Impossible: " . $sth->errstr;
while (($zone_id, $zone_name) = $sth->fetchrow_array)
{
print LOG " zone_id : $zone_id\n";
print LOG " zone_name : $zone_name\n";
## Code to set the values in option ####
$option_listid .= "zoneid[" . $i++ . "] = '$zone_id';\n";
$option_listname .= "zonename[" . $j++ . "] = '$zone_name';\n";
}
if ($sth->rows == 0)
{
print "Table vide\n";
}
$sth->finish;
$dbh->disconnect;
print LOG " option_listname : $option_listname\n";
print LOG " option_listid : $option_listid\n";
### Zone fetching code end####
}
else
{
print LOG "inside error loop :::: $i";
$option_label ="ERROR while Opening the properties_$language.xml file";
$option_value ="error";
$option_listname .= "zonename[" . $i++ . "]=$option_label;\n";
$option_listid .= "zoneid[" . $i++ . "]=$option_value;\n";
}
## set the replicator instance ###
print <
<script language="javascript">
var zoneid = new Array();
var zonename = new Array();
$option_listname
$option_listid
</script>
EOT
exit;
When I run the same file from Inline command its fetched the Data from database but when I run the same file from callserver its not fetching data from DB.
I think this prb is because of using the ENV variable, please help me how I can solve this prb ...?
I have tried to get the Other env variable like IW_Home from call server call its not give the home path but when I run the same file with Inline I got the IW_Home path.
I am not sure why I am not able to get the ENV variable in IPL file while calling from callserver. Please help me how I can do for ORACEL ENV variable.