Java Reference
In-Depth Information
Chapter 11
Accessing Web Services
An expert is a man who has made all the mistakes which can be made, in a narrow field.
—Niels Bohr
The modern application paradigm is clear: Nothing lives in an isolated environment. Client applications interact with
data obtained from a wide array of resources, both physical and logical. Whether data are retrieved from a hard disk,
a remote database, or an exposed network resource, we expect our applications to be flexible, provide a wide array of
data retrieval options, and, in general, work well with others.
So far, we've explained how the JavaFX Platform can be used both for rendering information and for interactively
manipulating data. In this chapter, we provide a brief overview of the options available for integrating JavaFX
applications with enterprise systems, and then continue with some specific examples of that process.
Our examples are constructed to demonstrate how easily a JavaFX application can access a REST resource and
then translate the response (from either JSON or XML format) into a format understandable by JavaFX Controls. As
our example external data source, the StackExchange APIs are ideal, as they are publicly available, easy to understand,
and widely used on the Internet.
Front-End and Back-End Platforms
JavaFX is often considered a front-end platform. Although that statement does not do justice to the APIs in the
JavaFX platform that are not related to a UI, it is true that most JavaFX applications focus on the rich and interactive
visualization of “content.”
One of the great things about Java is the fact that a single language can be used within a wide range of devices,
desktops, and servers. The same Java language that creates the core of JavaFX is also the fundamental core of the Java
Platform, Enterprise Edition (Java EE).
The Java Platform is the number one development platform for enterprise applications. The combination of the
JavaFX platform providing a rich and interactive UI with enterprise applications running on the Java Platform creates
huge possibilities. To achieve this, JavaFX applications and Java enterprise applications must be exchanging data.
Exchanging data can happen in a number of ways, and depending on the requirements (from the front end as
well as from the back end), one way might be more suited than another.
Basically, there are two different approaches:
The JavaFX application can leverage the fact that it runs on the same infrastructure as typical
enterprise applications, and can deeply integrate with these enterprise components. This is
illustrated in Figure 11-1 .
 
Search WWH ::




Custom Search