CRM and CX Blogs by SAP
Stay up-to-date on the latest developments and product news about intelligent customer experience and CRM technologies through blog posts from SAP experts.
cancel
Showing results for 
Search instead for 
Did you mean: 
ralf_witt
Explorer

How to route my users to the right WCEM application?

In some projects it is just not enough to use product views to give different web shop users a different view on the shop. It requires more as the users should use e.g. country specific shops with different styling.

Now as you have 10, 20 or more WCEM applications users by itself are not able to select the right one, or shouldn’t even see different shops.

For that it might be useful to have some central login in place which routes the user to the correct WCEM application.

A concept for this could look like this. A new application based on WCEM framework containing only the core and user module. The user module must be extended to do the central logon. Additionally the application must run with ‘User Storage Setting’ ‘UME’ or ‘UME only’. Within the extended user module a new page should be created including a new login view. This new page should be marked as ‘startPage’ in the ui-repository.xml

<Page defaultLayout="1column" name="loginStartpage" startPage="true" ...

and used as such in the Web Channel builder configuration for this application.

Image 1: WCB-Settings

Now, to have control over the login process in the business object, the entry

File: businessobject-config.xml in customer namespace in extended user module

<businessObject name="UserBO" className="com.sap.wec.app.common.module.user.businessobject.impl.UserImpl" />

must be overridden. Within method ‘login’ you are now able to check on user credentials (reusing method ‘UMELogin’ of the base class UserCoreImpl). After method ‘UMELogin’ returned with ‘OK’, you can forward to the view showing the application list (‘sap.wcf/com.sap.common/components/applicationList.xhtml’). To use this view after login, you need to extend module ‘com.sap.common’ (namespace “sap.wcf”) and adding a new module interface for this view

File: interface-definition.xml in customer namespace

<module-interface name="com.cust.wcf.appllist">

      <uiInclude name="appllist" />

</module-interface>

File: metadata.xml in customer namespace

<public-part>

<interfaceImplementations>

  <interfaceImplementation interfaceName="com.cust.wcf.appllist">

            <uiInclude name="appllist" usedUiInclude="applicationList" />

  </interfaceImplementation>

</interfaceImplementations>

</public-part>

Use this new module interface as part of your navigation target.

File: metadata.xml in customer namespace of extended user module

<dependencies>

  <interfaceDependency dependencyType="soft"

     interfaceName="com.cust.wcf.appllist" namespace="cust"/>

File: ui-repository.xml in customer namespace

<UIInclude name="appllist" moduleInterfaceInclude="appllist"

            moduleInterface="com.cust.wcf.appllist" />

<NavigationTarget name="toAppllist"  

       targetComposition="Area:appllist" />

The view handler of ‘applicationList.xhtml’ must also be extended to overwrite method ‘getApplications’. This method allows to filter out all applications which are not relevant for the user.

Once a user clicks on one of the application links, he will be routed to that WCEM application. As this WCEM application runs on the same J2ee Server / web container the parameter “com.sap.wec.appidchange.enable” must be set to ‘true’ (default value if not changed via web.xml). Now the HTTP session of the leaving WCEM application will be destroyed and a new one for the target WCEM application will be created.

In case the application list includes only one application, you might want to directly route the user the target application. This could be done overwritting method 'prepareData()' of the view handler like this.

 

public void prepareData() {

      super.prepareData();

      if (getApplications().size() == 1) {

      AppDetailsBean singleApp = apps.get(0);

      String redirectUrl = singleApp.getApplicationLink();

            try {

       FacesContext.getCurrentInstance().getExternalContext().redirect(redirectUrl);

       FacesContext.getCurrentInstance().responseComplete();

      }

            catch (IOException e) {

        String msg = "No redirect possible to given URL '" + redirectUrl + "'";

                throw new ApplicationBaseRuntimeException(msg, e);

      }

  }

}

This assumes that method 'getApplications()' is already implemented in a way to only return appropriated applciations for the user. Now, in case only one application is in the list, an immediate redirect will take place the that application. Sessionhandling will work the same as discribed above.

To smooth the user experience the logon credentials from the first user logon can be used to single sign on to the target WCEM application. To do so the Web Channel Builder parameter ‘policy configuration’ in module ‘user’ should be set to ‘ticket’ for all WCEM applications. By that while logon on to your new central application, an appropriated SAP Logon ticket will be issued, which is than consumed by the target WCEM application, allowing seamless logon process.

Even the registration process is not detailed here, it could work similar. Just using the anonymous data like the local to determine the WCEM application where the registration should take place.

The processes for ‘Forgot Password’ and ‘Forgot User’ might not work in such a scenario, due to on the complexity of the shop finding strategy (e.g. different WCEM application using different SAP ABAP backends).

13 Comments