Hello,
We are having an issue with a perl CGI script which is used to customize the Perview functionality in Teamsite. Its used to preview the DCR's in our appserver(Websphere Portal). The script logs into the portal and retrieves and parses the html returned.
It seems like its hitting the portal server and I see the html page initially (if i stop the browser i see the preview page in IE) but then seems to be forwarding to a page which is not on the Teamsite server.
Its giving a 404 "Page not found error".
The initial URL generated by the cgi script is
http://teamsite-server/iw/cci/meta/no-injection/iw-mount/default/main/ltd_portal/WORKAREA/folder/zz_tst_admin_0_preview.htmlThen its forwarded to
http://teamsite-server/iw-bin/portalPreview.cgi?url=....
which has the correct portal preview page..
and then its giving a 404 on this page
http://teamsite-server/iw-mount/default/main/ltd_portal/WORKAREA/folder/wps/myportal/kcxml/04_Sj9SPykssy0xPLMnMz0vM0Y_QjzKL9403NPICSYGYYY76kShC5vHGTgihcP0ohJYouJYouMogoK5Ic6BoqLOpflROanpicqV-aJ5-WF5This is the relevant portion of CGI scirpt.. Any suggestions on how to debug this would be appreciated. Speaking with the admin there hasnt been anything that has changed on the Teamsite server.
use lib 'd:/iw-home/custom/lib';
use TeamSite::Config;
use URI;
use CGI::Carp qw( fatalsToBrowser );
use CGI qw(standard);
use LWP::UserAgent;
$|=1;
# Constants
my $portalLoginMethod = 'POST';
my $portalPreviewCgiParam = 'preview=true';
my $portalUserId = 'user_id';
my $portalPassword = 'pwd';
# Standard Teamsite vars
my $iwhome = TeamSite::Config::iwgethome();
my $iwmount = TeamSite::Config::iwgetmount();
# Get Portal URL to request
my $query = new CGI;
my $thisCgi = 'http://'.$query->server_name().$query->script_name();
my $portalUrl = $query->param('url');
my $Url = $query->param('url');
my $workArea = $query->param('area');
my $xmlFile = $query->param('xml_file');
# Encode the Portal URL
$portalUrl = $portalUrl . "&area=" . BungeNa::Tools::urlEncode($workArea) . "&xml_file=" . BungeNa::Tools::urlEncode($xmlFile);
# Print response header
print $query->header(-charset=>'utf-8');
# Url Encode authentication information
$portalUserId = BungeNa::Tools::urlEncode($portalUserId);
$portalPassword = BungeNa::Tools::urlEncode($portalPassword);
# Create an object to request a Portal session.
my $userAgent = LWP::UserAgent->new;
$userAgent->agent("MyApp/0.1");
my $httpRequest = HTTP::Request->new($portalLoginMethod => $portalLoginUrl);
$httpRequest->content_type('application/x-www-form-urlencoded');
$httpRequest->content("$portalUserIdParam=$portalUserId&$portalPasswordParam=$portalPassword");
# Must enable cookies to store session state.
$userAgent->cookie_jar({});
my $httpResponse = $userAgent->request($httpRequest);
# Portal returns http status 302 on successful login
if(!($httpResponse->status_line =~ m|302|)) {
die 'Portal Authentication error '.$httpResponse->status_line;
}
# Retrieve the portal page.
$httpRequest = HTTP::Request->new(GET => $portalUrl);
$httpResponse = $userAgent->request($httpRequest);
#$logFile->append($httpResponse->content, BungeNa::Logging::logDEBUG);
if ($httpResponse->is_success) {
if ($workArea =~ /ltd_portal/) {
$logFile->append("here in ltd_portal");
my ($body, $metaRefreshTag);
if($portalUrl) {
# If we have found a match then inject a redirect meta tag into the return value
$body = $httpResponse->content;
} else {
# Display an error to the user if we can't find any mapped URL
$body = "Cannot find a Url for portal virtualisation. The URL is $portalUrl";
}
# If we have an html document then we need to parse the result add js
$body =~ s/onclick=\".*?\"/href=\"\" onClick=\"alert(\'This feature is disabled in preview\');return false;\"/igsm;
print "$body";
exit 0;
}