I am working on a project where I generate and store pdf in the database using apex_util.get_print_document.
It looks like this,
begin
l_report := apex_util.get_print_document (
p_application_id => :APP_ID,
p_report_query_name => 'query_name',
p_report_layout_name => 'layout_name',
p_report_layout_type => 'xsl-fo',
p_document_format => 'pdf' );
Update table_blob
Set report = l_report,
mimetype = 'application/pdf',
filename = :P1_INVOICE_NO||'.pdf',
report_saved_by = :USER,
report_saved_on = sysdate
Where Job_id = :P1_JOB;
End;
This works perfectly in http connection. So when I access the same page over https I am getting the below error. Please help!
ORA-20001: The printing engine could not be reached because either the URL specified is incorrect or a proxy URL needs to be specified.
For APEX to be able to make outbound HTTP calls over SSL, a database wallet must be created and the configuration of it must be specified in APEX Instance Administration:
http://docs.oracle.com/cd/E59726_01/doc.50/e39151/adm_wrkspc002.htm#sthref384
Related
Been fighting with this one for days. Hopefully, I'm being thick and there's a semicolon missing from somewhere.
I've been trying to setup a reference to my REST-enabled SQL (RESS) on my local box, and Apex refuses to acknowledge it.
I'm using the article at https://docs.oracle.com/database/apex-18.1/HTMDB/rest-enabled-sql-creating.htm#HTMDB-GUID-0906921E-AF79-49D4-B909-1C090F805D9D, which seems quite straightforward.
Before you ask:
Yes, I've enabled the schema for REST
Yes, I've enabled RESS in the defaults.xml file
Yes, I've tested the RESS away from APEX, using a curl command like curl -i -X POST --user testuser1:testuser1 --data-binary "select sysdate from dual" -H "Content-Type: application/sql" -k http://localhost:8080/ords/hr2/_/sql, and it works.
Then in APEX->Shared Components->Data Sources->REST Enabled SQL, I've setup this reference:
and it uses these credentials:
However, when I initially created the reference, and when I test it, I get the following message:
What on earth am I doing wrong?
Using Oracle APEX 21.2.0 and ORDS Version 21.4.1.r0250904
the screen shots look good. I would now check whether the database can reach the ORDS endpoint with APEX_WEB_SERVICE, as follows (you can use either SQL*Plus or SQL Workshop for this):
declare
l_result clob;
begin
apex_web_service.set_request_headers(
p_name_01 => 'Content-Type',
p_value_01 => 'application/sql' );
l_result := apex_web_service.make_rest_request(
p_url => 'http://localhost:8080/ords/hr2/_/sql',
p_http_method => 'POST',
p_username => 'TESTUSER1',
p_password => 'testuser1',
p_body => 'select sysdate from dual' );
dbms_output.put_line( l_result );
end;
Possible errors are ...
the PL/SQL Network ACL was not set up for the APEX_XXXXXX user
the database has a proxy server defined, which is not valid
I am using sessions to manage application state in ASP.NET CORE and it's configured as below.
services.AddSession(options =>
{
options.CookieName = ".my.Session";
options.IdleTimeout = TimeSpan.FromSeconds(20);
});
It's working on localhost but on remote IIS 8 it's not creating cookies so not able to get the values. I also have enabled CORS and don't know what exactly caused this problem. In log it's not showing error either.
In response header set cookie is present but not set in browser
I had this problem some time ago. It may be related with the new Cookie Policy.
Try to set options.CheckConsentNeeded = context => false;. So inside "ConfigureServices" in Startup.cs it need to be like this:
public void ConfigureServices(IServiceCollection services)
{
var connection = Configuration["ConnectionStrings:DefaultConnection"];
services.AddDbContext<ProjectDbContext>(options => options.UseMySql(connection, b => b.MigrationsAssembly("PrimaryProject")));
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
//Here comes the change:
options.CheckConsentNeeded = context => false;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddDbContext<ApplicationDbContext>(options =>
options.UseMySql(connection));
services.AddDefaultIdentity<IdentityUser>()
.AddEntityFrameworkStores<ApplicationDbContext>();
services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
.AddSessionStateTempDataProvider();
services.AddSession();
}
Regards,
H. Eberhardt
services.AddSession(options =>
{
options.IdleTimeout = TimeSpan.FromMinutes(20);
options.CookieHttpOnly = true;
});
May be it's working, Try it now
I have an application using ember-couchdb-kit to interface with a CouchDB instance. I am having difficulty accessing the server after requiring authentication.
I tried cookie authentication and the cookie gets set in the browser, but it isn't sent to the database for subsequent requests according to the network dialog in both Chrome and Firefox.
I don't understand why this is happening, but in the pursuit of getting the application working, I wanted to try HTTP auth.
My document adapter is just:
App.Host = 'http://localhost:5984'
App.ApplicationAdapter = EmberCouchDBKit.DocumentAdapter.extend( { db: 'wells', host: App.Host } )
I want to add the username and password to the URL, so after the user enters them, I run:
EmberCouchDBKit.DocumentAdapter.reopen( {
host: ( function() {
var parts = App.Host.split( '://' )
return "%#://%#:%##%#".fmt( parts[0], $('#username').val(), $('#password').val(), parts[1] )
} )()
} )
The URL for subsequent requests doesn't change though. What do I need to do?
The adapter isn't recreated each time it's used, and reopen only applies to newly created instanes. As such you'll need to redefine it on the already existing adapter instance. Inside a route/controller you could do it like so:
var adapter = this.store.adapterFor('application');
adapter.set('host', 'foobar');
is there anyway to dynamically generate the response for the Amazon Product API with using just a URL string?
I see there are PHP and C# libraries but I am just trying to browse to a URL and see the response. I noticed one of the required fields of the URL is a timestamp which makes this tricky. The following page helped to generate the URLs but I can't seem to find a way to do it dynamically?
http://associates-amazon.s3.amazonaws.com/scratchpad/index.html
Thanks!
This is the dynamic search for amazon product
Download aws_signed_request.php from this url
include('aws_signed_request.php');
$public_key = 'xxxxxxxx';
$private_key = 'xxxxxxxxxx';
$associate_tag = 'xxxxxx';
$keywords= 'PHP';
$search_index = 'Books';
// generate signed URL
$request = aws_signed_request('com', array(
'Operation' => 'ItemSearch',
'Keywords' => "Php Books",
"SearchIndex" => "Books",
"Count" => '24',
'ResponseGroup' => 'Large,EditorialReview'), $public_key, $private_key, $associate_tag);
// do request (you could also use curl etc.)
$response = #file_get_contents($request);
Documentation URL HERE
I'm not sure I totally understand your question, but I think the answer is "the data in the Amazon product API is only available via 'signed' URLs". That way, Amazon can track abuse, etc back to the source (i.e. the signer).
If it were possible to get the data with a "static" URL, then you could post that URL all over the Internet and anyone could get the data without signing up with Amazon. It's their data, and they have rules on it's use, so that wouldn't fly with them.
That said, you can usually create URLs with a timestamp in the future (months or even years). But you would still be responsible for it's use/abuse.
I am exposing a webservice using eventmachine and evma_httpserver as follows:
EM.run{
puts "Query Server running on port 9000"
EM.start_server '0.0.0.0', 9000, QueryEngineHttpServer
}
I would like to make it secure, i.e., require a user name and password. I know how to do this using Sinatra, but I'm not using it for this, so I'm no sure how to proceed.
which kind of authentication do you need? Basic-auth or cookie based?
is this something that can help you ?
module QueryEngineHttpServer
include EM::HttpServer
def post_init
# if you want the connection to be encrypted with ssl
start_tls({:private_key_file => path_to_key_file,
:cert_chain_file => path_to_key_file,
:verify_peer => false})
# don't forget to call super here !
super
end
def process_http_request
# Block which fulfills the request (generate the data)
operation = proc do
# depending of which kind of auth you want you should have to parse the cookie or the 'autorization' header
auth = check_for_auth #http_cookie, #http_headers
# create the response object to be used in the EM::defer callback
resp = EM::DelegatedHttpResponse.new(self)
resp.status = auth ? 200 : 401
resp.content = 'some content here...'
resp
end
# Block which fulfills the reply (send back the data to the client)
response = proc do |reply|
reply.send_response
end
# Let the thread pool handle request
EM.defer(operation, response)
end
end