Building out a service-oriented architecture with Java EE

Java web services and SOA

Building out a service-oriented architecture with Java EE

By James Denman

TheServerSide.com

Tony NgA software developers' work in complex enterprise application environments usually involves spending many hours maintaining existing applications, time that could be spent building new and innovative applications. Marrying Java and a service-oriented architecture (SOA) can simplify the process of maintaining enterprise applications, according to Java expert Tony Ng, and free up developers' time for more growth-driven development.

Ng, co-author of Implementing SOA using Java EE, explores the connections between Java and SOA and looks at both in the context of cloud computing in this interview. As director of engineering at Sun Microsystems until 2009, Ng was responsible for driving the release of the Java EE 5 SDK. Ng has co-authored other Java books -- Java Blueprints and J2EE Connector Architecture -- and holds nine software patents.

TheServerSide.com: What types of new challenges are encountered when a project manager begins to adopt a more SOA type of approach to application design and development?

Tony Ng: With SOA, an application is typically composed of a set of services, potentially developed by multiple development teams in a decentralized fashion. To be successful, it would be important to spend time upfront to decompose the problem domain into the right set of services and service interfaces. As a service evolves, it is important to maintain service interface backward compatibility so that the service implementation can evolve independently.

What does SOA implementation mean for Java developers?

Ng: There are some additional concepts that should to be learned by Java developers to implement SOA correctly and efficiently. For example, developers should avoid modeling a Web service interface to be too fine-grain or chatty because of the extra network latency for a Web service client to invoke a SOA service. Developers should also be concerned about the amount of data being transferred.

For interoperability purposes, a SOA Web service would typically define the interface in a programming language neutral fashion (e.g. through the use of WSDL or REST URL patterns). This may be a new concept for developers who are used to developing in a specific programming language. Similarly, developers would need to be aware of common Web service data formats such as XML or JSON.

Finally, it is important that a service-level agreement (SLA) for each service is defined and monitored so that the overall application will perform as expected in terms of performance and availability.

How has implementing SOA changed as we move from J2EE to Java EE 5 and 6?

Ng: One key goal of Java EE 5 is to simplify the development of Java EE applications, including SOA Web services. Java EE 5 includes the following APIs which work together to provide Web services support: 

  • JAX-RPC 1.1
  • JAX-WS 2.0
  • JAXB 2.0
  • SAAJ 1.3
  • JAXR 1.0
  • StAX 1.0
  • Web Services Metadata 2.0
  • Web Services 1.2

The most visible feature in Java EE 5 is the usage of Java annotations. To build a service, a developer only needs to write a POJO (Plain Old Java Object) class, decorate it with the appropriate Web services annotations. The Java EE container would take care of exposing the POJO as a Web service.

Java EE 6 adds support for RESTful Web services through JAX-RS 1.1. JAX-RS provides Java annotations to map a POJO class as a Web service according to the REST architecture style

Looking forward to Java 7, what types of features from the upcoming release will make implementing SOA solutions easier?

Ng: In Java 7, there will be an update to the Web services stack, including JAXP 1.4, JAXB 2.2a and JAX-WS 2.2. Java 7 also includes several enhancements in I/O and networking, including scalable asynchronous I/O operations, socket-channel binding and configuration, and multicast datagrams. These can potentially be leveraged to provide better scalability and performance for SOA platform implementations.

Other relevant features in Java 7 include small Java language enhancements, concurrency and collections updates, i18n enhancements, JDBC 4.1 and enhanced MBeans.

How are enterprise architects leveraging cloud technologies in the area of SOA development and implementation?

Ng: The main benefits of Cloud are deployment agility and IT infrastructure efficiency. The SOA architecture style promotes modularity, encapsulation, loose coupling, distribution and interoperability. These attributes make an application based on SOA an ideal candidate to deploy in a Cloud environment and to realize the benefits of Cloud.

Are there tips you can share on successful patterns for creating services with Java today?

Ng: Here are some quick tips: 

  • Think about reusability, loose-coupling and interoperability.
  • Think about latency. Make sure services interface are not too fine-grain or chatty. Pay attention to request/response payload.
  • Define a SLA for each service.
  • Read our book "Implementing SOA Using Java EE."

11 Jul 2011

Related Resources

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.