Saturday, June 29, 2013

Visual Studio Unit testing: URI formats are not supported

Last week I tried to execute some Unit Test in a C# Test project on Visual Studio 2010 (in relation to the daily BizTalk development work that I do).  Both options “Run Selection” and “Debug Selection” gave me the following error message "URI formats are not supported".

What was the problem?  I created the solution just in the default directory because I only needed that solution to test some regex output.   Was unaware that I was working on a network share.

How can you solve the problem? 
Normally when you add a new "Test Project" to your solution it adds the following files to a solution items folder. 






Just check the “Enable Deployment” property in the “Local.testsettings” and “TraceAndTestImpact.testsettings” under the deployment category, like the example below.

Problem solved, unit tests running fine!
Author: Sven Van den brande

Saturday, June 22, 2013

Basic scheduling on IBM Datapower

Performing scheduled actions is not the primary architectural purpose of the Datapower SOA Appliances, but sometimes it might come in handy to be able to perform a certain ‘batch’ task on a scheduled timing.

As an example we take the situation at one of our customers, where a Datapower box is used as a proxy to add a security layer to the calls going to an external party.

Part of this security layer is the addition of a secure code, that must be retrieved with a call to a security server. This code stays typically the same for a long time and is the same for all calls going through the proxy.

To avoid making a call to the security server for each call that goes through the proxy, a scheduler was created that picks up the secure code every 60 seconds and stores the code in a global Datapower variable. The normal proxy calls simply use the value of this global variable to get the secure code.

- First thing we need for a scheduler is the action that will be executed. This action is defined in a processing rule with all the necessary processing actions in it.

- The scheduling itself should be done through an xml manager. On the page of your xml manager, go to the tab ‘Scheduled Processing Policy Rule’ and simply add a new rule with your selected processing rule and the interval in seconds.

As you see, it’s a very easy but limited (only fixed seconds intervals) feature on the Datapower appliance. In a few minutes you can create a simple scheduler, which is often just what you need.

When you need a more advanced scheduling process, you should consider using cron on unix or the task scheduler on windows and send a request to the service on Datapower that you want to schedule.

Author: Tim

Wednesday, June 12, 2013

BizTalk Health Email Alerting Part 1: Active Messages

In this multipart serie of blogposts, I will try to give some examples to keep an eye on the monitoring of BizTalk, without having the need to log on to the environment. Emails will be sent to specific users about certain information.

This first part will be about notifying users of existing active messages. These are  messages which are active for a certain duration in the environment, while they should be already processed within this timeframe. Beware, when you have some long running process in your BizTalk environment, these need to be excluded in the WMI call that is being constructed later in this article.

These small scripts consist a little vbscript, using wmi classes and can be hosted in a scheduled task on the BizTalk server(s) for example. I will walk through the vbscript that we set up to perform this task:

First start is defining a number of variables. A timeout of the script itself and some elements that we’ll be using in the script. Some variables are already assigned a value. The “TimeInterval” is the time in minutes that an instance in BizTalk should be active when this informational email is being sent. The email addresses are the ‘To’ and ‘Cc’ addresses to which the emails should be sent.

Option Explicit

Wscript.TimeOut = 30

Dim TimeInterval,strEmailAdresses,strEmailAdressesCC,objWMI,objDatetime,objShell,svcInsts,svcInst,strDescription,strCommand

TimeInterval       = 30
strEmailAdresses   = "BizTalkAdministrators@yourcompany.com"
strEmailAdressesCC = ""


The following step is the initialization of the WMI classes to execute queries on the BizTalk environment. The WMI is initialized with the connectionstring to the BizTalk environment and the full CIM datetime (currect datetime) is calculated. The timeinterval (in this case 30 minutes) is deducted from the current timestamp, to get all instances which are older than 30 minutes.

Set objWMI = GetObject("winmgmts:\root\MicrosoftBizTalkServer")
Set objDatetime = CreateObject("WbemScripting.SWbemDateTime")
Set objShell = CreateObject("WScript.Shell")

objDatetime.SetVarDate DateAdd("n", -TimeInterval, Now)

Next, the query is set up and being executed. IMPORTANT! All service instances with service type id “BB3A1470-F5C4-47C3-B71F-EAABC260FBD0” are being excluded. These are CacheRefresh instances and are instances internally used in the BizTalk core.

Set svcInsts = objWMI.ExecQuery("SELECT * FROM MSBTS_ServiceInstance WHERE ServiceStatus = 2 AND ServiceTypeId <> '{BB3A1470-F5C4-47C3-B71F-EAABC260FBD0}' AND ActivationTime < '" & objDatetime.Value & "'")
When the results are loaded into svcInsts, the script will loop over every instance found and construct a description which will later be sent through email. Finally, when the full description is constructed, the ‘SendEmail function is called.

If svcInsts.Count <> 0 Then

 strDescription = "There are " & svcInsts.Count & " instance(s) active for more than " & TimeInterval & " minutes." & vbCrLf & vbCrLf

 For Each svcInst In svcInsts
   strDescription = strDescription & svcInst.ServiceName & "   " & svcInst.InstanceID & vbCrLf
 Next

 SendEmail(strDescription)

End If

Wscript.Quit


The function ‘SendEmail’ has the simple task to construct a full message which can be sent to the smtp server. The environment of the process executing the script (objEnv) is being loaded and an object is created to store the message (objMessage). As an extra, the mail is given priority “high”. The SMTP server is being read from the previously loaded environment (objEnv).


Function SendEmail (strDescription)

Dim objEnv,objMessage

Set objEnv = objShell.Environment("Process")
Set objMessage = CreateObject("CDO.Message")

objMessage.From = "thesender@yourcompany.com"
objMessage.To = strEmailAdresses
objMessage.CC = strEmailAdressesCC
objMessage.Subject = "Active Instances take too long to complete"
objMessage.Textbody = vbCrLf & strDescription & vbCrLf & "Please check the environment." & vbCrLf & vbCrLf

objMessage.Fields("urn:schemas:mailheader:Importance") = "High"
objMessage.Fields.Update

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 2
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = objEnv("BTS_SMTP_HOST")
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update

objMessage.Send

End Function

Wscript.Quit


This way of working can also be used for other elements to monitor BizTalk. In the next post, I’ll be talking about the same type of script to process and terminate automatically dehydrated instances.

Thanks for reading, if you have any remarks or questions, please leave them in the comments section!

Author: Andrew De Bruyne

Thursday, May 23, 2013

Messaging Battle

Thursday May 16, half of the i8c team gathered for the "Messaging Battle". In our daily life, we typically work with Integration solutions (ESB's) and Message Oriented Middleware (MOM) from the same vendor.

But as integration specialists we also encounter situations where we need to communicate with a MOM product from another vendor. ESB's come with adapters to interconnect with other queuing solutions: JMS adapter, WebSphereMQ adapter etc.

Four teams of 5 people (half of the 40 i8c consultants) went for the challenge to combine 5 ESB's from different vendors with 5 messaging solutions (queuing products).


The following ESB's were used
in combination with the following messaging solutions:
Note: for JBoss, the JEE application server was used with message driven beans, without any specific integration framework.

Team 1

 

Team 2

Team 3

Team 4



Of course there were the typical issues: network connectivity with a DHCP server sometimes refusing to cooperate, an undersized Virtual Machine for the brand new but rather heavy SAP PI server etc. Also some interesting learning points while configuring JMS e.g. with different JNDI providers.

Team 1 were declared winners: regardless of their technical challenges, they were the quickest to have messages flying around the whole chain of 5 ESB's and 5 queuing products. Interesting to see how connections was established from Apache Camel to Azure Messaging and from Microsoft BizTalk to a JMS server using the JNBridge JMS adapter for BizTalk.

An afternoon of technical challenges but also fun.  Learning about other ESB's while looking over the shoulders of colleagues.

Author: Guy

Friday, May 3, 2013

Aspect oriented programming in TIBCO ActiveMatrix BusinessWorks

TIBCO ActiveMatrix BusinessWorks ActiveAspects Plug-in extends TIBCO ActiveMatrix BusinessWorks by adding an Aspect Oriented Programming capability. This allows you to enhance your BW processes at deploy time while keeping the original BW process intact.

The plug-in works by providing the developer a JAVA API that can be used to develop and build a custom java application, packaged in a jar file. This jar file can alter the execution of any TIBCO ActiveMatrix BusinessWorks application. Naturally, if used correctly.

Before you can start, you should at least understand what process aspect oriented programming is. The following screenshot, from the TIBCO Documentation, provides a very good explanation.

A Process-Oriented Aspect (POA) alters the execution of a process by injecting Advices, which are user defined code, at specific points of the process called Join Points. The selection of the Join Points is made based on the expressions called Point Cuts.

An Aspect is the collection of Point Cuts and Advices. Aspects implement features that cut across different layers of a BW application (that is, across different BW processes). One of the key  characteristics of the POA style programming is that these features can be developed, packaged and deployed independent of TIBCO ActiveMatrix BusinessWorks applications.


Let’s take an example to see how it works. The following business process subscribes on an event, does some transformation and writes it to disk.


You can now use the plug-in to change dynamically the destination file location. In real life, you could execute an external business rule to determine dynamically the file location. 

Creating the advice implementation.
After creation of a java project in eclipse (or any other IDE you prefer), you need to add the jar files that are located in the directory $TIBCO_HOME\bw\plugins\lib\palettes (bwaa-palette.jar, bwconfig-api.jar, bwconfig-impl.jar, gxml.jar, gxmlBridges.jar, gxmlProcessors.jar, poa-api.jar, poa-bwaa.jar, poa-core.jar). You can also add the poa-bwaa-samplesImpl.jar from the examples since it contains a useful GxmlUtil class (also used in all the examples given by Tibco).

The first thing to decide is whether you need an asynchronous advice implementation or not.  An asynchronous advice implementation does not execute its business logic on the engine job thread. During this time, the engine can execute other advice pipelines or activities if any of them exist in the same process instance on a parallel track. A synchronous advice implementation does not allow this and ‘blocks’ the execution in the job thread.



The above sample is based on the examples and Java API provided by Tibco.

Once you’ve written the java class, you’ll have to package it into a jar file. Best location to save this jar file would be $TIBCO_HOME\bw\plugins\bwaa\lib because this location will be, by default, included on the classpath of a businessworks engine (bwengine). However if you want to run the aspect in your designer, you’ll need to adjust the tibco.env.CUSTOM_CP_EXT in the designer.tra. You can look in the bwengine.tra for the variable BW_AA_HOME to see how it should be set.

When the advice implementation is made, you’ll have to create an aspect xml file. The aspect file will define your point cuts and which advice implementation should be executed when the point cut is reached. The plug-in defines a query language used for writing point cut expression. The query language defines four basic primitives that can be used (and combined) to narrow down your point cut:
  • Activity
  • Process
  • Project
  • Engine
This aspect xml file should be packaged as a jar file (although it’s not a java implementation) and should be put in the location $TIBCO_HOME\bw\plugins\bwaa\aspects. This is the default location as configured in the bwengine.tra. For testing in the designer, you'll need to use a custom property file and add the following to it:

java.property.aspectPath %BW_AA_HOME%/aspects
ServiceAgent.poa.serviceagent.Class=com.tibco.bw5.poa.core.runtime.DefaultBw5AspectServiceAgentImpl
Jmx.Enabled=true




The tibco designer project can be downloaded here.
The aspect implementation can be downloaded here.
The aspect configuration xml can be downloaded here.

Author: Günther



Tuesday, March 19, 2013

Hiding the secondary menu on a single page in Drupal

If you want to hide the secondary menu on a single page in Drupal, this doesn't seem to be possible through the Administration web interface. You can disable all Secondary menus on your website, through the Appearance settings of your team (Appearance -> Settings -> name of your theme), but this is not what we are trying to achieve here.

You can disable the secondary menu on a single page however, by adding a few lines of code to your CSS files. Before you start editing your CSS files, you need to uniquely identify the page on which you want to hide the secondary menu. Drupal by default generates a unique ID for each page as a class ID of the body element in the format "page-<NAME>". You can lookup this value by using the Developer Tools of your browser and checking the class attribute of the body HTML element.



Then add the following lines of code to your CSS file:

.page-<NAME> #submenu{
 display:none;
}

The secondary menu section on a Drupal page is identified with the "submenu" id. The display:none property hides an element, and it will not take up any space. So this code snippet in your CSS file will avoid that the submenu is displayed on the page identified by string value after the "." class selector.

Author: Kristof Lievens

Tuesday, March 12, 2013

Central Administration of TIBCO Enterprise Message Service (EMS)

In the summer of 2012, Tibco launched a new version of its messaging bus called Enterprise Message Service (EMS). TIBCO Enterprise Message Service lets applications consume or publish messages according to the Java Message Service (JMS) API.

One of the new features, is the ability to perform central administration through a standard web browser. In the past you mainly had 3 options to ‘control’ your EMS server:
  • The command line utility tibemsadmin
  • The EMS plugin of Tibco Administrator
  • A tool, like Gems or Hermes, created by a third-party

The Central Administration feature, installed automatically with EMS 7.0, offers you:
  • A web-based graphical user interface for configuring TIBCO EMS servers
  • Centralized configuration, allowing administrators to apply configuration changes across multiple TIBCO Enterprise Message Service servers from a single location
  • Support on Windows, Linux, and Mac platforms

How to get the central administration running on your machine.

After the installation of version 7 of Tibco Enterprise Message Service you need to convert the ’old style’ tibemsd.conf to a JSON (JavaScript Object Notation) file. The text-based tibemsd.conf file is not compliant with the Central Configuration feature and EMS servers started with a tibemsd.conf file cannot be managed using the Central Administration server.

Command: tibemsconf2json.bat -conf source-file.conf -json output-file.json


Note: when ems is configured as windows service, you need to tweak the registry key to change the startup parameter tibemsd.conf to tibemsd.json (HKEY_LOCAL_MACHINE\SYSTEM\ControlSet00X\services\tibemsd\Parameters)

Once converted, you can start your EMS server but now using the json configuration file.

Creating a configuration file

Although not mandatory, you can configure the server using a properties file to hold Central Administration server options.  Example:
com.tibco.emsca.data.dir=c:/tibcoems7/tibco/cfgmgmt/emsca_data
com.tibco.emsca.http.hostport=*:8080

I’ve saved mine as emsca.properties in the EMS_HOME/bin location.

Start the central administration server with the command tibemsca.bat (or tibemsca.sh). By default the server will look for a file called emsca.properties in the current working directory.


By default, the Central Administration server does not automatically configure an SSL connection or requires users to pass login credentials. The Central Administration server uses the same username and password to log into the EMS server as was used to log in to the Central Administration web interface. But as said by default there is no login and so it uses user ‘admin’ with no password.  You’ll have to configure JAAS authentication to make it work with a password. (I’ll leave some room for a next blog post).

Default screen after installation

When typing  a name (e.g. local_ems_instance) without spaces, clicking on create, and passing a url of your EMS server (e.g.  tcp://localhost:7222) you are good to go!


Configuring your EMS server using the web portal.

Author: Günther