.NET & J2EE Interoperability
Authors: Peltzer D.
Published year: 2004
Pages: 11-15/101
Buy this book on amazon.com >>

Interoperability in the Enterprise

Interoperability between components exists on various levels. In other words, independent technologies residing within a platform such as J2EE can communicate with each other through interfaces designed expressly to allow for application integration. These technologies can also interact across platforms with diverse protocols on other platforms.

The web services container (for example, IBM’s WebSphere Application Server) hosts the application. These containers consist of a number of components that manage transactions, persistence services (saving and storing data to your repositories or hard drive), and application security. The components include servlets, Java Server Pages, and Enterprise JavaBeans. The beans contain business logic and perform business processes when invoked. A container interacts with relational data stores by utilizing the JDBC API Data Access API, or optionally , SQL/J. With the inclusion of the new J2EE connectors, the container also provides connectivity to legacy systems. J2EE leverages SOAP, UDDI, WSDL, and ebXML web services through Java APIs for XML (JAX APIs).

Clients access J2EE applications through web services. Servlets accept web service requests , whereas applets access the Enterprise JavaBean layer through a technology called Internet Inter-ORB Protocol (IIOP).

Note 

J2EE uses RMI-IIOP and Java Naming and Directory Interface (JNDI) for access to remote objects. They can also leverage the much simpler lightweight Remote Procedure Call (RPC) request- response technology, provided the client is sending parameters rather than objects to the server. Also, RPCs usually interact with procedural applications, whereas RMI-IIOP provides true interoperability with applications written in non-Java languages.

Web browsers and wireless devices interact with Java Server Pages (JSPs), which provide HTML, XML, or WML user interfaces.



J2EE Servlets, Java Server Pages, and Web Services

Chapter 2 focuses on server-side servlets, Java Server Pages (JSPs), and web services. Servlets function as a mediator between client calls and JavaBeans or Enterprise JavaBeans (EJBs), and interaction with the data source and database. The Model, View, Controller (MVC) is the business development model selected for J2EE distributed enterprise application development in Chapters 2, 3, and 4.



Enterprise JavaBeans, Interfaces, and JDBC Persistence

Chapter 3 covers development of Enterprise JavaBeans, and how to employ the home and remote interfaces. A set of rules defines the path for creating EJBs. Java Database Connectivity is examined in detail and demonstrates how JNDI (Java Naming and Directory Interface) and RMI-IIOP are used to connect with repositories in a distributed environment.



RMI-IIOP, the JNDI, and Deployment Descriptors

Chapter 4 discusses the RMI technology and how it accesses remote objects across platforms. Deployment descriptors and XML play a significant role in deploying an enterprise-distributed application. Deployment of JAR files is also examined.



.NET Language Integration Components

The .NET Framework offers internal interoperability between programming languages supported by Microsoft. Three specification components, discussed in detail in Chapter 5, define the .NET Framework:

  • Common Language Runtime (CLR)

  • Common Type Specification (CTS)

  • Common Language Specification (CLS)

Common Language Runtime Tasks

The CLR’s primary task is to generate a .NET assembly as well as metadata that describes every data type residing within the assembly’s binary. The CLR also identifies the assembly’s version. This allows COM binaries and assemblies to coexist side by side without causing an exception. Once it has read the assembly’s metadata, the Intermediate Language (IL) code compiles to a platform-specific set of application instructions.

Note 

This is similar to Java’s method of compiling code into bytecode, a cross-platform intermediary. At runtime, the Java Runtime Environment (JRE) interprets the bytecode and then executes it.

All programming languages targeting the .NET Framework must adhere to base class libraries provided by the Framework in order to achieve interoperability. Additionally, the CLR supports cross-language exception handling and debugging.

The .NET assembly manifest includes a detailed assembly description as well as identifying a list of externally referenced assemblies required for application execution. The CLR generates both single-file assemblies and multi-file assemblies. The first type is a single binary, whereas the multi-file assembly contains more than one binary.

CTS Supports Data Type Interoperability

The Type refers to a collection of classes, interfaces, structures, delegates, and enumerations supported by the runtime engine. An alternative is to build custom data types and place them in a unique namespace, thereby eliminating name conflicts between assemblies. For those who are VB 6 developers, the Common Type System Structure replaces VB 6.0 Types . VB 6.0 supported the Type keyword, allowing for the creation of user -defined types. However, in the .NET environment, Structure defines numeric types such as complex numbers . The CTS provides information on all data types supported by the runtime. Through reflection, the CTS describes how data types interact with each other.

Note 

Structures can implement any number of interfaces but cannot derive from other base types. Rather, they are sealed. (A sealed modifier prevents a derived class from further overriding a specified method.)

The Common Language Specification

The CLS provides a set of guidelines explaining rules that a .NET-aware compiler must follow in order for generated code to be eligible for support by the CLR. The CLS permits all languages supported by the .NET Framework to share Intermediate Language (IL) code.

Note 

Write your applications with CLS-compliant data types to ensure interoperability with other .NET- targeted languages.

Private variables declared within a function or subroutine can use nonsupported data types and still achieve interoperability.


.NET & J2EE Interoperability
Authors: Peltzer D.
Published year: 2004
Pages: 11-15/101
Buy this book on amazon.com >>