Using SQL queries in the BAM database to measure the performance and health of ESB Toolkit itineraries

Using SQL queries in the BAM database to measure the performance and health of ESB Toolkit itineraries

When you create a Web API you can use it for your own applications but maybe you also want to expose it to the outside world. In that case you probably want to change the behavior of the Web API. For example add security or hide properties. You can use BizTalk to create a virtual service in front of your Web API to modify the behavior but is that the smartest choice?  Because BizTalk writes every message that it receives a couple of times to the MessageBox database. This increases heavily the execution time and especially with Web APIs it’s important to have a really low execution time!

Another option is to use Sentinet from Nevatech to create a virtual service in front of your Web API.
The virtual service runtime in Sentinet can also be extended with custom messages processing. Sentinet provides a number of build-in message processing components but it is also possible to create custom message processing components.

Let’s have a look at the following example where an Order Web API is used inside an organization to process orders. This Web API must also be exposed to external customers to show the status of an order but if an error occurs in the Web API or in a background process, the OrderStatus property must be modified that the order is still in progress and the ErrorMessage property with the error must not be shown to the customers. Furthermore the output of the Web API must be in XML instead of JSON.

Send request with Postman to Order Web API

The following steps in Sentinet are necessary to make it work:

  • Add the REST service (or API) to the the Sentinet Repository
  • Create a Virtual Service
  • Add custom Pipeline Processing
  • Test the Virtual REST Service

Sentinet makes it really easy to modify the response of a Web API. You only have to create a Virtual Service in front of it and add custom Pipeline Processing! Especially if you are already familiar with XPATH and XSLT, the example above doesn’t take long to implement.

Download:
Sentinet version 4.5

Using RequestBin to troubleshoot SOAP/REST clients

Using RequestBin to troubleshoot SOAP/REST clients

Ihave just got through a rather difficult project that involved BizTalk calling on a mixture of SOAP/REST services, and also exposing multiple RESTFul services as well. The project had a very short time frame and we had many technical hurdles to cross. One of the toughest challenges was communicating appropriate details when we were having […]
Blog Post by: Johann

BizTalk Deployment Framework fails CreateVirtualDirectory.

BizTalk Deployment Framework fails CreateVirtualDirectory.

I just ran into one weird problem in the BTDF project where there was a need to Create Virtual Directory. This post is for myself to remember when encounter the error “Cannot create a file when that file already exists” while executingCreateVirtualDirectory in BTDF project. When looked into the Default Web Site on IIS the […]
Blog Post by: shadabanwer

Collection of Microsoft Integration Stencils for Visio 2013 updated with new stencils

Collection of Microsoft Integration Stencils for Visio 2013 updated with new stencils

I realized that I forgot to add some shapes, or I hadn’t addressed certain features/functionalities, so I decided to make an upgrade to my Microsoft Integration Stencils for Visio 2013 resource, that I published 10 days ago, adding this time 43 new shapes – in a total of 301 symbols/icons that will help you to […]
Blog Post by: Sandro Pereira

A Big Step Forward, Our Brand New Office Opening & Our Journey So Far

I’m here in Coimbatore, India for our brand new office opening. Over 5000 sq.ft capacity that can comfortably take about 60 people. Thanks to many of our friends, family and well wishers who congratulated us whole heartedly, appreciating our growth. Here is our little story, that summarizes our India operations journey so far. Our journey […]

The post A Big Step Forward, Our Brand New Office Opening & Our Journey So Far appeared first on BizTalk360 Blog.

Blog Post by: Saravana Kumar

BizTalk DevOps: Monitor your BizTalk environment using PowerShell – Manage messages being archived locally into the hard drive

BizTalk DevOps: Monitor your BizTalk environment using PowerShell – Manage messages being archived locally into the hard drive

Is very common in integration scenarios to see messages being archived locally into the hard drive – either by using a pipeline component like BizTalk Archiving – SQL and File or by simple using the default functionalities in BizTalk like filters: Create a Send Port with a filter expression equal to the name of Receive […]
Blog Post by: Sandro Pereira

BizTalk Accelerator for RosettaNet runtime feature failed to configure: Failed to add member ’user’ to NT Group IIS_WPG Error code: -2147022676

BizTalk Accelerator for RosettaNet runtime feature failed to configure: Failed to add member ’user’ to NT Group IIS_WPG Error code: -2147022676

Every time I try to configure the BizTalk Accelerator for RosettaNet in BizTalk Server 2013 or BizTalk Server 2013 R2 of course using Windows Server 2012 or Windows Server 2012 R2 I encounter this error in the configuration logfile [2015-05-14 16:37:40:0043 Error ConfigHelper] Failed to add member ’user’ to NT Group IIS_WPG Error code: -2147022676 […]
Blog Post by: Sandro Pereira

Speaking at BTUG.be – Integration Day 2015 | Mechelen, Belgium | June 4th, 2015 | “BizTalk Server Deep Dive Tips & Tricks for Developers and Admins”

Speaking at BTUG.be – Integration Day 2015 | Mechelen, Belgium | June 4th, 2015 | “BizTalk Server Deep Dive Tips & Tricks for Developers and Admins”

I’m proud and thrilled to announce that I will be for the first time in Belgium to present a session in the Integration Day 2015 on June 4th, 2015 about BizTalk Server: “BizTalk Server Deep Dive Tips & Tricks for Developers and Admins” that is being organized by the Belgian BizTalk User group (BTUG.be). The […]
Blog Post by: Sandro Pereira

/nSoftware Powershell Adapter for BizTalk Server

/nSoftware Powershell Adapter for BizTalk Server

 

In the past I have blogged about /n Software and their SFTP Adapter here and here.  Hard to believe one of those posts goes back to 2007. One thing that /nSoftware continues to do is add new adapters to their suite.  In this case it is the Powershell Adapter.

Can’t say that a Powershell Adapter previously was on my radar until a scenario was brought to me.  We have a very specialized piece of software that does “analysis” (I will leave at that for now).  This software is essentially a library that has been wrapped around an exe.  This exe will receive a series of parameters including a path to a file that it will use to perform its analysis on.

A suggestion was brought up about calling this exe using Powershell.  While I am sure we could call this from .Net the Powershell warranted some investigation.  So sure enough in a web search, /nSoftware comes up with an offering and sure enough we had it installed in all of our environments.

Since BizTalk is going to deliver the flat file used as an input to this process, I decided to check out the Powershell Adapter and allow BizTalk to orchestrate the entire process.  For the purpose of this blog post I will over-simplify the process and focus more on a POC than the original use case.

As part of the POC I am going to receive an xml file that represents our Parameter data.  We will then send this same message out through a Send Port that is bound to the /nSoftware Powershell adapter.

In order to help illustrate this POC, I have a console application that will simply receive 3 parameters and then write the contents to a file in my c:temp folder.  The reason why I am writing to a file is that when I call this exe from Powershell I don’t see the console window being displayed.  Perhaps there is a way to do that but I didn’t look for a solution for that.

namespace PowerShellPOC
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] lines = { args[0], args[1], args[2] };
            // WriteAllLines creates a file, writes a collection of strings to the file,
            // and then closes the file.
            string filename = DateTime.Now.ToString(“ddMMyyyymmhhss”) + “.txt”;
            System.IO.File.WriteAllLines(@”C:\temp\” + filename, lines);

           
        }
    }
}

 

In hindsight, I should have just built a send port subscription but here is my orchestration.

image

Using a standard FILE – receive location

image

On the Send things start to get a little more interesting. We will create a Static One-Way port and select the nSoftware.PowerShell.v4 Adapter.

image

Within our configuration we need to provide a Port Name (which can be anything) and our script.

image

If we click on the Script ellipses we can write our PowerShell script.  In this case we are able to retrieve our message that is moving through our Send Port and pass it into our executable.

image

If we only wanted some data elements we can also use $param3 = $xml.arguments.ReturnType

In this case “arguments” is our root node of our BizTalk Message and “ReturnType” is a child node in our XML Document.

When we go to process a file we will find that our text file has been created and it contains our 3 parameters; 2 that are hard coded and our BizTalk Messsage Payload.

image

Conclusion

When I think of BizTalk, I don’t necessarily think of Powershell.  But there will always be times when you need to perform some function that is a little bit off mainstream.  What I do like about this approach that there was no additional custom dev required to support the solution and we can use the actual BizTalk message in our Powershell script.

I am still exploring the capabilities of the adapter but after a dialog with the /nSoftware team I understand that remote Powershell scripts can be run and we can also use Dynamic ports and Solicit Response ports if we want to return messages from our PowerShell script to BizTalk.

For more details please check out the /nSoftware website.