|By Jinsong Yang||
|January 14, 2009 09:59 PM EST||
Since its emergence, Web Service technology has gone a long way towards perfecting itself and finding its right application in the real world. With the maturity of the specifications, Web Service technology, with its power of interoperability, is now the major enabling technology of SOA, which is being adopted by more and more enterprises to build their application integration infrastructure.
Developing Web Services involves a variety of technologies, XML processing, SOAP, and WSDL, to name a few. Luckily, there are frameworks that target handling theses kinds of middleware functions, freeing up developers to focus on the business logic.
Nowadays, many Web Service frameworks exist for all kinds of programming languages. Some of them are open source, others are commercially available. Some examples of such frameworks are Apache Axis and Axis2, WS02 Web Services Framework (WSF), Java Web Services Development Pack (GlassFish), JBossWS, and XINS.
Being one of the Web Service frameworks for Java, Apache CXF is an open source framework developed by the Apache Software Foundation. It's a continuation and merging of two open source projects, Codehaus' XFire project and ObjectWeb's Celtix project. When this was written, the stable version was 2.0.
CXF enables the creation of Web Services using Java technologies. It supports a variety of Web Service standards including WS-I Basic Profile 1.0, WS-Addressing, WS-Policy, WS-ReliableMessaging, and WS-Security.
CXF supports transport protocols like HTTP and JMS. The messaging formats supported include SOAP, XML, RESTFul HTTP, and CORBA. Besides JAXB data binding, it also supports Aegis binding.
CXF is JAX-WS (JSR 224)-compliant and version 2.0 has passed the TCK for JAX-WS 2.0. It makes intensive use of Java 5 annotations and so requires JDK/JRE 5.0 and above.
CXF leverages the Spring application framework for bean management. Endpoints and service clients can be managed as Spring beans.
In the first section of this article, a step-by-step Web Service example using CXF is presented. Some of CXF's basic features are revealed while going through the steps of creating the example. Then we'll touch on some of the unique features of CXF, including RESTful service support and Spring integration. At the end, a brief performance test will compare CXF with JBossWS and the JAX-WS Reference Implementation (RI).
An Example: Getting Movie Show Times
In this example, we'll build a Web Service that lets a client system query for movie show times using the ZIP code entered by a user. For demonstration purposes, most of the irrelevant details are ignored.
CXF supports both code-first development and contract-first development. While code-first development is a handy feature, and most developers find it more straightforward and easier to get start with, it has a vital weakness.
There are several reasons for this. First, a key aspect in successfully developing Web Services is to determine its granularity. Considering the fact that the major application of Web Services is to implement SOA solution at a really high level (e.g., at the enterprise level), the granularity couldn't be too small. In contrast are the Java classes and methods, which tend to be very fine-grained, and are often designed at the very low level (i.e. the class level). Secondly, Web Services bare the nature of language neutral. Building a service from a specific language (like Java) and transforming it into a language-neutral form through some tools would, in some cases, bring over language-specific features, which will degrade the language-neutral nature, thus hurt the interoperability, of the service. Lastly, from a design point of view, service-oriented principles are significantly different from object-oriented paradigms. Although an individual service might be realized using OO principles and techniques, the interaction between services rarely using any of them.
Due to the aforementioned reasons, code-first development will never let you get to the spirit of service-oriented development because developing in Java code and developing in WSDL requires different mindset. Developing with Java code-first and avoiding WSDL as much as possible will guarantee that you will build mediocre software at the best. This is especially true when it comes to designing and developing a SOA solution rather than just individual services.
With that said, let's start with contract-first development for our example, the first step of which is to create the contract - the WSDL document that describes the service.
Listing 1 shows a segment of the WSDL document. In this document a service called MovieService is defined. This service has only one operation GetShowtimesForZip. The input of this operation is a message containing the ZIP code that the user entered, and the response is a list of theaters and movies along with show times.
The types are defined in a separated XML Schema document and are imported using <xsd:import> statement. The schema document isn't listed here to avoid lengthy text.
Nothing is really special about this WSDL document. Let's now generate the service interface and the service endpoint interface (SEI) from the WSDL document.
Service and Service Endpoint Interfaces
With the WSDL document ready, our next step is to generate server-side Java code from it. CXF provides a tool called wsdl2java that can be used to generate fully annotated Java code from a WSDL document. This tool operates according to the JAX-WS rules for WSDL <--> Java mapping, and its data binding mechanism conforms to JAXB (JSR 22). The tool comes with a set of optional arguments that allow control of the behavior of the tool.
The WSDL document used to generate the Java code has to have a valid portType element, but it doesn't require a binding element or a service element.
The simplest form of running the tool on the command line is listed in Listing 2.
You can specify the package of the generated code using the -p option as shown in Listing 3.
JAX-WS defines an XML-based binding language that can be used to customize the WSDL to Java bindings. The wsdl2java tool implements this feature using the -b option. Listing 4 shows how to specify a JAX-WS binding file for customization.
You can ask the tool to generate an Ant build file for use in your application. To do so, use the -ant option as shown in Listing 5:
Or you can define your own Ant macro. A sample of such a macro is included in the CXF distribution. Listing 6 shows a modified version of it.
|kuldeep_saini83 08/29/09 08:33:00 PM EDT|
|yogesh 10/06/08 02:27:38 PM EDT|
Big Data engines are powering a lot of service businesses right now. Data is collected from users from wearable technologies, web behaviors, purchase behavior as well as several arbitrary data points we’d never think of. The demand for faster and bigger engines to crunch and serve up the data to services is growing exponentially. You see a LOT of correlation between “Cloud” and “Big Data” but on Big Data and “Hybrid,” where hybrid hosting is the sanest approach to the Big Data Infrastructure pro...
Jul. 24, 2016 07:45 PM EDT Reads: 1,841
"My role is working with customers, helping them go through this digital transformation. I spend a lot of time talking to banks, big industries, manufacturers working through how they are integrating and transforming their IT platforms and moving them forward," explained William Morrish, General Manager Product Sales at Interoute, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Jul. 24, 2016 07:30 PM EDT Reads: 2,044
A critical component of any IoT project is what to do with all the data being generated. This data needs to be captured, processed, structured, and stored in a way to facilitate different kinds of queries. Traditional data warehouse and analytical systems are mature technologies that can be used to handle certain kinds of queries, but they are not always well suited to many problems, particularly when there is a need for real-time insights.
Jul. 24, 2016 07:30 PM EDT Reads: 1,683
With 15% of enterprises adopting a hybrid IT strategy, you need to set a plan to integrate hybrid cloud throughout your infrastructure. In his session at 18th Cloud Expo, Steven Dreher, Director of Solutions Architecture at Green House Data, discussed how to plan for shifting resource requirements, overcome challenges, and implement hybrid IT alongside your existing data center assets. Highlights included anticipating workload, cost and resource calculations, integrating services on both sides...
Jul. 24, 2016 07:00 PM EDT Reads: 1,923
"We are a well-established player in the application life cycle management market and we also have a very strong version control product," stated Flint Brenton, CEO of CollabNet,, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Jul. 24, 2016 06:45 PM EDT Reads: 1,751
Unless your company can spend a lot of money on new technology, re-engineering your environment and hiring a comprehensive cybersecurity team, you will most likely move to the cloud or seek external service partnerships. In his session at 18th Cloud Expo, Darren Guccione, CEO of Keeper Security, revealed what you need to know when it comes to encryption in the cloud.
Jul. 24, 2016 05:00 PM EDT Reads: 2,346
We're entering the post-smartphone era, where wearable gadgets from watches and fitness bands to glasses and health aids will power the next technological revolution. With mass adoption of wearable devices comes a new data ecosystem that must be protected. Wearables open new pathways that facilitate the tracking, sharing and storing of consumers’ personal health, location and daily activity data. Consumers have some idea of the data these devices capture, but most don’t realize how revealing and...
Jul. 24, 2016 05:00 PM EDT Reads: 2,018
What are the successful IoT innovations from emerging markets? What are the unique challenges and opportunities from these markets? How did the constraints in connectivity among others lead to groundbreaking insights? In her session at @ThingsExpo, Carmen Feliciano, a Principal at AMDG, will answer all these questions and share how you can apply IoT best practices and frameworks from the emerging markets to your own business.
Jul. 24, 2016 04:15 PM EDT Reads: 1,542
Ask someone to architect an Internet of Things (IoT) solution and you are guaranteed to see a reference to the cloud. This would lead you to believe that IoT requires the cloud to exist. However, there are many IoT use cases where the cloud is not feasible or desirable. In his session at @ThingsExpo, Dave McCarthy, Director of Products at Bsquare Corporation, will discuss the strategies that exist to extend intelligence directly to IoT devices and sensors, freeing them from the constraints of ...
Jul. 24, 2016 03:45 PM EDT Reads: 1,722
You think you know what’s in your data. But do you? Most organizations are now aware of the business intelligence represented by their data. Data science stands to take this to a level you never thought of – literally. The techniques of data science, when used with the capabilities of Big Data technologies, can make connections you had not yet imagined, helping you discover new insights and ask new questions of your data. In his session at @ThingsExpo, Sarbjit Sarkaria, data science team lead ...
Jul. 24, 2016 03:30 PM EDT Reads: 893
Extracting business value from Internet of Things (IoT) data doesn’t happen overnight. There are several requirements that must be satisfied, including IoT device enablement, data analysis, real-time detection of complex events and automated orchestration of actions. Unfortunately, too many companies fall short in achieving their business goals by implementing incomplete solutions or not focusing on tangible use cases. In his general session at @ThingsExpo, Dave McCarthy, Director of Products...
Jul. 24, 2016 03:15 PM EDT Reads: 1,669
Traditional IT, great for stable systems of record, is struggling to cope with newer, agile systems of engagement requirements coming straight from the business. In his session at 18th Cloud Expo, William Morrish, General Manager of Product Sales at Interoute, outlined ways of exploiting new architectures to enable both systems and building them to support your existing platforms, with an eye for the future. Technologies such as Docker and the hyper-convergence of computing, networking and sto...
Jul. 24, 2016 03:00 PM EDT Reads: 1,007
WebRTC is bringing significant change to the communications landscape that will bridge the worlds of web and telephony, making the Internet the new standard for communications. Cloud9 took the road less traveled and used WebRTC to create a downloadable enterprise-grade communications platform that is changing the communication dynamic in the financial sector. In his session at @ThingsExpo, Leo Papadopoulos, CTO of Cloud9, discussed the importance of WebRTC and how it enables companies to focus...
Jul. 24, 2016 02:30 PM EDT Reads: 761
With an estimated 50 billion devices connected to the Internet by 2020, several industries will begin to expand their capabilities for retaining end point data at the edge to better utilize the range of data types and sheer volume of M2M data generated by the Internet of Things. In his session at @ThingsExpo, Don DeLoach, CEO and President of Infobright, discussed the infrastructures businesses will need to implement to handle this explosion of data by providing specific use cases for filterin...
Jul. 24, 2016 02:00 PM EDT Reads: 1,188
IoT generates lots of temporal data. But how do you unlock its value? You need to discover patterns that are repeatable in vast quantities of data, understand their meaning, and implement scalable monitoring across multiple data streams in order to monetize the discoveries and insights. Motif discovery and deep learning platforms are emerging to visualize sensor data, to search for patterns and to build application that can monitor real time streams efficiently. In his session at @ThingsExpo, ...
Jul. 24, 2016 01:30 PM EDT Reads: 810
Early adopters of IoT viewed it mainly as a different term for machine-to-machine connectivity or M2M. This is understandable since a prerequisite for any IoT solution is the ability to collect and aggregate device data, which is most often presented in a dashboard. The problem is that viewing data in a dashboard requires a human to interpret the results and take manual action, which doesn’t scale to the needs of IoT.
Jul. 24, 2016 12:00 PM EDT Reads: 1,879
Internet of @ThingsExpo has announced today that Chris Matthieu has been named tech chair of Internet of @ThingsExpo 2016 Silicon Valley. The 6thInternet of @ThingsExpo will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
Jul. 24, 2016 12:00 PM EDT Reads: 1,890
What does it look like when you have access to cloud infrastructure and platform under the same roof? Let’s talk about the different layers of Technology as a Service: who cares, what runs where, and how does it all fit together. In his session at 18th Cloud Expo, Phil Jackson, Lead Technology Evangelist at SoftLayer, an IBM company, spoke about the picture being painted by IBM Cloud and how the tools being crafted can help fill the gaps in your IT infrastructure.
Jul. 24, 2016 11:00 AM EDT Reads: 2,027
SYS-CON Events announced today the Enterprise IoT Bootcamp, being held November 1-2, 2016, in conjunction with 19th Cloud Expo | @ThingsExpo at the Santa Clara Convention Center in Santa Clara, CA. Combined with real-world scenarios and use cases, the Enterprise IoT Bootcamp is not just based on presentations but with hands-on demos and detailed walkthroughs. We will introduce you to a variety of real world use cases prototyped using Arduino, Raspberry Pi, BeagleBone, Spark, and Intel Edison. Y...
Jul. 24, 2016 11:00 AM EDT Reads: 1,313
Much of IT terminology is often misused and misapplied. Modernization and transformation are two such terms. They are often used interchangeably even though they mean different things and have very different connotations. Indeed, it is somewhat safe to assume that in IT any transformative effort is likely to also have a modernizing effect, and thus, we can see these as levels of improvement efforts. However, many businesses are being led to believe if they don’t transform now they risk becoming ...
Jul. 24, 2016 11:00 AM EDT Reads: 1,113