In my last entry, I discussed some ways that can making working with binding files a bit easier. Here is another post in that same vein that addresses a common pain point...
Un-escaping TransportTypeData
One of the annoying things about binding files is that adapters only have a string element available to store adapter-specific information for send ports and receive locations. As a result, adapters will store escaped XML (or even "doubly escaped" xml...) This can be extremely hard to manage, especially for adapters such as MQSeries that keep quite a bit of information in this form.
To solve this problem, I introduced a new command-line tool in the most recent version of the Deployment Framework called "ElementTunnel.exe" (the source for which is in the Tools download.) This utility will take in an xml file, along with a file containing xpaths to elements that should be "encoded" or "decoded". The end result is that you can choose to manage a "master" binding file (not directly useable) and run ElementTunnel on it immediately prior to deployment. (You may also run XmlPreProcess on the same file for macro expansion! The sample in the deployment framework shows both occurring - XmlPreProcess should occur first!)
So what does this mean? An example for a single Send Port snippet: It means that, in the case of MQSeries, instead of storing and maintaining this mess:
You can store and maintain this:
Ahhh, isn't that better? Of course, similar goodness for all other adapters. And, in the clean version, you'll find it easier to place/maintain XmlPreProcess macros.
In the Deployment Framework sample, you'll see that we pass the following xpaths to ElementTunnel (along with the "master" binding file itself):
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ ReceiveLocationTransportTypeData/CustomProps/AdapterConfig /BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ ReceiveLocationTransportTypeData /BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/AdapterConfig /BindingInfo/SendPortCollection/SendPort/*/TransportTypeData
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ ReceiveLocationTransportTypeData /BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ ReceiveLocationTransportTypeData/CustomProps/AdapterConfig /BindingInfo/SendPortCollection/SendPort/*/TransportTypeData /BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/AdapterConfig
Scott Colestock lives, writes, and works as an independent consultant in the Twin Cities (Minneapolis, Minnesota) area.