------------------------------------------------------------------------------- 
-- 
--  @Copyright (c) 2002, Oracle Corporation. All rights reserved. 
--  @headcom 
-- 
--  Template registration script for web providers.
-- 
--  This script contains the template code for registering a web provider
--  with the portal.
--  
--  If this script is not executed in the portal schema a portal session
--  should be established first using the API wwctx_api.set_context.
-- 
--  @usage   execute in portal or other schema
-- 
--  @scope   Public 
-- 
------------------------------------------------------------------------------- 

set serveroutput on size 1000000

prompt 'Web provider registration script'
declare
    l_web_provider wwpro_api_provider_registry.provider_record;
    l_provider_id number;
begin

    l_web_provider.name := <provider_name>;
    l_web_provider.timeout := <timeout_value>;
    l_web_provider.implementation_style := wwpro_api_provider_registry.WEB_IMPL;
    l_web_provider.http_app_type := wwpro_api_provider_registry.HTTP_APP_TYPE_PORTAL;
    l_web_provider.login_frequency := <login_frequency>;
    l_web_provider.http_url := <provider_url>;

    l_provider_id := wwpro_api_provider_registry.register_provider(l_web_provider);
    commit;

    wwpro_api_provider_registry.print_provider(
        p_id => l_provider_id,
        p_language => wwnls_api.AMERICAN
    );

exception
    when others then
        dbms_output.put_line('Error: ' || l_web_provider.name || ' did not successfully register');
        dbms_output.put_line('Error code: ' || to_char(sqlcode));
        dbms_output.put_line('Error message: ' || sqlerrm);
        dbms_output.put_line('Error stack: ' || substr(
            wwerr_api_error_ui.get_text_errors(),1,220));
end;
/


