on 08-23-2006 3:16 PM
Hi all,
I am trying to develop webdynpro application for reading user-mapping data. I have set user mapping for few testing users, but I have problem with Portal Runtime service in WebDynpro (I think).
I have imported all required JAR files (as external JARs)
My code is:
-
import java.util.HashMap;
import java.util.Map;
import com.sap.security.api.IUser;
import com.sap.security.api.umap.IUserMappingData;
import com.sap.security.api.umap.IUserMappingData;
import com.sap.security.api.umap.NoLogonDataAvailableException;
import com.sap.tc.webdynpro.services.sal.um.api.WDClientUser;
import com.sapportals.portal.prt.component.AbstractPortalComponent;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentResponse;
import com.sapportals.portal.prt.runtime.PortalRuntime;
import com.sapportals.portal.prt.service.usermapping.IUserMappingService;
...
// get user
IUser iuser = WDClientUser.getClientUser("MY_USER_NAME").getSAPUser();
// get umapping service
IUserMappingService iums = (IUserMappingService)
PortalRuntime.getRuntimeResources().getService(IUserMappingService.KEY);
// retreive mapping data
IUserMappingData iumd = iums.getMappingData("SYSTEM", iuser);
Map map = new HashMap();
try {
iumd.enrich(map);
} catch (NoLogonDataAvailableException nldae){
nldae.printStackTrace();
}
String userid = (String)map.get("user");
Problem is, that when I'm trying to get mapping service (line with comment // get umapping service), program ends with error below:
java.lang.NoClassDefFoundError: com/sapportals/portal/prt/runtime/PortalRuntime
at com.deloitte.MainView.wdDoInit(MainView.java:122)
at com.deloitte.wdp.InternalMainView.wdDoInit(InternalMainView.java:110)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:274)
... 30 more
I tried to solve this problem by adding ServiceReference it returned another error
Application error occurred during request processing.
Details: com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Failed to start the deployable object 'local/PortalUserMapping'. The ID of this error is
Exception id: [000423C3F96D0066000000A5000015C800041BAFDA989CFF].
We have installed Portal and WebDynpro systems on two different servers, would this be the problem?
Does anybody know how to solve this problem, or is there any other way how to get mapped user name of Portal user?
I would appreciate any help,
many thanks
Pavel
Hi,
if the wedynpro container and EP system runs on different machine, UME APIs will not work. You can access the user mapping data through EP user management Web Service. So import the webservice model into your webdynpro and use UMWebService to get the user mapping data.
You can get the WSDL file from following link from your EP server.
http://<portal_host>:<portal_port>/irj/servlet/prt/soap/UMWebService?Wsdl
Please reward me if this answer is helpful.
Regards
Srinivasan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
This may be version problem.
try to deploy the jar file
com/sapportals/portal/prt/runtime/PortalRuntime/
as library project and make it as reference in the current project ant try it
Kind Regards
Mukesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Mukesh and Vijayakhanna,
I tried to rebuild whole WebDynpro project, but I don't know how to rebiuld only one JAR file, could you please tell me how to do it in DevStudio? I am new with WebD
Vijayakhanna,
can you please advise me how can I include prtapi.jar? I've added this file as External JAR library (WebDynpro project properties > Java Build Path > Libraries Tab), is it correct, or should I do something else?
Thank you,
Pavel
Hi,
Ya.. prtapi.jar should be included as external jars to ur project. But <b>the code u have mentioned will not work</b> since IPortalComponentRequest, IPortalComponentResponse will all work only in portal applications. If u have some portal applications as sharing reference to the webdynpro application, then adding prtapi.jar will help ur webdynpro application understand the portal application. But I am not sure if portal application specific classes (if directy used) will work in webdynpro. So try to do some other code to get the users.
Regards,
Vijayakhanna Raman
Hi,
thank you for explanation..
I need to create a simple webdynpro, or JSP (if it is possible) to report mapped users in Portal (this application should be run-able in Portal, for example via iView).
Can you please advise me, if it is possible to create this program/report using another Portal development technology than WebDynpro? I mean for example simple JSP page.
Otherwise I found another way hot to get UserMapping (in WebDynpro), but I have another problem with retrieving SystemLandscapes.
My code is:
try {
final List wrappers = UMFactory.getSystemLandscapeWrappers();
wdComponentAPI.getMessageManager().reportSuccess(""+wrappers.size());
for (int i = 0;i < wrappers.size(); i++) {
ISystemLandscapeWrapper e = (ISystemLandscapeWrapper) wrappers.get(i);
system = e.getSystemByUniqueKey("CN");
if(null==system) {
system = e.getSystemByAlias("SAP_WebDynpro_XSS");
if(null!=system) {
break;
}
} else {
break;
}
}
} catch (ExceptionInImplementationException e) {
}
Problem is on first line - I get no system in List variable (wrappers.size > 0). But in Portal we have specified landscapes and I used them for setting user-mapping in Portal.
Can you please help me?
Many Thanks
Pavel
Hi,
To get iums, instead of PortalRuntime, use WDPortalUtils like this to get instance of service.
IUserMappingService iums = (IUserMappingService)WDPortalUtils.getServiceReference(IUserMappingService.KEY);
Don't forget to add the user mapping service in services reference.
Right click ur webdynpro project -> Properties -> Webdynpro references ->service reference -> Add -> PORTAL:sap.com/com.sap.portal.usermapping
When I searched regarding this, I got this thread.Also check it.
Regards,
Vijayakhanna Raman
Hi Vijayakhanna,
Thanks, but I tried it and I also added Service Reference,
but Deployment finished with warning:
---
Finished with warnings: development component 'PortalUserMapping'/'local'/'LOKAL'/'0.2006.08.24.15.17.22':
Caught exception during application startup from SAP J2EE
Engine's deploy service: java.rmi.RemoteException: Error occurred while starting application local/PortalUserMapping and wait. Reason: Clusterwide exception: server ID 4106850:com.sap.engine.services.deploy.container.DeploymentException: Clusterwide exception: Failed to prepare application ''local/PortalUserMapping'' for startup. Reason=Clusterwide exception: Failed to start dependent service ''PORTAL:sap.com/com.sap.portal.usermapping'' of application ''local/PortalUserMapping''. Status of dependent component: STATUS_MISSING. Hint: Is the component deployed correctly on the engine?
I read something about activating (or starting service in Portal), but I cannot find service like usermapping or something like that. Do you have any idea what this message means?
Thank you very much,
Pavel
Hi,
unfortunately I found, that using of service/shared reference needs to have Portal and WebDynpro system on same machine. But we have them on different computers.
Please, can anybody tell me if exists some another way how to get user mapping? I'm new with Portal Development and my idea is to create simple JSP page(s) to get mapping data. Is it possible? Is it possible to add my JSP page into Portal (i.e. as iView source) and use Portal objects in it(for example current logged user - IUser)? If yes, would you please give me very short description or some useful link? If not, can you please advise me if there is another way how to create application I need (without WebDynpro)?
I would appreciate any help,
thanks,
Pavel
Hi
to get the current user try this
IWDClientUser wdUser = WDClientUser .getCurrentUser();
IUser user = wdUser.getSAPUser();
Kind Regards
Mukesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.