An Internal Failure occurs for unknown reason

It was amazing to get this issue. Today morning I opened my BizTalk admin console and got this issue. I don’t know what was happened. Yesterday It was working fine and perfectly.

An Internal Failure occurs for unknown reason (WinMgmt)

Window Error.jpg

I have got some weird reason for this. My machine has run window updates and due to these new updated patches up I am getting this issue.

Root cause: July, 2018 Microsoft Security Updates cause errors on the BizTalk Administration Console: An internal failure occurred for unknown reasons (WinMgmt)

After applying this month’s security patches, we get the above errors in the BizTalk Admin Console when either refreshing the Group Overview or trying to view any of the Platform Settings on BizTalk Servers.

 

Solution: till now no solution is yet to figure out from Microsoft. You need to just uninstall the window updates of last day. Then restart the system and it starts working. Bingo😊

Location: We need to uninstall this update via Start->Control Panel-> Program and features-> View Install Updates

Location.jpg

Below is list of Windows updates you may need to uninstall. Few of them available and sometimes few are not available on your machine.

  • BizTalk Server 2016: KB4338605, KB4338613, KB4338424, and KB4338419
  • BizTalk Server 2013 R2: KB4338600 and/or KB4338601
  • BizTalk Server 2010: KB4338602
  • Others: This includes KB4338600, KB4338605, KB4338613, KB4338814, KB4338424, KB4338419

 

Microsoft has re issued the patches that caused above issues. Please find the details in the below link.

https://blogs.msdn.microsoft.com/dotnet/2018/07/30/net-framework-july-2018-update/

Advertisements

Calling a .net component from BizTalk orchestration

This blog is to explain how to call C# components from BizTalk. I am going to explain this scenario by taking simple example like Addition of two number in C# component and call the C# method from BizTalk Orchestration.

First, we need to create a C# class library by following below steps.

  1. Start–>VisualStudio–>Click on Visual Solution–>File–>New–>Project
  2. Select class library project from the template “Visual C#” like below.

1.png

3. Change the project name “ClassLibrary1” to “SumofTwoNumbers” and then click OK.

4. Change the class name from “Class1.cs” to “Sum.cs”.

5.Add below code in .cs file

2.png

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace SumofTwoNumbers

{

   [Serializable]

   public class Sum

    {

        public Int32 Addition (Int32 Num1, Int32 Num2)

        {

            Int32 Add;

            Add = Num1 + Num2;

            return Add;       

        }

    }

}

This C# component takes two input parameter and return the sum of the two parameters. These two input parameters need to be passed from BizTalk orchestration for our scenario.

Note: Make sure class should be ‘Serializable’, because when calling instances of class, not marked as Serializable from an orchestration, it must be from an atomic scope. 

6. Provide strong name key for the project and Build it.

7. Once you build the project, one dll gets created in project directory, you need to GAC the dll by using GACUtils tool.

8. Now C# dll is ready to use from BizTalk orchestration.

Follow below steps to create BizTalk application and call above C# method.

9. Create a BizTalk project and add above C# library as reference to the project.

4.png

10. Open BizTalk orchestration–>Goto Orchestration view–>Create a new variable name “SumOfTwoNumbersMethod”–>Open Properties of the variable–>Type–>Select <.Net Class..>–>Select project name–>Select Classname from the References.

11. Now we have a BizTalk variable ready which points to the C# class.

12. Now we can use this variable in BizTalk expression shape to pass the input parameters to the method.

3.png

//SumOfTwoNumbersMethod—This is the variable which we created above, to point to the C# class.

//Addition—This is the C# method where we have our actual logic.

//InputMsg.Val1—This is the first input parameter to the C# method.

//InputMsg.Val2—This is the second input parameter to the C# method.

//SumOutput – This is the int data type variable which stores the output of the method.

13. Now we have method output stored in the variable “SumOutput”, we can use this variable according to our requirement in the orchestration.

BizTalk Property Promotion

Property Promotion:

Property Promotion in BizTalk is usually about taking values from incoming message and moving them into the context of the message, so they are easily accessible and usable for routing. The context of message is a set of metadata about a message that resides in the message box with the message, allowing different part of BizTalk to read in a small set of metadata instead of the entire message, in case a value from a message needed at run time.

Below are three options for Property Promotion:

  • Distinguished Field
  • Property Schema
  • XPath

Note: Only those fields can be promoted as distinguished field or Property schema which occur only once in the message.

Following error will happen when promoting a value that can occur multiple times

Error.jpg

Distinguished Fields Property Schema
These field are excellent and fast way to both accessing and writing values to and from in Orchestration Only Promoted Property can have used for message routing, correlations and can be used in orchestrations
These fields are restricted to contains values that comes from some element (that can occur only once) It can contain data that is purely metadata about the message
Do not participate in routing
IsPromoted = false
Only promoted property can be used for tracking purposes with the build-in tracking functionality
Do not have a size limitation They are restricted to 256 characters
Do not require the creation of a corresponding property schema Create a separately maintained property schema
They are not persisted to the Message Box database. Instead, they are essentially XPath aliases, which simply point to the appropriate XML data field. Promoted properties are persisted to the Message box database. The Message box generate a large join in SQL Server each time a message is published, which is basically a join between the Context of Message, the possible properties, and the properties of all subscribers. So the no. of Promoted Properties should be keep minimum
Use in Orchestration as below:

MessageName.RecordName.FieldName

Use in Orchestration as below:

MessageName(
PropertySchemaName.PromotedPropertyName)

Distinguished field through the BizTalk API:

pInMsg.Context.Write(“theDistinguishedProperty”,
“http://schemas.microsoft.com/BizTalk/2003/btsDistinguishedFields”,
“theDistinguishedValue”);

Promote properties through the BizTalk API:

message.Context.Promote(“MessageType”, “http://schemas.microsoft.com/BizTalk/2003/system-properties”, messageType);

XPath:

XPath is much slower than Promoted Property and Distinguished Field. XPath function requires the Orchestration Engine to load the entire message into the memory to evaluate the XPath expression.

XPath should only use for getting and setting value of element that are recurring where Promoted Property and Distinguished field can not helpful.

 

 

BizTalk Sequential Convoy

This blog is to explain about BizTalk Sequential Convoy.

What is Sequential Convoy?

Sequential Convoy is one type of BizTalk design pattern to achieve particular type of requirements. This can be defined as “A sequential convoy enables multiple single messages to join together to achieve a required result. A sequential convoy is a set of related messages that have a predefined order. Although the messages do not have to be exactly the same, BizTalk Server must receive them in a sequential order.”

Sequential Convoy also called as singleton pattern convoy.

Sample Scenario for Sequential Convoy:

My Orchestration has to receive the messages from source location and create a batch for first three messages and send to destination system.

In order to achieve this requirement, we need to make our orchestration as singleton, that means my orchestration has to receive all 3 messages using single instance (By default, Orchestration creates dedicated instance for each message)

Once my orchestration receives 3 messages, instance will be completed and new instance will be created for next 3 messages. Likewise, my orchestration has to run for ever.

Note: In order to correlate all 3 messages, we need to have common element in all messages (Example: CustomerId/OrderId..)

In real time, usually this type of scenario comes for internet banking transactions or retail orders process.

Sample Input message:

This message has to be dropped 3 times in receive location with different data.

<ns0:Billing xmlns:ns0=”http://BTSamples1.BillingAddress”&gt;

<CustId>123</CustId>

<Address1>ABC Apt</Address1>

<Address2>XXX</Address2>

<ZipCode>XXXX</ZipCode>

</ns0:Billing>

Sample Output message:

This message is a batch of 3 input messages.

<BillingDetails>

<ns0:Billing xmlns:ns0=”http://BTSamples1.BillingAddress”&gt;

<CustId>123</CustId>

<Address1>ABC Apt</Address1>

<Address2>XXX</Address2>

<ZipCode>XXXX</ZipCode>

</ns0:Billing>

<ns0:Billing xmlns:ns0=”http://BTSamples1.BillingAddress”&gt;

<CustId>123</CustId>

<Address1>BAC Apt</Address1>

<Address2>XXX</Address2>

<ZipCode>XXXX</ZipCode>

</ns0:Billing>

<ns0:Billing xmlns:ns0=”http://BTSamples1.BillingAddress”&gt;

<CustId>123</CustId>

<Address1>CDE Apt</Address1>

<Address2>XXX</Address2>

</ns0:Billing>

</BillingDetails>

Note: In all messages we need to have a common element “CustId”.

Implementation:

1. Need to create a schema for incoming message and promote the common element as property promotion. Also create correlation type and correlation set on CustId.

1.png

2. Design the orchestration like below.

2.png

“Receive_1” shape receives very first message and initialize the correlation set.

“Receive_2 shape follow the correlation and receives remaining messages using the same instance created while receiving first message.

“Loop_2” shape make sure the orchestrations run for ever.

“Loop_1” shape make sure to receive maximum 3 messages for each instance and batch it.

Once max messages (3) are received, “Loop_1” will break and batched message will be sent to Destination system using “Send_1” shape.

3. Create below orchestration variables.

//Count is a variable of type “System.Int32

//Continue is a variable of type “System.Boolean”

//XmlDocVar is a variable of type “System.Xml.XmlDocument”

//StrFinal is a variable of type “System.String”

//BillingStrVar is a variable of type “System.String”

4. Create below Orchestration Messages

//XmlDocMsg is a message of type “System.Xml.XmlDocument

//BillingAddress is a message of type BillingAddress Schema

5. Keep below code in all orchestration shapes.

  • Receive_1

3.png

  • Expression_1

4.png

  • Loop_2

5.png

  • Loop_1

6.png

  • Receive_2: 

 7.png 

  • Expression_2

8.png

  • Expression_3

9.png

  • ConstructMessage_1

10.png

  • Send_1

11.png

  • Expression_3

12.png

6. Build and deploy the application

7. Configure the ports and start the application

8. Unit Testing: Drop couple of sample message copies in input folder with same customer id then for every 3 messages one batch file will be batched and dropped in a destination system. For example, if you drop 6 input messages, you will see 2 output messages in destination folder.

 

 

BizTalk Parallel Convoy

This blog is to explain about BizTalk Parallel Convoy.

What is Parallel Convoy?

Parallel Convoy is one type of BizTalk design pattern to achieve particular type of requirements. This can be defined as “A parallel convoy enables multiple single messages to join together to achieve a required result. The set of related messages can arrive in any order, but BizTalk Server must receive all of them before starting the process”

Sample Scenario for Parallel Convoy:

My Orchestration has to produce a customer address which is having Billing and Shipping details.

My Orchestration has to receive the Billing address details from Source A and Shipping Address details from Source B. Once both messages are received, then only my orchestration has to proceed further to produce full customer address. If any one of the addresses are not received, my orchestration has to wait till other message received.

This scenario can be achieved through parallel convoy design pattern in BizTalk.

  1. We need to create 3 schemas, Correlation type and correlation set.
  • Schema1 is for Billing Address

1.png

  • Schemas 2 is for Shipping Address

2.png

  • Schema 3 is for Full Customer Address

3.png

 

2. Insert “ParallelActions” shape into the BizTalk orchestration editor.

3. Drag and drop two receive shapes inside the parallel convoy shape like below

4.png

4. Create a message for Billing Address and assign to the shape “Receive_1”

5. Create a message for Shipping Address and assign to the shape “Receive_2”

6. Set “Initializing Correlation Sets” property for both receive shapes with the correlation set created in above steps.

Please note that both receive shapes are having “Initializing Correlation Sets”.

If Receive_1 shape receives the message first, then other receive shape will act as follow correlation on CustId.

If Receive_2 shape receives the message first, then other receive shape will act as follow correlation on CustId.

Once both messages are received then only It will proceed further to apply a map to produce full customer address.

7. Create a map to produce full customer address

Input messages: Billing and Shipping Addresses

5.png

Output Messages: Customer Address

6.png

 

Click on “OK”

7.png

8. Send the final message (Full Customer Address) to the destination system based on your requirement.

Here is the sample Orchestration view for Parallel Convoy demo.

8.png

We will talk about sequential convoy in upcoming blogs.

 

 

 

 

 

 

 

BizTalk Correlations

This blog is to explain about BizTalk Correlations.

What is Correlation?

Correlations can be defined as binding incoming messages with the appropriate instance of an orchestration.

Sample Scenario for Correlations:

My Orchestration has to send a request message to a Message Queue, let’s say it is “Input Queue”. Some other process takes the input message from “Input Queue” and after processing, output will be sent to another Queue, let’s say it is “Output Queue”.

Now Orchestration has to receive the message from Output Queue.

Also, my orchestration has to make sure that, it is consuming the output message of the of the correct instance.

How to Implement Correlations:

If we need to implement correlations, both input and output messages should have a common field element. For Example

Input Message:

1.png

Output Message:

2.png

Also, common element (CustId) should be property promoted.

Go to Orchestration View–>Types–>right click on Correlation Types–>Select New Correlation Type–>Correlation Properties windows appears with two panels.

Left Side Panel is “Available Properties” and the right-side panel is “Properties to correlate on:”

We need to select our property promoted field from left side panel and click on “ADD”, then field will be added to right-side panel. Using this common field, we will correlate request and response messages in the orchestration.

3.png

So far, we have created a Correlation Type.

Now we need to create a Correlation Set, which will be used in Orchestration Receive and Send shape properties.

Go to Orchestration View–>right click on Correlation Sets–>Select New Correlation Set->One Correlation set will be created.

Correlation Set properties–>you need to select correlation type which we have created above.

4.png

Now we are ready with correlation Sets.

Orchestration Properties:

In orchestration, if we want to send the message out, it will be through send shape. In send shape properties, we need to provide the “Initializing Correlation Set” property and select the correlation set which you have created in above steps.

5.png

Similarly, we need to provide “Follow Correlation Set” property in Receive shape which will be used to receive the response message. “Activate” property should be false in this second receive shape of the orchestration.

6.png

When you initialize the correlation set, one subscription id will be created for your instance in the message box and when you follow the same correlation set, using the subscription id, correct message will be received for that instance. This mechanism will be taken care by the BizTalk engine internally.

Here is the sample Orchestration view for Correlations demo.

7.png

Using these correlations, we will design Convoys (Sequential & Parallel) in upcoming blogs.

 

 

 

 

 

 

 

XSL, XSLT AND BizTalk Map – First Look

  • What is XSL and XSLT?
    • There is no difference between XSL and XSLT both are same and these also called XSL stylesheets. I can say these are synonyms.
    • It is a one type of Language in computer world which contains different Types of Languages. And this type of language is also called stylesheet language or functional language.
    • Like any language has its own syntax, instructions and rules for writing code\script, XSL also have its own instructions and rules.
    • XSL Format and syntax looks like same as html\xml formats.
    • You can open\create\write\edit XSL file in Notepad, notepad++, text Pad, Visual Studio, Edit Plus, like almost in all editors.
    • These stylesheets can be identified or saved as ‘.xsl’ or ‘.xslt’ extension. Visual studio defaults to ‘.xslt’ extension and some other extensions defaults to ‘.xsl’. while running you have to check which extension is suitable to your work\application.
    • The full form of XSL is ‘extensible stylish Language’ and XSLT full form is ‘extensible stylish language transformations. It simply means this stylesheet contains transformation code. In other way it transforms XML file from one format to another format.
    • As the name showing as stylish, yes, we use XSL for styling. Styling to mainly for XML documents (files). Here styling means transforming. Stylesheet mainly used to transform one xml document (one xml file) to another xml document (another xml file).
    • Generally, the input to this style sheet is called ‘source’ xml and out of this stylesheet is ‘target’ xml.
    • To run XSL\XSLT, it requires some run time. And these stylesheets you can call from almost from all the programming and scripting languages. That’s reason XSL is powerful in transformation.
  • By using XSL Stylesheets, you can
    • Assign values from one xml element to another xml element
    • Copy nodes\elements from one xml to another xml node.
    • Looping recursive xml nodes to get values of each nodes.
    • Check conditions like if condition.
    • Use Xpath\Xqury language.
    • Add constant values
    • Concatenate values
    • Inside you can call JavaScript, J#, c#, etc…
    • Etc…
  • XSLT looks like1.jpg
  • BizTalk and XSL
    • If you know little bit about BizTalk, then you must have heard about BizTalk Map, which file extension is ‘ btm’ and used to transform one message (xml) to another message (xml) in BizTalk Projects.
    • See below the Sample Btm file :-2.jpg
    • After created schemas and map, Build the Application once. After you build the application, Biztalk creates .’cs’ files in solution (physical) folder.
    • Right click on Project name -> click on ‘Open Folder in File Explorer’.3.jpg
    • You can see ‘.btm.cs’ files. This is a c# class file.4.jpg
    • Let’s see what is the inside ‘.btm.cs’ file.
    • Double click btm.cs file or open it in Visual Studio or any other editors. I opened in visual studio and I can see file as below.5.jpg
    • If you observe in the ‘.btm.cs’ file where I highlighted in the above screen that is a XSL code assigned to a ‘_strMap’ string variable in BizTalk map class file.
    • This is what I want to show you, the map whatever appearing is only GUI, back-end it is coded with c#, it’s an editor. And in run time C# class files are called and C# class file and C# class file uses XSL code for transformations.
    • And of course, it uses different functions\methods in C# to run business logic.
    • Yes, Map is a combination of C# and XSLT.

 

BizTalk Logical Ports & Port Bindings

This blog is to explain various ports and port Bindings in Orchestration.

There are two types of ports in BizTalk.

  • Logical Ports: Ports which are used in Orchestration
  • Physical Ports: Ports which are used in BizTalk admin console

Each logical port (Except Direct Binding) should have binding with a physical port in BizTalk admin console

Since this blog is related to orchestration stuff, let’s talk about logical ports.

There are two types of logical ports

Inbound Logical Ports:

These ports are used to receive the messages from message box to Orchestration. These are also called as Subscribers (Subscribing messages from Message box DB)

Outbound Logical Ports:

These ports are used to send the message from Orchestration to message box. These are also called as Publishers (Publishing messages to Message box DB)

How to Create Logical Ports:

  1. When you open the orchestration, you would see below screen

1.png

2. Right click on Port Surface–>Select “New Configured Port”

2.png

 

3. Port Configuration Wizard appears and then click on “Next”–>Provide the name of the Port (Port_AppraisalInput)–>Click Next–>Provide PortType Name as “PortType_AppraisalInput”–>Click Next

Communication Pattern:

  • One-Way—Select this option if you want to create oneway port
  • Request-Response – Select this option if you want to create two-way port.

Access Restrictions:

Choose appropriate option based on your requirement

3.png

 

4. Port Direction for Inbound:

For Inbound logical port, select “I’ll always be receiving messages on this port” option.

For Outbound logical port, select “I’ll always be sending messages on tis port” option.

4.png

Port Bindings are three types.

  • Specify now
  • Specify Later
  • Direct

Specify now: you need to provide URL, Adapter and Pipeline details in design time itself.

5.png

Specify Later: If you select this option, you need to provide the URI, Transport and Pipeline details in BizTalk Admin console.

6.png

Direct Binding: This is loosely coupled Binding type. There are three options in Direct Binding and by default first option is selected in the screen. If we use this option, messages are subscribed from message box using filter condition in Receive shape properties.

7.png

Self-Correlating: 

Self-correlating direct bound ports are self-referential. This means that a self-correlating direct bound port supplies the information that an orchestration can use to send messages back to its enclosing orchestration. Please go through the link below for more details.

https://docs.microsoft.com/en-us/biztalk/core/how-to-use-self-correlating-direct-bound-ports

Partner Orchestration:

Partner orchestration direct bound ports provide the capability of having inter-orchestration communication through ports. Please go through the link below for more details.

https://docs.microsoft.com/en-us/biztalk/core/how-to-use-partner-orchestration-direct-bound-ports

Port Direction for Outbound: For outbound port bindings, you can see additional option as “Dynamic”.

Please see the Dynamic send port details in the below link.

https://vkbiztalk.com/2018/04/19/biztalk-dynamic-send-ports-for-rest-services/

8.png