Getting to Know OpenESB
By
Rob Ratcliff
May 3rd, 2011
About Me● Developing with Java since 1995● Founded the Austin Java Users Group in 2001● Been involved in system integration for 17 years –
architected and still support a CORBA-based integration framework called MDOPT
● Used OpenESB to develop a generic planning service that delegated to other third party planning services
● Used Glassfish to support a planning service● Lots of experience developing GUIs with Swing.
Presented at JavaOne in 2007: http://www.futuretek.com/presents/javaone2007/TS-3723
MDOPT Architecture
Outline Introduction to OpenESB
Java Business Integration (JBI)
Normalized Message Router
Binding Components
Service Engines
Developing a Geocoding Service
Code walk through of a Travel Reservation Application
Advanced Topics
Versioning WSDL and Schemas
An EJB approach to consuming services with different versions of the same schema
OpenESB/Glassfish/Sun Web Server approach to clustering
Enabling compression of the XML responses with a front end web server
Current shortcomings and future direction of OpenESB
Why Use and ESB
Desire dependent services to be decoupled
Need to support multiple protocols Need to support multiple data formats Desire best of breed services to be
swapped out behind the scenes Desire a common interface that acts as a
proxy to other third party services Draw from library of components and
services
History
SeeBeyond 1992: DataGate 1999: eGate 2003: ICAN/Java CAPS 2008: OpenESB/Glassfish ESB v2 2009: OpenESB v2.2 released 2008 OpenESB v3 (Project Fuji) started – M10+
Sun bought SeeBeyond in 2005 for $387M Oracle bought Sun 2009 $7.4B put OpenESB
into maintenance mode Open source community adopted OpenESB
2010 (LogiCoy, Pymma, ForgeRock)
Glassfish OpenESB Features Architecture embraces diverse protocols and data formats
Binding Components (BC) to adapt protocols (FTP, HTTP, CORBA, file based, proprietary)
Service Engine (SE) to provide translation and high level business logic (XSLT, BPEL, Translators)
Normalized Message Router to decouple modules and provide uniform communication model
Open source Based on Glassfish JEE application server with proven
track record Based on Java Business Integration (JBI), WSDL, XML
Schema and other open standards Product has been used in high volume telecom and
health insurance projects
Glassfish OpenESB Open source framework and standards
based software development productsGlassfish ESBJAVA, XML, WSDL, JAXWS, BPEL, JEE, JBI,
JMS, etc
Allows services to be decoupled Supports multiple protocols and formats Very WSDL/XML/BPEL/XML-Schema
centric – if you like XML, you'll like OpenESB
Miscellaneous
Other ServicesLoggingNotificationPerformance Monitoring
Other Protocols supported such as File, FTP, JMS, CORBA
Service Engines – XSLT, POJO
High Level Architecture
Ref: http://kalali.me/introducing-openesb-from-development-to-administration-and-management/
JBI Overview
Representative Binding Components
CORBA(JBI4CORBA) Database HTTP/SOAP REST JMS HL7 (and encoder)
Email Exec File Scheduler LDAP FTP
Provides External Communication with other Services
Representative Service Engines
BPEL – Business Process Orchestration Engine
JAVAEE – EJB communication POJO – Local Java Object Interface XSLT – XSLT style sheet engine, support
XSLT 1.0 and 2.0 IEP – Intelligent Event Processor
WSDL-Centric Messaging Model• Abstract service model - A service is defined using an abstract messaging model, without reference to a particular protocol or wire encoding
• Concrete (bound) model - An abstract service that is bound to a particular protocol and communications end point.
Normalized Message Router - NMR
In memory message router allowsPerformance improvement by reducing inter-
component messaging overhead of JMS (when no network is required)
Message streaming – pass by referencePropagation of security and transaction
contextEasy throttling
Normalized Message Router
Key to interoperation between components
Mediated Message Exchange Normalized Message
Abstract Message (payload – usually XML, but can be any data type)
Message Properties (metadata) Message Exchange Pattern
Support for simple communications primitives
Endpoint Identification
Endpoints in JBI are uniquely identified– PortType– PartnerLink– Role name
These three values correspond– Interface-name– Service-name– Endpoint-name (Provider or Consumer)
NMR Message API
NMR Service API
Life Cycle Management
NetBeans Schema Editor
NetBeans WSDL Editor
BPEL Editor
BPEL Input/Output Mapper
Exposing the Service in a Composite Application
Deployed to Glassfish Server
Development of a Geocoder Application
Developing a Geocoder Application Creating a new schema with the XML Schema Editor Creating new abstract WSDLs with the WSDL Editor BPEL Editor
Creating a process flow Enhancing BPEL by calling out to local Java static methods
Creating and calling a POJO Calling an external service Calling the XSLT engine to transform your XML Composite Application Editor Adding Concrete Implementation to the BPEL Process Flow Customizing the BCs with the Binding Component Editor Deployment to Glassfish Glassfish Admin interface walk-through Creating a SOAP client to communicate with the service and integration
with World Wind
Geocoder Process Flow
YahooGeocoder
GoogleGeocoder
HTTPBC
HTTPBC
BPELProcess
FlowHTTPBCSOAP
Client
Walk Through of the Travel Reservation Application
Walk Through and Demo of the Geocoder Application
HINTS Use only document literal web services Use fully qualified XSDs
(elementFormDefault="qualified“) Use elements for document literal web
services only Add reference to the actual jar of the Java
utility library to the BPEL project for Java call outs
Advanced Topics
Schema and WSDL Versioning
Come up with a versioning scheme early in the development
Some approachesTransform inputs and output based on version
identifier (e.g. Google Maps) Version Namespace
• Provide versioned WSDL end point (Bing Maps)
• Change namespace of Schema
Supporting Evolving Interfaces and Data Structure
Two typical approaches to handle versioning Change the target namespace of the Schema or WSDL to
incorporate a “Version Identifier”. Example: http://www.austinjug.org/geocoder/v2/p3
Add a “Version” element to the Schema definitionExample: <Version>v2.3</Version>
Context based routing used to convert one version to another version or couple to a given version of the service
“Unix Pipe” based approach
IONO's Recommendations➢ Place the major version number in the WSDL target
namespace, and in the name of the WSDL file.
➢ Version data types according to XSD conventions, and import types into your WSDL contract
➢ Avoid embedding versioning information in message names
➢ Embed major-minor version in the interface (portType) name to allow backward compatible interfaces
➢ Embed major-minor version in the service name (service name follows same convention as the interface
IONO's Recommendations Continued➢ Facilitate the addition of new operations as minor point
releases
➢ Create a new service for each version of an interface
➢ Facilitate change of existing operations only as major point releases
➢ Regard any change to the XSD type system as a major release
➢ Keep major releases of deprecated services live until they are no longer in use
Reference:
Adrian Trenamanblogs.iona.com/sos/20070410-WSDL-Versioning-Best-Practise.pdf
Bing Maps Geocoder ExampleWeb service versioned:http://dev.virtualearth.net/webservices/v1/metadata/geocodeservice
/geocodeservice.wsdl
SchemaLocation: http://dev.virtualearth.net/webservices/v1/metadata/geocodeservice
/GeocodeService.xsd
http://dev.virtualearth.net/webservices/v1/metadata/geocodeservice/GeocodeService3.xsd
Namespaces:http://dev.virtualearth.net/webservices/v1/geocode/contracts
http://schemas.microsoft.com/2003/10/Serialization/Arrays
(Looks like they stopped using dates recently...makes messy packages.)
Using EJB Clients Eliminate Namespace Collisions
● Create public interface that's independent of the remote service's schema
● EJB implementation does not expose JAXB objects created from remote service
● Servlet looks up EJB via JNDI to invoke service via the EJB
● Servlet's classloader is not polluted by the remote service's JAXB objects
Oracle IPlanet Web ServerLoad Balancer
GeocoderService
GeocodeRequest
GeocoderService
Setting Up Clustering
AS_ADMIN_PROFILE=developer by default, change this to “cluster”
ant –f setup-cluster.xml glassfish/bin/asadmin start-domain domain1 glassfish/nodeagents/localhost/agent/bin/startser
v Create clusters using the admin interface Add favorite load balancer (not trivial) Note: ${default_port} of JBI service is replaced
automatically by clustered instance to the actual port used
Adding GZIP Compression
Compressing XML is essential in reducing bandwidth – XML compresses by 80-1 for some cases!
HTTPBC does not support compression currently
Use Web server (Apache or Sun) acting as the load balancer to proxy the requests and provide compression
– Add prefix to JBI end points to redirect all JBI service requests to the correct port
Current Developments in OpenESB
Ported to NetBeans 6.9 recently (very much improved over 6.7.1)
Project Fuji in the works
– Supports Glassfish version 3
– Andi Egloff left Oracle and joined ForgeRock as chief architect to develop Fuji in January, 2011. (OpenESB underlies OpenIDM)
OpenESB Summit Next Monday (May 9th in Los Angeles and workshop in Montreal, Quebec May 12th and soon in Bangelore.
Open source community looking for volunteers!
Opportunities for Improvement Tend to duplicate schema and WSDL definitions across the
various JBI modules NetBeans OpenESB modules are a little buggy and
sometimes need to be restarted to synchronize state Creating WSDL/Schema for each interface is a little tedious Must know WSDL and Schema very well and decent
knowledge of XSL and BPEL Refactoring WSDL, Schemas and BPEL require manual
editing sometimes to handle all dependencies (seems better in NB 6.9)
Importing a schema into a WSDL document doesn’t automatically add the schemaLocation attribute
Not ported to Glassfish 3.x yet
Opportunities to Improve Glassfish 2.1
1)Too many dependencies on native libraries
2)Load balancer is native code and is not open source
3)Time consuming to setup load balancer, especially with the open source version of Glassfish 2.1
4)Can't restart admin server from web interface
5)Node agent can't be started from web interface
Note: Many of these have been improved with v3.1!Note: Many of these have been improved with v3.1!
– ssh used across machines
– OSGI based
– Seems snappier and more robust in terms of status updates
References OpenESB 2.2 Downloads:
http://www.logicoy.com/download_glass
OpenESB 2.3 Downloads:http://hudson.openesb-dev.org:8080/hudson/job/openesb-installers-legacy/
OpenESB 2.3 Project Website: https://openesb-dev.org/
JBI Specification: JSR-000208 Java Business Integration 1.0 Final Release
TutorialsTom Barrett's Tutorials: http://tinyurl.com/yk6oxsdhttp://wiki.open-esb.java.net/Wiki.jsp?page=OpenESBIntroductionTutorialhttp://blogs.sun.com/kevansplace/entry/how_to_use_the_xslt
Tons of blogs and tutorials, just Google OpenESB (I'll email a list of references out to the AustinJUG list as well)
Versioning: blogs.iona.com/sos/20070410-WSDL-Versioning-Best-Practise.pdf
Glassfish OpenESBIntroduction to OpenESB and rationale for choosing an ESBOverview of Java Business Integration (JBI) and the OpenESB Architecture
Normalized Message Router Service Engines Binding Components Composite Applications
Demonstration of creating and deploying a representative sample service that supports multiple protocols with behind the scenes explanations
Creating a new schema with the XML Schema EditorCreating new abstract WSDLs with the WSDL Editor BPEL Editor
Creating a process flowEnhancing BPEL by calling out to local Java static methodsCreating and calling a POJO Calling an external service Calling the XSLT engine to transform your XML
Composite Application Editor Joining the BPEL process with the concrete servicesCustomizing the BCs with the Binding Component Editor
Deployment to Glassfish Glassfish Admin interface walk-through Creating a SOAP client to communicate with the service
Advanced concepts Versioning Services and Schemas
Namespace and WSDL naming tricks Version IDs
An EJB approach to consuming services with different versions of the same schemaOpenESB/Glassfish/Sun Web Server approach to clustering Enabling compression of the XML responses with a front end web server
Current shortcomings and future direction of OpenESB
Detailed Outline