How to call application module from ServletContextListener
Hi,
I've got an application that requires authenticated users. However, before the application starts I'd like to do some DB initialization.
So I created a ServletContextListener and in contextInitialized method I try to createRootApplicationModule.
Due to authentication / authorization requirements, createRootApplicationModule fails with:
ov 12, 2008 12:09:33 AM oracle.adf.share.security.authentication.JAASAuthenticationService doLogin
INFO: LoginContext.login...
javax.security.auth.login.LoginException: Invalid null input: name
at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
at javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
at javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
at oracle.adf.share.security.authentication.JAASAuthenticationService.doLogin(JAASAuthenticationService.java:102)
at oracle.adf.share.security.authentication.JAASAuthenticationService.login(JAASAuthenticationService.java:89)
at oracle.adf.share.security.authentication.JAASAuthenticationService.login(JAASAuthenticationService.java:71)
at oracle.jbo.common.UserAznUtil.authenticate(UserAznUtil.java:62)
at oracle.jbo.common.UserAznUtil.authenticateUser(UserAznUtil.java:29)
at oracle.jbo.server.ApplicationModuleImpl.prepareSession(ApplicationModuleImpl.java:6387)
at oracle.jbo.server.ApplicationModuleImpl.prepareSession(ApplicationModuleImpl.java:6356)
at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:171)
at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:8377)
at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4364)
at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2421)
at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2207)
at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3086)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:453)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:424)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:419)
at oracle.jbo.client.Configuration.getApplicationModule(Configuration.java:1395)
at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1363)
at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1335)
Can I somehow explicitly login a valid user or exclude the specific application module from authorization?
Regards
J
Hi,
no, the function is not related to user session. It's actually data synchronization between two systems.
We'd prefere to keep it in middle tier, through web services on one side and AM on the other. This way we are platform / RDBMS independent.
I could use a fake system user, eg. "sync" with password "sysnc", but how do I "log on" such user in my EJB code? If I could somehow access AM login context and call login with username and password...?
Edit:
it also puzzles me that it's possible to have a page within the aplication that allows anonymous access. The only difference in security context seem to be _isHttp property. getUserPrincipaly returns JpsAnonymousUserImpl in both cases, IsAuthenticated() is false in both cases...
Edited by: Jernej Kase on Nov 13, 2008 8:57 PM
Similar Messages
-
HOW TO CALL FUNCTION MODULE FROM ABAP4 EDITOR
HI !
friends
I want to call function module from abap 4 editor.
is there any shortcut key from edit menu through which if give a function module name then it calls the function automatically?
points will be awarded.
Cheers
troycommand will be like this
<b> call function 'YW2_GET_MNW_PERIOD'
exporting
w_budat = v_datum
importing
w_period = i_date-period
w_period_desc = i_date-p_desc.</b>
Regards
prabhu -
How to access application module from ActionForm Execute?
I've got a very simple ADF/UIX/Struts application where I'm trying to create a simple Login function. I have a /loginAction data action pointing to a login.uix page forward. The login.uix page has a <struts:form> on it with a user and a password field. There is a LoginBean with the corresponding get/set values. I have an ADF model created with a boolean login(String username, String password) function exposed as a client method.
Eventually, when I have this basic part working, then I'll actually be using an ActionForward mapping to dispatch to different home pages, based on the particular login account (the name of the forward will be stored in the authentication table).
I've tried overriding Execute(), since that is where you can return the appropriate ActionForward mapping, but that does not have a DataActionContext passed in -- so I can't get to the application module.
I've also looked at processComponentEvents, but that doesn't have any ActionForward results nor a way to pass back ActionErrors (in case the login fails).
How do I call my login client method when a user has entered a username/password and pressed the Submit button?Here is another solution as provided by Oracle Support in response to a TAR that I opened:
I had described my need to access a login() function defined in my Application Module, returning true/false if the login succeeds/fails. Here is the reply, posted with permission:
I have gotten the following information back from one of the development folks pertaining to the question you asked.
His suggestions are as follows:
1) Expose the method as a client method on the App module
2) On the pageflow create a new DataAction
3) Drag and drop the logon method from the AppModule operations node and drop it onto the new data Action
3) Edit the set-property values that are created in the Struts metadata for this new DataAction to use the correct expressions to get the logon info to pass to the middle tier.
e.g.
<action path="/authenticateUser" className="oracle.adf.controller.struts.actions.DataActionMapping" type="AuthenticateUserAction" name="DataForm"
unknown="false">
<set-property property="modelReference" value="authenticateUserUIModel"/>
<set-property property="methodName" value="authenticateUserUIModel.authenticateUser"/>
<set-property property="resultLocation" value="${requestScope.methodResult}"/>
<set-property property="numParams" value="2"/>
<set-property property="paramNames[0]" value="${param.logonUsername}"/>
<set-property property="paramNames[1]" value="${param.logonPassword}"/>
<forward name="fail" path="/logon.do"/>
<forward name="success" path="/menu.do"/>
</action>
So in this case the values of the logonUsername and logonPassword fields in the form that submitted to this DataAction are passed as the two parameters that my authenticateUser method on the AppModule requires.
I have also overriden the data action class to customise the findForward() method to route the user depending on if the method call worked or not.
And here's the code for the customized FindForward in the DataAction:
protected void findForward(DataActionContext actionContext) throws Exception
HttpServletRequest request = actionContext.getHttpServletRequest();
HttpSession session = request.getSession();
String target = "fail";
//Get the result of the Model Method call
JUCtrlActionBinding method = actionContext.getCustomMethod();
boolean successfulLogon = ((Boolean)method.getResult()).booleanValue();
if (!successfulLogon)
// If the logon fails we need to do the following
// 1. Increament the counter once this exceeds 3 any logon will fail
// 2. Create an error message to display on the logon screen
// note this is a non specific error to prevent hackers from
// knowing that they at least got the username right or from
// knowing that there is a Max attempts value if they are trying
// an automated attack
Integer attempts = (Integer)session.getAttribute("logonAttempts");
int intAttempts = 0;
if (attempts != null)
intAttempts = attempts.intValue();
session.setAttribute("logonAttempts", new Integer(++intAttempts));
//The error message comes out of the ApplicationResources.properties file.
actionContext.getActionErrors().add("general",new ActionError("logon.error.logonFailed"));
this.saveErrors(actionContext.getHttpServletRequest(),
actionContext.getActionErrors());
else
//If connection was OK do we need to save the username in a cookie?
String remember = (String)request.getParameter("logonRemember");
int cookieLife = 0; //Expire
if ( remember != null && remember.length()>0 )
cookieLife = 2592000;
String name = (String)request.getParameter("logonUsername");
Cookie userCookie = new Cookie("CARA_USER_COOKIE",name);
userCookie.setMaxAge(cookieLife);
actionContext.getHttpServletResponse().addCookie(userCookie);
target = "success";
actionContext.setActionForward(target);
I hope this helps anyone looking to implement something similar. It also illustrates the "preferred" way of executing a client method and working with the result. -
How to call function module from IP
Hi
I need to trigger the process chain from the input ready queries in Bex analyzer. I figured out that I need to call RSPC_API_CHAIN_START.
How do we go about in calling the above function module in IP.
Thanks in advance
IHi Matt
Thanks for your response, it was very productive at the right time as we saw our process chain running indefinetly. With selecting all chars to be changed, it ran just once with no errors.
what is TA ? I know rsplan- transaction code for the planning modeler.
Can you tell me how can we call function module in custom exit planning function.
Where should I embed the code
CALL FUNCTION 'RSPC_API_CHAIN_START'
EXPORTING
I_CHAIN = 'ZPC_CCATOPCA'.
I_T_VARIABLES =
I_SYNCHRONOUS =
I_SIMULATE =
I_NOPLAN =
IMPORTING
E_LOGID =
EXCEPTIONS
FAILED = 1
OTHERS = 2
thanks in advance -
How to call Function Module from webdynpro application ,up on click url in
Hi Experts,
I need your help for the following scenario.
In my WebDynpro application , I am displaying the sales orders in a table.
one of the column in table i.e. sales order number is displayed with hyper link, up on click the sales order number column, i have to pass the po number to the a remotefunction with as one parameter and enjoy = 'x' as another parameter that should call me23n transaction and the transaction screen should be displayed in the webdynpro application with po details.
Thanks In Advance.
your help is rewarded.
Best Regards.
Rao.Hi Rao,
1.Create binding to view to Controller.
2.Create table->Add column->Add table cell Editor(select LinkToAction UI Element in options).
3. Bind the property <i>text ->sales order number</i> (Output/<model node>)
4. Create an Event <salesOrder>
// do null check
// set your input parameters
// input sales order number = current output sales order number
// enjoy="x"
// call controller's method() that executes RFC
5. Bind this event LinkToAction property action-> <salesOrder>
To execute RFC, the code is available in sample tutorials.
Hope this helps
regards,
Siva -
How to Call Function Module from XI Mapping
Hi All,
I would like to call a function module that resides in ECC through XI mapping.
Can any one please through some light on how to proceed ?
RegardsHello Shabarish,
Thanks for the reply, Actually i would like to do date validation using ISHMED_CHECK_DATE_TIME FM inside Mapping.
I would like to do this way, please let me know how good is this
1) Expose the FM as a RFC enabled one
2) Use the following UDF code inside Mapping
3) do i need to import the RFC enabled FM into our XI??
4) Do i required to create any Communication channel for this?
function RFC_LOOKUP_API
Imports java.io.;com.sap.aii.mapping.lookup.;
String content = "";
MappingTrace importanttrace;
importanttrace = container.getTrace();
// filling the string with our RFC-XML (with values)
String m = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:Z_UDF_CREATE_ZTOR_REC xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\">";
m = m + "<I_MESSAGEID>" + MsgID + "</I_MESSAGEID>";
m = m + "<I_EBELN>" + PONum + "</I_EBELN>";
m = m + "<I_ERDAT>" + MsgDate + "</I_ERDAT>";
m = m + "<I_UZEIT>" + MsgTime + "</I_UZEIT>";
m = m + "</ns0:Z_UDF_CREATE_ZTOR_REC>";
RfcAccessor accessor = null;
ByteArrayOutputStream out = null;
try
// 1. Determine a channel (Business system, Communication channel)
Channel channel = LookupService.getChannel("XI","GeneratedReceiverChannel_RFC");
// 2. Get a RFC accessor for a channel.
accessor = LookupService.getRfcAccessor(channel);
// 3. Create a xml input stream representing the function module request message.
InputStream inputStream = new ByteArrayInputStream(m.getBytes());
// 4. Create xml payload
XmlPayload payload = LookupService.getXmlPayload(inputStream);
// 5. Execute Record Create.
Payload result = accessor.call(payload);
InputStream in = result.getContent();
out = new ByteArrayOutputStream(1024);
byte[] buffer = new byte[1024];
for (int read = in.read(buffer); read > 0; read = in.read(buffer)) {
out.write(buffer, 0, read);
content = out.toString();
catch(LookupException e)
importanttrace.addWarning("Error while writing " + e.getMessage() );
catch(IOException e)
importanttrace.addWarning("Error " + e.getMessage() );
finally
if (out!=null) {
try {
out.close();
} catch (IOException e) {
importanttrace.addWarning("Error while closing stream " + e.getMessage() );
// 7. close the accessor in order to free resources.
if (accessor!=null) {
try {
accessor.close();
} catch (LookupException e) {
importanttrace.addWarning("Error while closing accessor " + e.getMessage() );
//returning the result u2013 RFC-XML.response
return content;
Thanks & Regards
Vamsi -
How to call application forms from network directory on other machine
I have installed Oracle Application Server 10G Release2 without IDS (Developer) on my server. I put my application forms & reports on the same machine(APPSERVER) and run the application as follows:-
http://appserver.www.ebs.com:7778/forms/frmservlet?form=\\appserver\pass_3_1.fmx
My Application runs well. But i want to use the 'Pass_3_1.fmx' form from other machine's(SERVER) network folder as below:-
http://appserver.www.ebs.com:7778/forms/frmservlet?form=\\server\pass_3_1.fmx
I am not able to launch my application. It throws error 'Cannot read form \\server\pass_3_1.fmx'. I also tried mapping on F:\. But it didn't work.
Please advise . Thanks in Advance.
RegardsHi,
I don't understand exactly your problem but I tel you that your application mast be reside in the application server and the URL to call your application shouldn't change:
http://appserver.www.ebs.com:7778/forms/frmservlet?form=\\appserver\pass_3_1.fmx
good luck.
Soufiane -
How to call a package from the Report in Oracle Application Express
How to call a package from the Report in Oracle Application Express
Hello,
What do you mean? Something like SELECT mypackage.function( par1, par2) from dual?
Or do you want to execute a procedure when something happens on the page, like clicking a button?
Greetings,
Roel
http://roelhartman.blogspot.com/
You can reward this reply by marking it as either Helpful or Correct ;-) -
The difference in calling an application module from a backing bean
Hello everybody!
I don't understand exactly, where is the difference in calling an application module from a backing bean in the following ways.
Example 1
FacesContext context = FacesContext.getCurrentInstance();
ValueBinding vb = context.getApplication().createValueBinding("#{data}");
BindingContext bc = (BindingContext)vb.getValue(context);
DCDataControl dc = bc.findDataControl("AppModuleDataControl");
AppModuleImpl appModule = (AppModuleImpl)dc.getDataProvider();Example 2
String amDef = "model.services.AppModule";
String config = "AppModuleLocal";
AppModuleImpl appModule = (AppModuleImpl)Configuration.createRootApplicationModule(amDef, config);Example 3 (the same like Example 1???)
String EL = "#{data.AppModuleDataControl.dataProvider}";
FacesContext fc = FacesContext.getCurrentInstance();
ValueBinding vb = fc.getApplication().createValueBinding(EL);
AppModuleImpl appModule = (AppModuleImpl)vb.getValue(fc);Please can anybody explain, what the three examples do? Which example is preferred to call an application-module-method from a backing bean?
Thanks and regards
Majo
Edit: I am using ADF BC 10g in JDev10 :)Hi :)
>
This could work, but can you describe the use case for which you need to get the ApplicationModule?
Maybe we can find a better way to implement your functionality.
>
Sure, i know a lot of better ways to implement the same functionality too but its a huge project, its not my code and we have no time to reimplement this functions ;)
Frank, i don't understand the first line of your code.
DCBindingContainer bindings = ... resolve #{bindings}Where do i get the bindingContainer, if I don't have the "JSFUtils"- or "ADFUtils"-classes?
Regards
Majo
Edit:
Sorry, i have answer, before i think about it ;)
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
DCBindingContainer bindings = (DCBindingContainer)app.getVariableResolver().resolveVariable(context, "bindings");
BindingContext bctx = bindings.getBindingContext();
DCDataControl dc = bctx.findDataControl("AppModuleDataControl");
AppModuleImpl am = (AppModuleImpl)dc.getDataProvider();or in my backing bean, when i add the property to the faces-config.xml
DCBindingContainer bindings = this.getBindings();
BindingContext bctx = bindings.getBindingContext();
DCDataControl dc = bctx.findDataControl("AppModuleDataControl");
AppModuleImpl am = (AppModuleImpl)dc.getDataProvider();Is this right? -
How to get application module instance from java bundle?
Hi!
I would like to build an application that would get all translations from a database table.
So I created application module for translations that contains a view object which is selecting translations for specific language from a database table. I exposed a method in application module as client interface which returns HashMap<String, String> for all translations for specific language. When I test my view and client interface method call they work fine.
Then I created java bundle classes to get translations for specific language. Then I tried to override public Object[][] getContents() method.
I tried to get my translations application module like this:
SharedTranslationsAppModuleImpl am = new SharedTranslationsAppModuleImpl();
Map<String, String> translationsMap = am.getTranslations(this.getLocaleCode); // Client interface method call
In getTranslations(String LocaleCode) I try to get that view (which would select translations from database) but it returns NULL and I get NPE error message.
So what is the right way to get application module from java bundle file? Now everytime application wants to get translations, application stops and displays NPE message.
Regards, Marko
I use JDeveloper 11.1.2.1.0Marko,
you can't just instantiate an application module. An application module has to be set up, db connections and memory pools have to be initialized and ....
Can you describe why and when you try to read the resource bundle from the db and where the resource bundle is used?
This blog may be what you are looking for http://technology.amis.nl/2012/08/10/implement-resource-bundles-for-adf-applications-in-a-database-table/
Timo -
How to call a form from report? in 6i
How to call a Form from Report? In Developer 6i of oracle. Plz tell me tex.
try this
declare
AppID PLS_INTEGER;
begin
AppID := DDE.App_Begin('ifrun60 module=myform.fmx userid=scott/tiger@mydb maximize=no', DDE.App_Mode_Maximized);
exception when others then
srw.message(1,'Errror');
end;Baig
[My Oracle Blog|http://baigsorcl.blogspot.com/] -
How to call java program from ABAP
Hi Experts,
My requirement is to call java programs from ABAP. For that i have set up SAP JCO connection by using this link http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/739. [original link is broken] [original link is broken] [original link is broken] Connection gets sucessfully. After this how to call java program from ABAP as per our requirement. Please help me out.
Also i tried this way also.. but while executing the DOS Command line appear & disappear in few seconds. So couldnt see the JAVA output. Please help me out to call java programs in ABAP..
DATA:command TYPE string VALUE 'D:Javajdk1.6.0_20 injavac',
parameter TYPE string VALUE 'D:java MyFirstProgram'.
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
application = command
parameter = parameter
OPERATION = 'OPEN'
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
bad_parameter = 3
file_not_found = 4
path_not_found = 5
file_extension_unknown = 6
error_execute_failed = 7
OTHERS = 8.
Thanks.This depends on the version of your Netweaver Java AS. If you are running 7.0, you will have to use the Jco framework. The Jco framework is deprecated since 7.1 though. If you want to build a RFC server in 7.1 or higher, it is adviced that you set it up through JRA.
Implement an RFC server in 7.0:
http://help.sap.com/saphelp_nw04/helpdata/en/6a/82343ecc7f892ee10000000a114084/frameset.htm
Implement an RFC server in 7.1 or higher:
http://help.sap.com/saphelp_nwce72/helpdata/en/43/fd063b1f497063e10000000a1553f6/frameset.htm -
How to call the RFC from R/3 to SRM, when we use webdynpro abap? (Urgent)
Hello
We use SRM Server 5.5 with classic scenario.
We want to call RFC in R/3 from webdynpro ABAP.
How can we do that?
We are developing the web report using webdynpro abap.
So we need some of R/3 data such like PR(EBAN)and PO(EKKO,EKPO).
When user choose the search parameter, report diplay the Shopping cart, PR and PO data on webdynpro. So we call the R/3 RFC to display the PR, PO data.
But I tired to call the RFC in R/3, We could not call it.
How to call the RFC from R/3 to SRM, when we use webdynpro abap?
Thank you,
Best Regards,
SH.Hi
<b>Please look at the following threads as well -></b>
WebDynpro in SRM
BAPI's /RFC's in SRM
BAPI to Change Shopping Cart by RFC
SRM60 and webdynpro
Webdynpro Services Exception
WebDynpro using BAPI has an error
SRM60 and webdynpro...
<b>SAP uses META Function modules in SRM to get data from R/3 back-end.</b>
<u>For getting Purchase requistion data, use the function modules -></u>
META_REQUISITION_CHANGE Change purchase requisition
META_REQUISITION_CREATE Create Requisition
META_REQUISITION_DELETE Delete/close purchase requisition
META_REQUISITION_GETDETAIL Display requisition details
META_REQUISITION_GETITEMS Display requisition items
META_REQUISITION_GETRELINFO Get Releasease Info for requisitions
<u>For getting Purchase order data, use the function modules -></u>
META_PO_CREATE Create purchase order
META_PO_DELETE Delete reservation
META_PO_GETDETAIL Display purchase order details
META_PO_GETITEMS Display purchase order items
META_PO_GETRELINFO Display purchase order release information
Hope this will definitely help. Do let me know.
Regards
- Atul -
How to call BI report from web dynpro
Hi ,
How to call BI report from webdynpro application and what are the prerequisites for that .
Please provide an example to work with BI application frame UI element
ThanksHi Rajpal,
Please go through this..
calling BI report
Cheers,
Kris. -
How to call web services from HTML
Hi All,
Does anybody have an idea on how to call web services from HTML using axis and i am using jboss-4.0.5 as the application server.What did your Google search return?
Maybe you are looking for
-
When attempting to join a new MacBook Air to the AD domain, I get the error "The daemon encountered an error processing request." When this error comes up, I have to force quit out of the Directory Utility to get back into it. See below for error. No
-
Deleted items showup in custom search
We are using custom search portlet for search functionality on our site. The problem is, items that were deleted from a page in the past are also showing up in search results. And when we click on the item in search result, it throws page not found e
-
How to email report to the users
Hi, I have a few reports in 6i. I can preview them but cannot mail them to the users. When I click on the mail icon, it gives me this error : REP-4203: Error occurred while sending a mail message. Second option I did was to directly create a pdf repo
-
I need to do a recovery on my L300-EZ1502. I followed the instructions in the manual but the Recovery Wizard screen did not come up. If things don't happen like they are supposed to according to the instruction manual, I'm lost. Help!
-
HAS ANYONE BEEN ABLE GENERATE A REPORT USING RUN_PRODUCT IN THE DEVELOPER 6/INTERNET ENVIRONMENT. IF YES, WHAT SERVER REGISTRY SETTINGS MADE IT WORK. I KNOW ABOUT SHOW_DOCUMENT AND WOULD LIKE TO AVOID USING IT. null