on 01-10-2006 9:25 AM
Hi All,
Instead of going ahead with the old loop I am creating this new Thread.
I am getting null pointer exception when I try to get the IUser.what could be the solution?
Regards,
Shakthi
1. First U open ur WebDynpro Application in NWDS
2.right click on application name
3.click on edit
4.click on "application properties" tab button
5.next click on "new"
6.select "predefined" radiobutton
7.select "authentication" from list.
8.specify value as "true".
9.click on "ok"
10.Rebuild project .
11.Deploy and Run.
now u will get login screen .
in login screen try to login with different users of the Portal system.
and check whether it has displayed user info or not.
but dont forget to write ur code which was written earlier by u
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shakthi,
This might be a stupid question, but when you say you get null, do you deploy and run direct from NWDS?
Because if you do, you are not logged in with a user...
Have you tried implementing and running application in a portal? It worked for me.
String firstName = null;
String lastName = null;
IWDMessageManager messageManager = this.wdThis.wdGetAPI().getComponent().getMessageManager();
try{
IWDClientUser wdUser = WDClientUser.getCurrentUser();
IUser user = wdUser.getSAPUser();
firstName = user.getFirstName();
lastName = user.getLastName();
}
catch(Exception e){
wdComponentAPI.getMessageManager().raiseException(e.getMessage(),true);
}
messageManager.reportSuccess("First name:" +firstName);
messageManager.reportSuccess("Last name:" +lastName);
Regards,
Simon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
are your WAS and EP in same machine or in different machines
Regards
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
public void onActionGetPortalUserInfo(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionGetPortalUserInfo(ServerEvent)
String firstName=null;
String lastName=null;
String cellPhone=null;
String city = null;
IWDMessageManager messageManager = this.wdThis.wdGetAPI().getComponent().getMessageManager();
try {
IUser user = WDClientUser.getCurrentUser().getSAPUser();
try{
firstName = user.getFirstName().toString();
lastName = user.getLastName().toString();
cellPhone = user.getCellPhone().toString();
city = user.getCity().toString();
}catch (NullPointerException nle){
messageManager.reportSuccess("inside catch block "+nle.toString());
nle.printStackTrace();
return;
}
messageManager.reportSuccess("First Name : "+firstName);
messageManager.reportSuccess("Last Name : "+lastName );
messageManager.reportSuccess("Cell Phone : "+cellPhone );
messageManager.reportSuccess("City : "+city );
wdThis.wdGetContext().currentPortalUserInfoElement().setFirstName(firstName);
wdThis.wdGetContext().currentPortalUserInfoElement().setLastName(lastName);
wdThis.wdGetContext().currentPortalUserInfoElement().setCellPhoneNumber(cellPhone);
wdThis.wdGetContext().currentPortalUserInfoElement().setCity(city);
}
catch (Exception e) {
messageManager.reportException(e.getMessage(),true);
}
//@@end
}
hi Sakthi,
You should create a webdynrpo iview for that
see the link
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/po... integration of web dynpro applications.pdf
hope this helps you
Regards
rohit
Hi Swapna,
I gave the link since you asked in the other thread how to call webdynpro applications in portal
I am assuming you have created a webdynpro iview for displaying the application.The iview should be under a role and you should assign the role to a user.
Only when you login through portal you will get the user.Otherwise if it will be null only
Also since your WAs and EP are on same machines, when creating the webdynpro iview give SAP_local system
Regards
Rohit
User | Count |
---|---|
86 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.