Click here to close now.


Java IoT Authors: Anders Wallgren, Liz McMillan, Greg O'Connor, Tim Hinds, Bill Szybillo

Related Topics: Microservices Expo, Java IoT, IoT User Interface, Agile Computing

Microservices Expo: Article

SOA World Expo: Enterprise Mashup Services

Part 1: Real-World SOA or Web 2.0 Novelties?

Since Web 2.0 kicked off scarcely a day goes by without a headline targeting mashups and their enablers, AJAX and Web Services, as the next hot Web technologies. Mashups are Web sites that integrate a variety of services (e.g., news feeds, weather reports, maps, and traffic conditions) in new and interesting ways. Just take a look at, which provides instant home valuations plotted as thumbtacks on a map (Figure 1), or, which marks listings from as captions on a map, and you'll get a clear picture of the power behind converging data sources.

Google Maps is often identified as the disruptive force that spawned the mashups movement. The popular mapping service is now the home of more than 600 mashups according to Why the hype? Google Maps provides a simple JavaScript API that makes geo-spatial data, a historically cost-prohibitive service, easily accessible to a broad audience with a variety of technical skills. Web 2.0-savvy developers are highly attracted to this simplified and accessible approach to SOA development because it no longer confines their Web site functionally to a user interface, but opens the site up to syndicate functionality and data. Thus a site's success is no longer based on traffic alone, but on the number of subscribers. The proliferation of these services is mind-boggling., a mashup-tracking site, has more than 300 registered services available to mix-and-match, and more than 1,100 registered mashups. Roughly 2.8 new sites are registered every day.

Despite the momentum behind mashups, corporate IT departments only consume a handful of the services used by the mashup crowd. Instead, businesses have constructed their own ecosystem of services in parallel to the Web 2.0 movement. The problem with corporate adoption of mashups is two-fold. First, the concept of mashups is often considered a social phenomenon or a grassroots effort tangential to enterprise software. Second, there's no clear path to integrate business services with those available on the Web. This second issue is due, in part, to the impedance mismatch between business services and mashup services. Mashup APIs are generally written in JavaScript, while services deployed to the enterprise are developed using Java or .NET technologies. Thus, both perception and technology define the barriers to corporations adopting an enterprise mashup strategy that incorporates external services such as Google Maps.

Despite these initial hurdles, the services and collaborative development style that mashups provide have created a buzz among enterprise software vendors. IBM recently announced a R&D effort to create an enterprise "mashup maker" - a tool that lets developers blend corporate services with external services, and rapidly assemble applications. More recently, Oracle announced the Oracle WebCenter Suite, which uses JSR-168/286 and WSRP 1.0/2.0 to mix-and-match corporate services using a combination of AJAX and Java portlets. The "mashup maker" and "mashups as a portal" are both interesting concepts and quite possibly the future of rapid business application development. In a later installment we will take a closer look at JSR-168/286 and WSRP 1.0/2.0 and how these standards can be used to create enterprise mashups that mix corporate services. Meanwhile, the aim of this article is to give application developers, specifically enterprise Java developers, the tools to build meaningful enterprise mashups that take advantage of the popular mashup services.

Today's Toolkit
Business services developed with Java technologies generally fall into one of four categories: Enterprise JavaBeans, Spring, POJOs, or Web Services. The problem is that mashup APIs are generally implemented with JavaScript. There are a few services such as Flickr that offer parallel APIs written in Java, .NET, and a number of other technologies. For sites that don't offer a Java API, developers are left to their own devices to bridge the integration gap between JavaScript and Java. Existing Web Services provide the most direct path to integration, and processing XML over XMLHttpRequests, though tedious, is a relatively established method of binding AJAX-enabled interfaces to Web Services. There are a number of JavaScript packages, such as the vcXMLRPC Library, that help simplify the handling of XML-RPC requests. However, integrating Java-centric applications built with Spring or Enterprise JavaBeans makes for a more interesting problem. The first solution that comes to mind is to expose an existing EJB or Spring application as a Web Service, a simple task given that both EJB 3.0 and Spring 2.0 support remote method invocations via a Web Service end-point (JSR 181). Despite the simplicity of creating such a Web Service, we are still presented with the cumbersome task of processing XML with JavaScript.

Java-to-AJAX libraries such as Direct Web Remoting (DWR) and JSON-RPC-Java offer a simple alternative by marshaling Java objects to JavaScript and letting JavaScript communicate directly with server-side Java objects (Figure 2). So developers can interact with Java objects as if they were client-side JavaScript objects, negating the need to work with XML. For instance, by using a Java-to-AJAX library we can expose operations performed by a session bean to an AJAX-enabled Web interface and then combine the outcomes of those operations with a mashup service. An added benefit of the servlet architecture used by DWR and JSON-RPC-Java is that both libraries can take advantage of the authentication and session management provided by Java EE 5. Despite the similarities shared by both DWR and JSON-RPC-Java, DWR has a few advantages, two of which are the ability to handle recursive object structures and its integration with a large number of other libraries and frameworks such as Spring, Struts, JSF, Rife, WebWorks, and Hibernate. Thus, the amalgamation of DWR, enterprise Java services, and JavaScript mashup APIs blends the flexibility and creativity behind Web 2.0 with the reliability, scalability, and security of the Java EE architecture without needing to manipulate XML documents.

Building an Enterprise Mashup
The example application referenced in this article uses the Java Persistence API (JPA), Google Maps, and DWR to create a simple customer address book application (Figure 3). The application plots customers by address on a map using Google Map's JavaScript API. Users can update an entry by selecting a marker on a map and editing associated values in a form. Changes are committed by clicking the update, remove, and create. All records are stored in an Oracle database and persisted using the JPA.

The application provides a simple end-to-end example that demonstrates one method of blending external mashup services with Java-centric business services. Note that this article does not provide an in-depth look at DWR, JPA, or Google Maps. Instead, the intention is to prove the simplicity of integration between these technologies and enable you, the reader, to build your own enterprise mashups that leverage popular JavaScript APIs like Google Maps. Please refer to the references included in this article for more information on DWR, JPA, and Google Maps.

Setting up the DWR servlet is simple and can easily be added to an existing application. To install the servlet, first put the DWR jar in the lib directory under the WEB-INF directory, and add the following lines to the web.xml descriptor:

   <display-name>DWR Servlet</display-name>

Next, DWR must be made aware of the Java objects that should be remotable as JavaScript interfaces. The Customers object is the single JPA entity used in the application and maps to a Customers table (Listing 1). A session façade named JavaServiceFacade is used to encapsulate operations on the Customers entity object (Listing 2). Both the JavaServiceFacade and Customers classes must be registered with DWR to interact with each object via JavaScript. To do so, simply create a dwr.xml file in the WEB-INF directory as follows:

   <create creator="new" javascript="JavaServiceFacade">
   <param name="class" value="com...JavaServiceFacade"/>
     <include method="queryCustomersFindAll"/>
     <include method="queryCustomersFindById"/>
     <include method="mergeCustomers"/>
     <include method="persistCustomers"/>
     <include method="removeCustomers"/>
   <convert converter="bean" match="com...Customers"/>

The dwr.xml descriptor defines a subset of methods on the JavaServiceFacade object to expose and declares a JavaBean converter to marshal the Customers entity as a return value or method parameter. In this example, two query methods as well as the merge, persist, and remove operations contained in the JavaServiceFacade are exposed. Once the dwr.xml file is created, three JavaScript files must be imported in the JSP or HTML pages contained in the application. This enables the use of the JavaScript representation or remote interfaces of the JavaServiceFacade and Customers Java objects. The imports are as follows:

<script type='text/javascript'
<script type='text/javascript' src='../dwr/engine.js'></script>
<script type='text/javascript' src='../dwr/util.js'></script>

Note that only the JavaScript interface for the JavaServiceFacade is imported because it's the sole object that contains methods that are invoked explicitly. With the web.xml file configured, the dwr.xml file created, and all the necessary JavaScript files imported, the methods contained in the JavaServiceFacade are now accessible from a Web browser via JavaScript. To test the installation, open a Web browser and navigate to http://localhost:[port]/[nameofwebapp]/dwr. A screen should appear resembling that shown in Figure 4. Figure 5 shows all of the methods on the JavaServiceFacade that are accessible remotely.

The next step is to integrate the JavaScript interface for the JavaServiceFacade with the Google Maps API. To use the Google Maps API, an activation key is required. Visit to obtain a key. Keys are mapped to a unique URL so the key included in this article will only work with the source code provided. To use a key different from the one included in this example, simply add the following import statement to the top of your JSP page, replacing the key contained in the URL with the one obtained from the Google Maps registration page. The import below is required in the JSP page irrespective of the activation key used.

<script src=""

With both DWR and Google Maps configured, DWR calls to the JPA façade and the Google Maps API can be integrated. A simple load function and a div tag, in this case named "map," are used to initialize the mapping UI. The load function is assigned to the onload attribute of the body tag in the HTML or JSP page. Note that if you're using Dojo you must use the frameworks dojo.addOnLoad function instead of the onload attribute. The load function used in the example application not only initializes the Google Maps API, but also calls the queryCustomersFindAll function defined in the JavaServiceFacade JavaScript interface to retrieve all the Customers objects. The JavaServiceFacade.queryCustomersFindAll function accepts a reference to another function as an argument. The argument handles the return value of the JavaServiceFacade.queryCustomersFindAll function as an asynchronous callback. In this case the callback handler is the processCustomers function, which processes the list of Customers returned by the JavaServiceFacade.queryCustomersFindAll function, plotting each Customers object on the map as a marker (Figure 6).

// Called on intial page load
function load() {
     // Remotely call Java method
     // to extract all Customers
     // Initalize map object
     map = new GMap2(document.getElementById("map"));
     // Add navigation controls to map
     map.addControl(new GSmallMapControl());
     map.addControl(new GMapTypeControl());
     // Initalize geocoder
     geocoder = new GClientGeocoder();

// Plots an array of Customers on
var processCustomers =
   // test if array is null
   if(customers != null &&
     typeof customers == 'object'){
     // iterator over array of customers
     for(var i=0;i < customers.length; i++){
       // plot each customer on the map
       addMarkerForCustomer( customers[i] );
   } else {
     alert("Customer record is null!");
   // Set map center and magnification
     new GLatLng(37.4419, -122.1419), 9);

Plotting markers with Google Maps requires three simple steps. First, a geo-spatial point on the map is obtained by using the Google geocoder API. Second, a GMarker object representing the geo-spatial is created. Finally, the marker is added to the map at the given point by calling the addOverlay function on the current instance of the GMap2 object - the object that represents the map displayed in the UI. Below is the function used to plot a Customers object as a marker. In the example a geo-spatial point is generated with the address information provided by the Customers object. A helper function is used to create a new GMarker, which is then added to the map object with a call to the addOverlay function.

// Plots a customer on the map as a marker
function addMarkerForCustomer(customer){
   // create address string
   var address = customer.address + ...;
   // create point using geocoder
     function(point) {
     // create marker
     var marker = createMarker(point, customer);
     // overlay marker on map

More Stories By Ric Smith

Ric Smith is director, business and product strategy at Kaazing. provides Kaazing Corporation with a wealth of experience in product management and consulting for enterprise products and services. Prior to joining Kaazing, Ric was a principal product manager for Oracle's Fusion Middleware at Oracle's Headquarters in Redwood Shores, CA. In his role as a Principal Product Manager he was responsible for the evangelism and product direction of Oracle's AJAX and Java EE Web Tier offerings. Before joining the Fusion Middleware team, Ric worked for Oracle's consulting business as a principal consultant where he led development of mission-critical applications for prominent organizations within the defense/intelligence industry. In addition, Ric won consecutive awards for technical achievement for each year of his tenure as a consultant. Ric is a frequent speaker at international events and has written articles featured in leading industry publications such as Java Developer's Journal and AJAXWorld Magazine. He is also a representative to the OpenAjax Alliance and an honors graduate of the University of Arizona.

Comments (3) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

Most Recent Comments
EdwinVDS 10/31/08 06:25:43 AM EDT

I have started a poll on the subject of Enterprise Mashups here :

S&S Media 02/01/07 06:11:27 AM EST

Webinale 07 - A Conference For the Next Generation Web
The Web is in motion! It's about conversations, interpersonal networking, personalization, and individualism. The need for immediacy, interactivity, and community, combined with new and light-weight technologies are changing the social structure of the Web. The Next Generation Web is about getting associated with openness, trust, authenticity and collaboration. Interactivity, new possibilities to connect, social software, usability, and community networking are fast catching up with users. This new buzz is generating fresh and exciting projects. The latest buzzword is Web 2.0, and the event for anyone seeking to stay on top of this buzz is Webinale 2.0!
More info at

SOA News Desk 01/22/07 03:24:59 PM EST

Since Web 2.0 kicked off scarcely a day goes by without a headline targeting mashups and their enablers, AJAX and Web Services, as the next hot Web technologies. Mashups are Web sites that integrate a variety of services (e.g., news feeds, weather reports, maps, and traffic conditions) in new and interesting ways. Just take a look at, which provides instant home valuations plotted as thumbtacks on a map (Figure 1), or, which marks listings from as captions on a map, and you'll get a clear picture of the power behind converging data sources.

@ThingsExpo Stories
Countless business models have spawned from the IaaS industry – resell Web hosting, blogs, public cloud, and on and on. With the overwhelming amount of tools available to us, it's sometimes easy to overlook that many of them are just new skins of resources we've had for a long time. In his general session at 17th Cloud Expo, Harold Hannon, Sr. Software Architect at SoftLayer, an IBM Company, broke down what we have to work with, discussed the benefits and pitfalls and how we can best use them to design hosted applications.
Most of the IoT Gateway scenarios involve collecting data from machines/processing and pushing data upstream to cloud for further analytics. The gateway hardware varies from Raspberry Pi to Industrial PCs. The document states the process of allowing deploying polyglot data pipelining software with the clear notion of supporting immutability. In his session at @ThingsExpo, Shashank Jain, a development architect for SAP Labs, discussed the objective, which is to automate the IoT deployment process from development to production scenarios using Docker containers.
We all know that data growth is exploding and storage budgets are shrinking. Instead of showing you charts on about how much data there is, in his General Session at 17th Cloud Expo, Scott Cleland, Senior Director of Product Marketing at HGST, showed how to capture all of your data in one place. After you have your data under control, you can then analyze it in one place, saving time and resources.
The Internet of Things (IoT) is growing rapidly by extending current technologies, products and networks. By 2020, Cisco estimates there will be 50 billion connected devices. Gartner has forecast revenues of over $300 billion, just to IoT suppliers. Now is the time to figure out how you’ll make money – not just create innovative products. With hundreds of new products and companies jumping into the IoT fray every month, there’s no shortage of innovation. Despite this, McKinsey/VisionMobile data shows "less than 10 percent of IoT developers are making enough to support a reasonably sized team....
Just over a week ago I received a long and loud sustained applause for a presentation I delivered at this year’s Cloud Expo in Santa Clara. I was extremely pleased with the turnout and had some very good conversations with many of the attendees. Over the next few days I had many more meaningful conversations and was not only happy with the results but also learned a few new things. Here is everything I learned in those three days distilled into three short points.
As organizations realize the scope of the Internet of Things, gaining key insights from Big Data, through the use of advanced analytics, becomes crucial. However, IoT also creates the need for petabyte scale storage of data from millions of devices. A new type of Storage is required which seamlessly integrates robust data analytics with massive scale. These storage systems will act as “smart systems” provide in-place analytics that speed discovery and enable businesses to quickly derive meaningful and actionable insights. In his session at @ThingsExpo, Paul Turner, Chief Marketing Officer at...
DevOps is about increasing efficiency, but nothing is more inefficient than building the same application twice. However, this is a routine occurrence with enterprise applications that need both a rich desktop web interface and strong mobile support. With recent technological advances from Isomorphic Software and others, rich desktop and tuned mobile experiences can now be created with a single codebase – without compromising functionality, performance or usability. In his session at DevOps Summit, Charles Kendrick, CTO and Chief Architect at Isomorphic Software, demonstrated examples of com...
In his keynote at @ThingsExpo, Chris Matthieu, Director of IoT Engineering at Citrix and co-founder and CTO of Octoblu, focused on building an IoT platform and company. He provided a behind-the-scenes look at Octoblu’s platform, business, and pivots along the way (including the Citrix acquisition of Octoblu).
In his General Session at 17th Cloud Expo, Bruce Swann, Senior Product Marketing Manager for Adobe Campaign, explored the key ingredients of cross-channel marketing in a digital world. Learn how the Adobe Marketing Cloud can help marketers embrace opportunities for personalized, relevant and real-time customer engagement across offline (direct mail, point of sale, call center) and digital (email, website, SMS, mobile apps, social networks, connected objects).
The Internet of Everything is re-shaping technology trends–moving away from “request/response” architecture to an “always-on” Streaming Web where data is in constant motion and secure, reliable communication is an absolute necessity. As more and more THINGS go online, the challenges that developers will need to address will only increase exponentially. In his session at @ThingsExpo, Todd Greene, Founder & CEO of PubNub, exploreed the current state of IoT connectivity and review key trends and technology requirements that will drive the Internet of Things from hype to reality.
Two weeks ago (November 3-5), I attended the Cloud Expo Silicon Valley as a speaker, where I presented on the security and privacy due diligence requirements for cloud solutions. Cloud security is a topical issue for every CIO, CISO, and technology buyer. Decision-makers are always looking for insights on how to mitigate the security risks of implementing and using cloud solutions. Based on the presentation topics covered at the conference, as well as the general discussions heard between sessions, I wanted to share some of my observations on emerging trends. As cyber security serves as a fou...
With all the incredible momentum behind the Internet of Things (IoT) industry, it is easy to forget that not a single CEO wakes up and wonders if “my IoT is broken.” What they wonder is if they are making the right decisions to do all they can to increase revenue, decrease costs, and improve customer experience – effectively the same challenges they have always had in growing their business. The exciting thing about the IoT industry is now these decisions can be better, faster, and smarter. Now all corporate assets – people, objects, and spaces – can share information about themselves and thei...
The cloud. Like a comic book superhero, there seems to be no problem it can’t fix or cost it can’t slash. Yet making the transition is not always easy and production environments are still largely on premise. Taking some practical and sensible steps to reduce risk can also help provide a basis for a successful cloud transition. A plethora of surveys from the likes of IDG and Gartner show that more than 70 percent of enterprises have deployed at least one or more cloud application or workload. Yet a closer inspection at the data reveals less than half of these cloud projects involve production...
Discussions of cloud computing have evolved in recent years from a focus on specific types of cloud, to a world of hybrid cloud, and to a world dominated by the APIs that make today's multi-cloud environments and hybrid clouds possible. In this Power Panel at 17th Cloud Expo, moderated by Conference Chair Roger Strukhoff, panelists addressed the importance of customers being able to use the specific technologies they need, through environments and ecosystems that expose their APIs to make true change and transformation possible.
Microservices are a very exciting architectural approach that many organizations are looking to as a way to accelerate innovation. Microservices promise to allow teams to move away from monolithic "ball of mud" systems, but the reality is that, in the vast majority of organizations, different projects and technologies will continue to be developed at different speeds. How to handle the dependencies between these disparate systems with different iteration cycles? Consider the "canoncial problem" in this scenario: microservice A (releases daily) depends on a couple of additions to backend B (re...
Too often with compelling new technologies market participants become overly enamored with that attractiveness of the technology and neglect underlying business drivers. This tendency, what some call the “newest shiny object syndrome” is understandable given that virtually all of us are heavily engaged in technology. But it is also mistaken. Without concrete business cases driving its deployment, IoT, like many other technologies before it, will fade into obscurity.
Container technology is shaping the future of DevOps and it’s also changing the way organizations think about application development. With the rise of mobile applications in the enterprise, businesses are abandoning year-long development cycles and embracing technologies that enable rapid development and continuous deployment of apps. In his session at DevOps Summit, Kurt Collins, Developer Evangelist at, examined how Docker has evolved into a highly effective tool for application delivery by allowing increasingly popular Mobile Backend-as-a-Service (mBaaS) platforms to quickly crea...
The Internet of Things is clearly many things: data collection and analytics, wearables, Smart Grids and Smart Cities, the Industrial Internet, and more. Cool platforms like Arduino, Raspberry Pi, Intel's Galileo and Edison, and a diverse world of sensors are making the IoT a great toy box for developers in all these areas. In this Power Panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists discussed what things are the most important, which will have the most profound effect on the world, and what should we expect to see over the next couple of years.
Growth hacking is common for startups to make unheard-of progress in building their business. Career Hacks can help Geek Girls and those who support them (yes, that's you too, Dad!) to excel in this typically male-dominated world. Get ready to learn the facts: Is there a bias against women in the tech / developer communities? Why are women 50% of the workforce, but hold only 24% of the STEM or IT positions? Some beginnings of what to do about it! In her Day 2 Keynote at 17th Cloud Expo, Sandy Carter, IBM General Manager Cloud Ecosystem and Developers, and a Social Business Evangelist, wil...
PubNub has announced the release of BLOCKS, a set of customizable microservices that give developers a simple way to add code and deploy features for realtime apps.PubNub BLOCKS executes business logic directly on the data streaming through PubNub’s network without splitting it off to an intermediary server controlled by the customer. This revolutionary approach streamlines app development, reduces endpoint-to-endpoint latency, and allows apps to better leverage the enormous scalability of PubNub’s Data Stream Network.