J
john.eisenschmidt
Stuck in API hell, hoping someone can help me.
I'm trying to build a small webapp with mod_perl to connect to Oracle
Discoverer 10g and pass parameters based on who they are. Discoverer
used to have a CGI-like API within itself which you could just say:
http(s)://server.domain.com/discoverer/plus?us=user;pw=pass;etc
but they took that away for 10g and replaced it so it needs a CGI
redirect:
http://oraclebi.blogspot.com/2005/08/passing-password-to-viewer.html
<form name="dashboard redirect" action=$server method="POST">
Username: <input type="input" name="us" value=""><br>
Password: <input type="input" name="pw" value=""><br>
Workbook: <input type="input" name="wbk" value=""><br>
Worksheet: <input type="input" name="wsk" value=""><br>
Page Item: <input type="input" name="pi_Region" value="West"><br>
EUL: <input type="input" name="eul" value=""><br>
Database: <input type="input" name="db" value=""><br>
<input type="submit" name="submit" value="Submit">
</form>
Which I have working if I type in the params, but I want to build them
and shoot the user straight in. So I've tried a couple different ways
to do this, and none have worked:
sub connectToDiscoverer {
#########################################################################
# attempt 1:
#########################################################################
# use LWP::UserAgent;
# use HTTP::Request::Common;
# my $ua = LWP::UserAgent->new;
# my %tags = ();
# $tags{'us'} = 'jeisensc';
# $tags{'pw'} = '999999';
# $tags{'wbk'} = '0000 Budget_Check_Summary';
# $tags{'wsk'} = '';
# $tags{'pi_Region'} = 'West';
# $tags{'eul'} = '';
# $tags{'db'} = 'FOO';
#
# my $response = $ua->post(POST '/reports/discoverer.html',
#########################################################################
# tried both content_types here, not at same time
#########################################################################
# Content_Type => 'form-data',
# Content_Type => 'application/x-www-form-urlencoded',
# Content => [ %tags ]
# );
# if ($response->is_success) {
# print $response->content; # or whatever
# }
# else {
# die $response->status_line;
# }
# print $resp->error_as_HTML unless $resp->is_success;
# print $resp->content();
#########################################################################
# attempt 2
#########################################################################
#my $ua = LWP::UserAgent->new;
#########################################################################
# tried ->request and ->post, not at same time
#########################################################################
# my $response = $ua->post('http://localhost/reports/discoverer.html',
[
# my $response = $ua->request(POST
'http://localhost/reports/discoverer.html', [
# us => 'jeisensc',
# pw => '999999',
# wbk => '0000 Budget_Check_Summary',
# wsk => '',
# pi_Region => 'West',
# eul => '',
# db => 'FOO'
# ]);
#
# my %deref = %$response;
# print $deref{"_content"};
#########################################################################
# attempt 3
#########################################################################
use LWP::UserAgent;
my %tags = ();
$tags{'us'} = 'jeisensc';
$tags{'pw'} = '999999';
$tags{'wbk'} = '0000 Budget_Check_Summary';
$tags{'wsk'} = '';
$tags{'pi_Region'} = 'West';
$tags{'eul'} = '';
$tags{'db'} = 'FOO';
my $ua = new LWP::UserAgent;
my $req = new HTTP::Request
'POST','http://localhost/reports/discoverer.html';
$req->content_type('application/x-www-form-urlencoded');
$req->content(%tags);
my $res = $ua->request($req);
}; ## end connectToDiscoverer
#########################################################################
Am I missing something here? When I run in browser, I just get
"<html><head></head></html>" and then if I try from the shell I just
get nothing.
Thanks
I'm trying to build a small webapp with mod_perl to connect to Oracle
Discoverer 10g and pass parameters based on who they are. Discoverer
used to have a CGI-like API within itself which you could just say:
http(s)://server.domain.com/discoverer/plus?us=user;pw=pass;etc
but they took that away for 10g and replaced it so it needs a CGI
redirect:
http://oraclebi.blogspot.com/2005/08/passing-password-to-viewer.html
<form name="dashboard redirect" action=$server method="POST">
Username: <input type="input" name="us" value=""><br>
Password: <input type="input" name="pw" value=""><br>
Workbook: <input type="input" name="wbk" value=""><br>
Worksheet: <input type="input" name="wsk" value=""><br>
Page Item: <input type="input" name="pi_Region" value="West"><br>
EUL: <input type="input" name="eul" value=""><br>
Database: <input type="input" name="db" value=""><br>
<input type="submit" name="submit" value="Submit">
</form>
Which I have working if I type in the params, but I want to build them
and shoot the user straight in. So I've tried a couple different ways
to do this, and none have worked:
sub connectToDiscoverer {
#########################################################################
# attempt 1:
#########################################################################
# use LWP::UserAgent;
# use HTTP::Request::Common;
# my $ua = LWP::UserAgent->new;
# my %tags = ();
# $tags{'us'} = 'jeisensc';
# $tags{'pw'} = '999999';
# $tags{'wbk'} = '0000 Budget_Check_Summary';
# $tags{'wsk'} = '';
# $tags{'pi_Region'} = 'West';
# $tags{'eul'} = '';
# $tags{'db'} = 'FOO';
#
# my $response = $ua->post(POST '/reports/discoverer.html',
#########################################################################
# tried both content_types here, not at same time
#########################################################################
# Content_Type => 'form-data',
# Content_Type => 'application/x-www-form-urlencoded',
# Content => [ %tags ]
# );
# if ($response->is_success) {
# print $response->content; # or whatever
# }
# else {
# die $response->status_line;
# }
# print $resp->error_as_HTML unless $resp->is_success;
# print $resp->content();
#########################################################################
# attempt 2
#########################################################################
#my $ua = LWP::UserAgent->new;
#########################################################################
# tried ->request and ->post, not at same time
#########################################################################
# my $response = $ua->post('http://localhost/reports/discoverer.html',
[
# my $response = $ua->request(POST
'http://localhost/reports/discoverer.html', [
# us => 'jeisensc',
# pw => '999999',
# wbk => '0000 Budget_Check_Summary',
# wsk => '',
# pi_Region => 'West',
# eul => '',
# db => 'FOO'
# ]);
#
# my %deref = %$response;
# print $deref{"_content"};
#########################################################################
# attempt 3
#########################################################################
use LWP::UserAgent;
my %tags = ();
$tags{'us'} = 'jeisensc';
$tags{'pw'} = '999999';
$tags{'wbk'} = '0000 Budget_Check_Summary';
$tags{'wsk'} = '';
$tags{'pi_Region'} = 'West';
$tags{'eul'} = '';
$tags{'db'} = 'FOO';
my $ua = new LWP::UserAgent;
my $req = new HTTP::Request
'POST','http://localhost/reports/discoverer.html';
$req->content_type('application/x-www-form-urlencoded');
$req->content(%tags);
my $res = $ua->request($req);
}; ## end connectToDiscoverer
#########################################################################
Am I missing something here? When I run in browser, I just get
"<html><head></head></html>" and then if I try from the shell I just
get nothing.
Thanks