Recently I gained access to an electronic copy of the just released Oracle Service Bus 11g Development Cookbook, written by five authors – all experts on OSB and three personal acquaintances of mine. I was very interested in learning about the final result after hearing many intermediate comments during the writing process as well as reading the occasional remark on Twitter. Knowing Guido, Eric and Edwin and assuming the same expert level for the other two authors, I anticipated a very interesting read.
Below I will share my impressions from browsing through this solid 500+ page volume. Note: the homepage for the book can be found here: http://www.packtpub.com/oracle-service-bus-11g-development-cookbook/book .
Chapter 1 provides an introduction to OSB. It demonstrates development of a simple OSB Service – one that merely echoes the input – and then step by step increases the complexity by introducing the business service connecting to an external web services, using a routing step and finally bringing XQuery transformations and assign steps leveraing them into the picture. It provides a clear way to get going. A good refresher for readers with OSB experience and a good way to quickly get going for novice OSB users. The recipe based approach adopted by Packt for many of its publications does not work very well in this chapter in my opinion.
The second chapter – an overview of special operations and features in the OSB IDE (the Eclipse plugin) lends itself much better for this recipe style approach. This chapter shows how to move resources around within and across projects – useful to know and to look up when such operations are required. The introduction of the OSB Debugger in this chapter is valuable – I learned a trick or two from this overview. Chapter two also briefly introduced JDeveloper and its SOA Composite Editor used for SCA Composite applications that run in the SOA Suite. This introduction is relevant because working with JCA adapters – while supported in the OSB run time – requires JDeveloper for the design time configuration of the adapters (unless you are a real XML jock of course). The chapter demonstrates how the OSB project in Eclipse can be set up to work well with the JCA resources created in JDeveloper.
Chapter 3, 4 and 5 are a little bit alike – each discussing a special transport with (and for JEJB even through) the OSB. Chapter 3 explains the JMS transport or how OSB can use proxy services to be triggered by inbound traffic from (WebLogic) JMS destinations and business services for outbound messages. Chapter 4 does the same for EJB and JEJB – describing how a Proxy Services can be exposed as a (remote) stateless session bean and how a business service can be used to call out to a (remote) EJB. Chapter 5 explains HTTP as a transport, both with and without SOAP.
The discussion of JMS is thorough and clear. It includes both Queue and Topic and both non-durable and durable subscription. It introduces useful tools – QBrowser and Hermes in SoapUI – for working with JMS objects. The chapter explains the concept of the Request/Reply over JMS very well – demonstrating in detail the synchronous case and forward referencing the asynchronous case in a later chapter. The clear diagrams – used consistenly throughout the book – provide clear insight in the discussion:
As part of the otherwise good description of message filtering, out of curiosity some indication of how content based message selection should be done would have made sense: message selectors are part of the JMS subscription created in WLS – but these only refer to (custom) properties and headers. What should one do if the content of the message determines whether or not to process the message? The JMS JCA Adapter – used with SOA Suite 11g – does not enter the discussion (as happens for the File Transport later on). I would be interested to learn whether the OSB JMS transport is richer or poorer in functionalitu than the JCA Adapter – and whether in the long run it may disappear and give way to the JCA Adapter or instead continue on. The chapter does not mention whether and how OSB can work with other JMS providers besides WebLogic. Given the fact that OSB runs on WLS, that may not be an extremely relevant point.
Chapter 4 introduces the EJB and JEJB transports. It makes quite clear how EJBs can be called from the OSB as well as how OSB proxy services can be published as EJB themselves. It goes the extra mile of explaining the concept of custom converters – to convert Java Objects not supported for conversion to XML by the JAX-RPC engine. It also explains how EJBs on a remote WLS domain can be invoked – just when I started wondering about that. After discussing the EJB (2.x or 3.0) transport, the chapter zooms in on the fairly recent JEJB transport, that allows pure Java objects to be moved around without the need for serialization into XML, providing a leaner and meaner mechanism when applicable. And again, just when I started wondering about manipulating the POJOs moved through OSB in this case, the chapter provides a very clear explanation of how the Java Callout can be used to have this manipulation performed in a custom Java code. It is well paced, clear and all relevant.
Somewhat surprising – the pure Java examples in this chapter are presented in the context of JDeveloper. With the OEPE OSB plugin running in Eclipse, one would have expected to see Eclipse used as the Java IDE as well.
The Http transport – subject of chapter 5 – had been used from the very beginning: the simplest OSB service created in chapter 1 used Http transport for a straightforward SOAP based WebService case. Chapter 5 continues from the SOAP over HTTP case and demonstrates how plain HTTP requests – with no SOAP envelopes but plain XML content or even just simple GET requests with associated URL query parameters – can be handled. The concept of RESTful services – services that are invoked over plain HTTP using the standard HTTP verbs GET, POST, PUT, DELETE and using meaningul, resource oriented URLs such as host:port/domain/service/resource/identifier – is discussed at length. Interpreting the special URL syntax, supporting various HTTP operations and working with query parameters is explained quite well. One important aspect of many RESTful services is not discussed at all – even though the term is mentioned in the discussion of the external Beer Service – and that is the use of JSON as the format for messages, rather than XML. It would have been useful and relevant to have this extra step explained or even referred to.
The last recipe in chapter 5 is on WebSockets – a fairly new and potentially revolutionary development for web applications. It is an intriguing topic – WebSocket communication through OSB with for example an HTML 5 client on one end and a real WebSocket server on the other. Unfortunately, I feel the topic is too grand for this book and the discussion in this chapter – while a brave attempt – leaves the reader with more questions than answers. Perhaps a brief overview and a reference to a more extensive on line document would have been better. As it stands, I am afraid the recipe does not add a lot of value.
Chapter 6 discusses the File and FTP transports, available in OSB for working with files, as well as the email transport. These first two transports can either trigger a proxy service when a file arrives on a watched location (inbound) or be used to write a file through a business service (outbound). SOA Suite 11g uses the JCA based File and FTP adapter for similar purposes and these adapters can also be used with OSB. Chapter 6 even describes how to use the JCA adapter for reading from a file somewhere in a message flow in a proxy service, because that is something the OSB File transport cannot do. Chapter 6 argues how the JCA adapters provide more functionality that the file and ftp transports in OSB. This makes me wonder why not always use the JCA adapters – apart from the hassle of using JDeveloper as a design time for these adapters. This question is not answered in the chapter – it only explains how the JCA adapters “provide far richer metadata about the file being processed” while “The File and FTP transports are not as feature-rich as the corresponding File and FTP JCA adapters”.
The discussion of the File transports is fairly complete, including the steps required to dynamically determine file name and location (for outbound) and a useful instruction on reading files in an XQuery script through the doc function.
The FTP transport is discussed in a similar vein. Another useful tool – CoreFTP – is introduced for getting a local FTP server up and running for development purposes. Note that the Oracle Database can also act as an FTP server – another interesting use case perhaps.
Triggering a proxy service through the reception of an email is a good use case, as is the ability to send an email from the OSB. The second part of chapter 6 – I am not sure why this topic did not get its own chapter as it is not all that much related to the file and ftp transports – handles about the email transport that provides exactly this functionality. The user is instructed on setting up Apache JAMES email server and Mozilla Thunderbird email client in preparation. Then the simple case (note that even this simple case is currently not supported with SOA Suite 11g) of receiving an email to trigger a proxy service is explained. Immediately the next recipe steps up the level of complexity (and relevancy) and discusses the processing of email attachments. The final recipe in this chapter demonstrates sending emails to static or dynamically determined addresses. I am not sure whether sending an email through the business service is the only way to ‘reply’ to an email that was received or if a proxy service that is triggered by the reception of an email can have a reponse pipeline that ends in the sending of a ‘reply’ to the original email, just like an asynchronous WebService or JMS Request/Response case. This is one of the few times that the book did not answer a question that popped up.
Interacting with the Database
Chapter 7 talks about the database or rather the communication from the OSB with the database. This type of communication was not natively supported in the BEA’s AquaLogic Service Bus through a special transport, so this communication is based entirely on the JCA Database Adapter that is well known in the SOA Suite. Most of this chapter is about how to configure the various inbound (polling) and outbound (perform SQL to read from or manipulate to tables) variations of the Database Adapter. The chapter does not discuss the option to invoke PL/SQL code (Stored Procedures) using the database adapter. Given the fact that frequently database access by OSB is implemented through a PL/SQL based API rather than directly to tables using pure SQL, I find that a surprising omission from an otherwise so throrough book.
Most of the discussion of the Database Adapter consists of screenshots from JDeveloper where composite applications are created with Database Adapter services that are configured using the wizard in JDeveloper’s SOA Composite Editor plugin. The resulting artifacts are subsequently used in Eclipse to implement JCA transport based business services (for outbound) or proxy services (for inbound, triggered from polling). The discussion of the JCA database adapter is thorough, including a useful explanation on the Detect Omissions Flag and a clear example of using a sequencing file to record which records have been polled and processed. Note that most of this discussion, however useful, is not specific to OSB.
In addition to the Database Adapter, the chapter also talks about the AQ Adapter – the Oracle Database advanced queuing counterpart to JMS. In fact, WebLogic JMS can use AQ as its underlying infrastructure. I am not sure even though AQ is part of the Oracle RDBMS, the discussion of the AQ Adapter is best done in the chapter on the database adapter. It feels closer to JMS – given the message and queue nature of both JMS and AQ. Well, that is the type of zealous sifting of a book that you expect a petty critic to do, isn’t it?
OSB and SOA Suite – having intimate relations
Chapter 8 talks about the interaction between OSB and SOA Suite 11g. Using the SOA-DIRECT transport, invoking a SCA composite synchronously or asynchronously from an OSB service can be performed efficiently and with a number of advanced features enabled. These include Remote Method Invocation (RMI), WS-Addressing, Identity propagation, Transaction propagation, Attachments, High availability and clustering support, Failover and load balancing. The chapter explains how to use the Direct Binding services (incoming) and references (outgoing) in SOA Suite 11g and the corresponding transport in OSB for both Proxy Services (for incoming requests from SOA Suite 11g) and Business Services (for calls to the SOA Suite 11g). The discussion is clear and to the point, but also purely technical. There is no explanation of why you may want to perform calls between OSB and SOA Suite and how the two could or should work together. The respective roles of OSB and SOA Suite, when both are around, is not touched upon. All we know from the chapter is how one can call the other. The consequences by the way for an end-to-end flow trace (through both OSB and SOA Suite) are not part of the chapter either. All in all, if all you want is have OSB and SOA Suite 11g (or vice versa) working together, this chapter will get you prepared for that task.
Complex Message Flows and Composite (orchestrated) Services
Chapter 9 is not about external interaction or internal transports. It is about more complex message flows in proxy services. When we did not have OSB, but only BPEL for complex services, all composite services were nails for our BPEL hammer. With OSB added to the tool box, we have a second option for creating complex, composite services. This chapter helps to bring OSB services to the higher, coarser grained level where one proxy service can invoke multiple services – instead of just the one business service – in a single request/response flow. In short – for those who know BPEL – to bring OSB Services to a level very similar to BPEL.
The specific recipes in this chapter discuss:
- the Service Callout action – a synchronous invocation of an external service, very similar to a BPEL Invoke activity.
- the Publish action – a non-blocking call to a one-way service (or even a two way service whose answer is not waited for nor processed)
- the Java Callout action – to invoke a method in a custom Java class
- the use of custom XPath functions implemented using custom Java classes
- the ForEach action to perform one or more actions multiple times in a iterative, sequential loop
- the Split-Join to perform one or more actions multiple times and in parallel
- the Validate action to perform XSD based validation on messages or parts of messages
- use of private Proxy Services
I found this chapter good to read and useful to consume. For example the recipe where the Service Callout is applied for message enrichment, including the explanation of extending the XQuery transformation with the enrichment results from the service invoked through the call out. The discussion of the Java Callout is fine. However, it seems that the author of this chapter forgot that Java Callout was already discussed in Chapter 4 for the JEJB transport and no references are made to it. I also would have expected some reference to JAXB; OSB uses XMLBeans, a less well known alternative to the standard defined by JAXB for XML to Java unmarshalling; is that a temporary situation and will JAXB be adopted? Or is the OSB continuing its use of XMLBeans?
Custom XPath functions – implemented in custom Java classes that have to be registered in an XML file in a special folder on the OSB Server – are described very clearly, as is their use in an OSB project inside an XQuery transformation.
ForEach is fairly straightforward to use. Its discussion is crisp, clear and to the point. Its parallel-processing-enabled cousing the Split-Join is a far more complex feature. Its discussion is okay. It feels like it is not doing it enough justice – but I cannot really point out what the issue is I see with it. In this section I ran into one of the few – but funny – spelling errors: the split-joint (that’s what you get from all those Dutch guys participating on a book I suppose).
Validate is the one but last topic of the chapter. It is simple enough. Its discussion is decorated with a nice example of using a JMX exposed MBean that can be used to manipulate settings immediately impacting the OSB Service behavior at run time time through for example the JConsole. The last subject is the concept of private proxy services that can only be used by other OSB Services. The book argues successfully how these private services can be used to create reusable blocks of processing logic; the example in the chapter is a simple private logging service that is efficiently invoked through Publish actions in other services.
Chapter 10 does not so much add new functional features but instead discusses the non-functional area of reliability. The use of global transactions (and the consequence of actions outside those transactions) are discussed, JMS message persistence as well as the usage of the JMS message redelivery option to control the number of attempts to continue to deliver failed messages. Note that most of this discussion is not OSB specific but generic WebLogic JMS theory. I like the explanation about XA (Global Transactions). It is very instructive. The discussion focuses only on JMS – which is a pity as XA concerns more transports and components than just JMS.
The last topics in this chapter are not simple ones: reliable messaging for WebService interactions using WS-RM (one of the WS* specifications) and using SOAP over JMS. The use of WS-RM is made clear. However, it is a little bit confusing that in this chapter the OSB service has a WLS 9 policy assigned to it when in Chapters 11 and 12 we are warned against using these ‘deprecated’ policies and picking the modern OWSM policies. Subsequently, a Java Client to invoke this OSB Proxy Service with WS-RM policy applied to it is developed. In JDeveloper rather than in Eclipse. It is very easy to apply Oracle OWMS security and QoS policies to web service proxies in JDeveloper, so that is probably the explanation for this. It is a fairly difficult topic and the author makes valiant attempt to demonstrate what is going on. It still requires a lot of focus to carefully read and process this section of the book.
Chapters 11 and 12 discuss security. First message level security – through authentication and encryption using several OWSM security policies attached to the proxy service and through message access control – user or role based authorization specified through an access list defined through the OSB Console for a proxy service. After securing OSB proxy services, we also get instructions on calling out to secure services from OSB by attaching security policies to business services. The various OWSM policies and the required set up to get authentication, certificates and encryption working is very good – especially given the nature of this topic and the lack of very clear documentation in this area. A job well done!
The last chapter – transport security – is easier on the brain. The use of SSL to implement transport layer security is largely outside the scope of OSB. However, the first recipe reiterates basic authentication – already discussed in chapter 11 – and adds OSB Service Accounts to the overall picture. The next topic is the configuration of WebLogic Server in order to allow communication to take place over SSL. When this is set up, we can configure proxy services to only accept requests over SSL. This is clearly demonstrated. How to invoke an external service over SSL from a business service is not discussed. And with that recipe, the book ends- a little abruptly. No final summary or conclusions, no suggested further reading or supporting resources. Only an index and that is all folks.
What is not in this book?
Some areas around OSB that I had considered relevant for this book that were largely or even entirely lacking from it – no complaint, just stating a fact – include:
- reporting, tracing, alerting, SLA management and other administration oriented topics
- throttling, caching and load balancing
- tuning, scalability
- designing the application architecture and deciding how to engage the OSB in a larger picture
- OSB Service development through the OSB Console (the console only makes a few very brief appearances)
- best practices – most recipes show what can be done, but do not discuss what is the best approach for specific functional requirements or the usage of certain features
One of the things I really like about this book that it seems like the authors can read my mind. Just when I start wondering after reading a certain section ‘now how would I be able to do this next step or this (more complex) variation of what was discussed before’, they seem to move on with answering exactly that question. Many books seem to provide only the basic example without going the extra mile that you will need in the real world. This book in contrast does exactly that: it does discuss and demonstrate many of the variations and intricacies the real world will require of us.
The book explains the OSB in detail and also describes how to make the OSB and SOA Suite 11g (SCA container) work together. It stays at the operational level and does not really discuss architectural considerations. Questions like “why to use one product or feature instead of another one”, “how to set up governance for OSB artifacts” or “how to design and implement a multi tier architecture for specific purposes such as data integration, mobile applications or B2B interaction” are not the scope of the book. It is understandable – and yet I feel that it would have added a lot of value. The sheer knowledge the five authors bring to the table would have made for great discussions at tactical level too. Maybe they preserve that for a next book. I would certainly welcome that.
The preface to the book describes the intended audience: “If you are an intermediate SOA developer who is using Oracle Service Bus to develop service and message-orientated applications, then this book is for you. The book assumes that you have a working knowledge of fundamental SOA concepts and Oracle Service Bus.” I think this is exactly right. Getting started with OSB through this book might be a bit tough – you need a slightly more gradual introduction than this. However, once you done some introductory tutorials and perhaps have talked to more seasoned OSB developers and built up some initial feeling, this book is perfect to propel you to a level where you can quickly become productive in a broad scope of tasks. Most of the activities you will have to perform as an OSB developer are discussed in this book. You need additional resources to learn about XML, WebServices (WSDL, SOAP) and XQuery and depending on what you need to do you may have a need for SQL and/or Java skills but for the work you do with OSB itself – it is bull’s eye!
I hope for the authors that the 12c release of OSB will be off for some time, so this book has its deserved time in the lime light. I also hope on the readers behalf that this band of authors will reconvene to produce a 12c version of their book once that release hits the streets. I congratulate them with their work.
I have enjoyed reading this book, I have learned several useful things from it and I am sure that many developers – either just starting out with OSB or already working with it for quite some time – will benefit from it. It contains many recipes that will prove useful to re-read once a specific requirement needs to be implemented. And it provides quite some inspiration for trying out things – something I really like in a book.