XMPP chat in the SAP Portal

Note: 1st published at SCN on 16.11.2011

Can a neat chat application seamless embedded into the SAP Portal add value to your portal?

The SAP Portal comes with a build-in chat application. This application once was a very nice additional feature, not really user-friendly, but useful for easy out-of-the-box chat in the portal. Unfortunately, the chat application received a feature freeze some time ago and today looks just … old. It`s one of the portal functionalities ready to use, but no one does. That`s sad, considering that a chat application inside the portal can add some nice functionality to the end-users portal experience.

Partly the chat application is to blame (see screenshot above), but still: chat in a portal can add serious value and drive user adoption. Most chat applications have to be installed on the desktop or the online version requires a new window or consumes too much space to be easily integrated into a portal page. If you are familiar with Liferay you already know the chat functionality available there and how easy it integrates with the portal pages (of the facebook chat).

Besides having a nicely integrated chat application in the portal and therefor raising the acceptance by end-users, an integrated chat can be used as a communication channel. Integrate a chat room on a portal page gives the users the possibility to ask instantly questions about the application or content, without the need to open a support message.

Is this possible with the SAP Portal and how does this look like?

Short answer: of course it is possible!

People can log on anonymously to the chat or with their credentials. History can be kept so that new joiners can browser previous questions and answers. The user can click on the chat area to log on anonymously to the chat group for that page / LoB and asks for help. The support stuff can use their preferred chat client (here: Pidgin) to receive and answer questions of the users in real time.


The answers will pop up automatically at the chat window of the users logged on to the chat room.


A hidden feature is the ability to send messages to all registered users. Just put the chat application with automatic logon on a static part of the portal and send a message to all users connected.

The message pops up automatically.

The anonymous users are listed as session users, but not with their user Id. The user Id of the portal user can be used as the nickname when registering to the chat room. Therefore the username can be found in the chat room administration.


Other use cases: this chat application can also be used to track the actual number of users active in the portal and, with real log on to the chat, to interact with them.

Realization

I implemented the chat application by using

  • Openfire [1]
  • Jappix for openfire [2]
  • Some magic[3]

To complicate things and to see if a real-world implementation scenario is feasible I put the portal and the chat server are on different servers. Logon is done automatically as an anonymous user. To identify the users the user Id is taken as the nickname when entering a room. On the portal only the HTML part of the Jappix minichat (Javascript, CSS and HTML) is integrated.

[1] Maybe with the new SCN we also get a chat app? In case you wonder why: Openfire is from Jive, and after SAP decided to use almost no SAP Portal functionality besides the bare framework for integrating application and to go full Jive: Jive powered chat app in the SAP Portal. http://www.igniterealtime.org/projects/openfire/

[2] Jappix for Openfire: http://community.igniterealtime.org/docs/DOC-2195

Jappix: https://project.jappix.com/

[3] My magic didn`t work too well for IE (irony), but that’s related to the CSS used.

There is also a mobile version of Jappix available. Combined with the portal navigation this can be used to redirect mobile users to a mobile support forum.

Of course you can use the full desktop japer client that adds more functionality:

Send file

User information can be displayed as they are configured in the user DB of the chat server.

The web client is using the HTML5 location feature, so the actual location of the user can be displayed as well.

<a title=”Where are you? ([abcdef], Rio de Janeiro, Brazil)” target=”_blank” href=”http://maps.google.com/?q=-22.,-43.” ><span class=”talk-images location-world”></span></a>

Deploy Apache ESME on NetWeaver CE 7.2

Another blog that I wrote in 2011, and never managed to publish on SCN. It may have been a time problem, logon problem or usability problem, honestly I do not remember anymore. Publishing content at my site is way easier for me, so I decided to publish it here. The actual value of the blog is close to nothing. ESME is dead, CE7.2 is on life support and no one will use this technology today. But as I`ve written the content, I`ll publish it anyway. Please note that I did not review the content for correctness. It is as I have found it on my hard drive. I hope I did everything right in 2011.

NetWeaver AS Java is a J2EE server that can be used to deploy more than just SAP applications. In this blog I will show how to deploy a 3rd party WAR: Apache ESME using NWDS. For most Java developers and IT organizations NetWeaver only serves for installing, developing and deploying SAP applications. For everything else another J2EE server is used. That NetWeaver is a full J2EE server and can be used for deploying web applications in the WAR format is mostly ignored. This prejudice comes from the time when NetWeaver Java was associated with NetWeaver 2004(s), that indeed lacked some essential features. But with the latest release (7.2, 7.3) NetWeaver is a standard compliant J2EE server that offers at least the same features as JBoss or Tomcat. To demonstrate that, I will deploy the Apache ESME WAR on NetWeaver CE 7.2. Using that project is interesting, as it not only shows that 3rd party WAR can easily be deployed but also that SAP JVM 6 can run Scalar applications.

To generate the WAR file for ESME get the source from the project homepage and use maven to compile it. This generates the WAR file that needs to be deployed, including all the compiled Java files (class) in the JAR files. The project page states that you can use the tool, but when you do not have access to the CE server, want to integrate it into an EAR project or alter the configuration you’ll have to use NWDS.

First, create an EAR project. Then import the WAR file and assign it to the EAR project.

ESME is using several 3rd party JAR files

In my case, the import report shows no errors, but the import wizard finishes with an error. What gets imported are the project structure and the class files.

The import didn’t include the 3rd party jar files. Either you add them to the web project or make sure they are accessible on the server. Here I will import them directly in the web project. It’s just drag and drop. Open the original WAR file in your ZIP manager and copy the JAR files form WEB-INF/lib. Same for the other files ESME includes in the WAR file that NWDS is not importing. Copy the resulting files to WebContent/

Next is to adjust the web.xml file. Copy the content of the original web.xml file. As the web site states, adjust the resource-ref part. ESME needs a database connection to store its data, so a data source alias has to be made available that ESME can use. Theoretically every database that supports ESME’s JPA mechanism can be used. I ran into problems while trying to use the system DB as you’ll first have to adjust the JPA files of ESME to work together with SAP. It’s easier to use another DB for ESME. Just make sure that the resource exists and is working. I used Apache derby as DB.


<display-name><your display name></display-name>


<filter>


<description>The filter that intercepts lift calls</description>


<display-name>Lift Filter</display-name>


<filter-name>LiftFilter</filter-name>


<filter-class>net.liftweb.http.LiftFilter</filter-class>


</filter>


<filter-mapping>


<filter-name>LiftFilter</filter-name>


<url-pattern>/*</url-pattern>


</filter-mapping>


<welcome-file-list>


<welcome-file>index.html</welcome-file>


<welcome-file>index.htm</welcome-file>


<welcome-file>index.jsp</welcome-file>


<welcome-file>default.html</welcome-file>


<welcome-file>default.htm</welcome-file>


<welcome-file>default.jsp</welcome-file>


</welcome-file-list>


<security-role>


<description>DefaultSecurityRole</description>


<role-name>Authenticated Users</role-name>


</security-role>


<resource-ref>


<res-ref-name><your resource></res-ref-name>


<res-type>javax.sql.DataSource</res-type>


<res-auth>Container</res-auth>


</resource-ref>

</web-app>

Now add the EAR project to an SAP server and deploy it. During deploy of the EAR file the WAR file will be automatically created and added.

Result: Apache ESME running on CE 7.2