|
|
YOUR FEEDBACK |
TOP MICROSOFT .NET LINKS BizTalk
Constructing a JMS Adapter for Microsoft BizTalk Server
Create adapters for BizTalk/J2EE interoperability
By: Wayne Citrin
Mar. 10, 2006 03:00 PM
Digg This!
Page 1 of 3
next page »
If you need to integrate Microsoft BizTalk Server (BTS) 2004 with other applications and data sources, you're going to need some kind of adapter. BTS 2004 ships with a few, including the file adapter and the Web services adapter. Other adaptors, especially ones used to integrate BTS with popular enterprise software, are available from third-party vendors. However, if you need a JMS (Java Messaging Service) adapter, or one that supports J2EE facilities such as JNDI (Java Naming and Directory Interface), JAAS (Java Authentication and Authorization Service), and EJBs (Enterprise Java Beans), you're probably going to have to build one. This article shows you how to construct a custom adapter that allows BTS to integrate with JMS. You can also use these techniques to construct other kinds of adapters, including ones for Java APIs that come with custom applications, or simply call Java libraries from BizTalk Server orchestrations.
Background The BTS orchestration used in this example comes from the first orchestration example in the excellent book Microsoft BizTalk Server 2004 Unleashed (Sams, 2005), by Scott Woodgate, Stephen Mohr, and Brian Loesgen. I recommend reading the example in the book and performing the actions to create the orchestration, but I'm supplying the code for those who are not inclined to do so.
Required Software
Figure 1 shows the architecture of the adapter. BizTalk Server interacts with the adapter via adapter framework code. The adapter framework code calls .NET-side proxy classes, which are proxies of the JMS classes in this example. We're using the JNBridgePro proxy generation tool to create a .NET-side proxy class that has an equivalent signature to the corresponding Java class. From there control flows through the .NET-side runtime components, across a remoting connection, and eventually to the appropriate Java-based JMS client class, which functions as an ordinary JMS client that communicates with the server via RMI or other chosen protocol. Figure 2 shows how JNBridgePro supports calls from .NET to Java. For each Java class, the JNBridgePro proxy generation tool generates a .NET-side proxy class with an equivalent signature. The proxies are then used in the resultant application, where the .NET code calls a Java class by calling the equivalent proxy class. The proxy class directs the call through the JNBridgePro .NET-side runtime component, which performs marshalling and serialization. The serialized request is then sent across a remoting connection, where it is received by the Java-side runtime component, which unmarshals and deserializes the request and dispatches it to the proper object. Return values and thrown exceptions come back in the opposite direction by the same pathway. The .NET-side code runs inside a .NET CLR (Common Language Runtime), and the Java-side code runs inside a JVM (Java Virtual Machine). Our adapter architecture example has the .NET and Java sides operating inside the same process and communicating via a shared-memory channel. The remoting infrastructure used in JNBridgePro also supports other communication channels, including TCP/binary and HTTP/SOAP. Therefore, it is equally possible to set up the adapter so that the .NET and Java sides operate in different processes or on different machines and communicate through a socket-based mechanism.
Example Orchestration As described in Woodgate's book, the orchestration is set up so that the employee records are files, and the orchestration's send and receive ports that connect it to the other applications are really folders. Once we get the JMS adapter built and installed, we will connect the orchestration to an instance of the adapter at each of the send and receive ports. Each instance of the adapter will connect to a message queue on a particular JMS server (see Figure 4).
Building and Deploying the Adapter from the Sample Code To deploy the adapter, first edit the file jmsAdapter.reg. In particular, edit the lines for OutboundAssemblyPath, InboundAssemblyPath, and AdapterMgmtAssemblyPath so that these paths are valid for your machine. Then, launch jmsAdapter.reg by double-clicking on the icon. This will install the relevant entries in the registry. Then launch the BizTalk Server Administration tool, navigate to the Adapters folder, right-click on it, and select New Adapter. Name the adapter JMS and select JMS from the pulldown. Next, edit the file jnbproxy.config that can be found in the jmsAdapter folder. This file configures the communications mechanism that governs the bridging between the .NET and Java sides of the adapter. We will be using the shared-memory mechanism. Edit the paths for the jvm, jnbcore, bcel, and classpath items so that they are valid for your machine. (If you are using JNBridgePro v3.0 with BizTalk Server 2004, edit the "Version" attribute of the shared-memory channel to read "2.3.0.0" - it is originally "2.2.0.0"; if you are using BizTalk Server 2006 and .NET Framework 2.0, set the "Version" attribute to "3.0.0.0.") Save jnbproxy.config and copy it to the root folder of the drive on which your system is installed (typically, but not always, C:\). Finish deploying the adapter by installing the files jmsProxies.dll (from the jmsAdapter folder), jnbshare.dll, and jnbsharedmem.dll (both from the JNBridgePro installation folder) in the Global Assembly Cache (GAC). The simplest way to do this is to copy them into the C:\Windows\Assembly folder, although you can also do this using the gacutil.exe program that comes with the .NET SDK.
The Proxy Classes To create the JMS proxy classes, launch the GUI-based JNBridgePro proxy generation tool. Add C:\bea\weblogic81\server\lib\wljmsclient.jar (the actual path may be different on your machine. Generate load the proxies for the following classes and all supporting classes:
Page 1 of 3 next page » MICROSOFT .NET LATEST STORIES
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
|
SYS-CON FEATURED WHITEPAPERS MOST READ THIS WEEK BREAKING NEWS FROM THE WIRES
|
||||||||||||||||||||||||||||||