© maciek905 - Fotolia.com

Liferay in action - how can I connect fancy AngularJS apps to my existing B2X portal infrastructure?

,
© maciek905 - Fotolia.com - AngularJS

AngularJS is currently on everyone's lips: every web developer magazine is reporting on the use of the JavaScript framework. The Google trend is going through the roof - the Software & Support Media Group even offers its own AngularJS training courses, the so-called http://angularjs-days.de. But does the framework work and is it suitable for corporate use? A doubleSlash customer asked himself precisely this question.

The starting points of our customer:

  1. Global company
  2. Existing B2X infrastructure/existing supplier systems
  3. Intranet applications are to be expanded and made available as a mobile website or app

The question: How is it possible to sustainably integrate an AngularJS application into the existing compliance requirements of such a company? After extensive evaluations, the decision was made in favor of an AngularJS application that accesses the company data using Liferay REST services.

A service was created and documented using Liferay web services:

Figure 1: JSON WebService API from Liferay. After selecting the DS demo portlet, its offered service methods are displayed. - AngularJS
Figure 1: JSON WebService API from Liferay. After selecting the DS demo portlet, its offered service methods are displayed.
Figure 2: Liferay offers the possibility to test the methods directly in the browser and already provides a code example. - AngularJS
Figure 2: Liferay offers the possibility to test the methods directly in the browser and already provides a code example.

The AngularJS application now consumes the Liferay web service with all the benefits that the enterprise portal already offers.

How to create a Liferay web service?

To create a Liferay web service, you need the current Liferay IDE and create a new Liferay plug-in based on Maven. To do this, add a file with the name service.xml with the following content, for example, to the WEB-INF folder:

< !DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.0.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_0_0.dtd">

	Demo

	
		
		

		
		

		
		
		
		
		
		

		
		

		
			
		
		
			
		
	

The service is created using the Liferay target "build-service". Next, the required service methods must be implemented in the classes, in our example the "DemoServiceImpl" class. The Liferay target "build-service" must then be executed again via Maven. Finally, the service is installed in Liferay using the Maven target "deploy" and can be selected via http://yourdomain.de/api/json/.

Here is the source code of the example project described for download: DS demo

 

doubleSlash-Teaser-Blog_Programming

Christian Geser

About ME

Christian Geser has a Bachelor of Science in Applied Computer Science and has been working as a Software Architect at doubleSlash since 2009. He has several years of experience in IT projects and works with well-known customers such as BMW AG and ZF AG. His focus is on the design of Software architecturesand IT concepts and the Development. Christian Geser specializes primarily in enterprise portal systems.

All contributions from Christian Geser

Learn more

Further information on our website and in our newsletter

Arrow up