Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

NW CE 7.2 - UWLException (Default) Logged in users context or session

Hi Everyone,

We are trying to get the task Items of a user from a custom webdynpro application, but while calling the itemManager.getItems(uwlContext, null, null) method... Web Dynpro application's sap.authentication setting is set to true and it do requires user logon.

One funny thing is, if we deploy&run the application from NWDS, logon using the provided screen we get the exception. But if we re-deploy&run the application from NWDS not closing the previews application tab on IE, it do work and give us the task Items of the user...

Thanks for your time and answers.

Best Regards,

Utku

try {
	// lookup UWL service
	IUWLService uwlService = (IUWLService) WDPortalUtils
				.getServiceReference(IUWLService.ALIAS_KEY);

	// create UWL context
	UWLContext uwlContext = new UWLContext();
		
	// find logged in user.
	user = WDClientUser.getCurrentUser().getSAPUser();
		
	Locale locale = Locale.getDefault();
	if (user.getLocale() != null){
		locale = user.getLocale(); 
	}
			
	uwlContext.setUser(user);			
	uwlContext.setLocale(locale);
			
	// begin session
	IUWLSession uwlSession;
	uwlSession = uwlService.beginSession(uwlContext, sessionIdleTimeout);

	uwlContext.setSession(uwlSession);
	uwlContext.setAllowBackEndConnections(true);	
			
	// iterate over all UWL items
	IUWLItemManager itemManager = uwlService.getItemManager(uwlContext);
	QueryResult result = itemManager.getItems(uwlContext, null, null);
	ItemCollection items = result.getItems();
	Item item = null;

	String foundItems = Integer.toString(items.size());
	wdComponentAPI.getMessageManager().reportSuccess(foundItems);

	for (int i = 0; i < items.size(); i++) {
		item = items.get(i);
		description = item.getDescription();

		executionURL = WDURLGenerator.getApplicationURL(
		                      BPM_TASK_COMP_NAME, BPM_TASK_PART_NAME, item
                                                                 .getAttributes());
									
		if (executionURL != null) {
			wdComponentAPI.getMessageManager().reportSuccess(
			messageString("Execution URL: ", executionURL));
		}					
	}
			
	// end session
	uwlService.endSession(uwlContext);
} catch (UWLException e) {
	e.printStackTrace();
}

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question