Quantcast
Channel:
Viewing all 215 articles
Browse latest View live

Losing Database Insert in a BizTalk WCF-CustomBehavior when it fails

$
0
0

I have a C# trace routine, that writes data to a SQL Trace table. It’s kind of like my own Log4Net, and allows a unified trace between BizTalk, WebServices, and other types of progams.

I had the interesting task the last month of writing a WCF Custom Behavior to make JSON work in BizTalk 2010. Moving to 2013 or 2016 was simply not possible at this client in time for implementing the project.

So I had lots of Trace statements in the custom behavior. The bizarre thing was that when I call the trading partner’s webservice, and it succeeded, then I could see the rows inserted. In Debug/Attach mode I could see them as well. But if the trading partners’ webservice returned any error, all the rows inserted were being rolled-backed (rollback). And of course, the Trace results are much more needed in the event of an error; for example, I want to see the JSON that was created.

I earlier had decided to write the JSON to a disk directory. But I still prefer having it in the Trace as well. The Trace has an column of XML data type, where I can store text and blobs. (If the data is not XML, the C# trace program just puts a dummy xml <wrapper> tag around it. Normally in this column I store the request and response to and from any web service. It makes debugging very fast and easy.

I started researching about distributing transactions, and fortunately found a quick and easy fix. All I had to do was add the “Enlist=false” statement to the connection string:

   <connectionStrings> 
       <add name="Trace" connectionString="server=localhost;database=Trace;Integrated Security=true;Enlist=false" />
   </connectionStrings>

I found the answer on this page about .NET distribution transactions. At first I thought I might have to change my C# code to use “EnlistDistributedTransaction” method, but that wasn’t necessary. Just changing the connection string as shown above worked.

The post Losing Database Insert in a BizTalk WCF-CustomBehavior when it fails appeared first on MyLifeIsMyMessage.net.


BizTalk Architect (Dallas) – Talks about past projects

$
0
0

This video gives an idea of some of the projects a BizTalk Architect are involved with. Neal Walters has worked in a number of industries, including: Oil and Gas, Mortgage, Banking, Manufacturing and Reverse Logistics, Government, Healthcare, Insurance, Aviation/Airline Fueling, Student Loans and Non-Profits.

Neal started with mainframes back in 1981 with Amerada Hess Corporation in Tulsa, Oklahoma. Tulsa used to be called “the oil capital of the world.” It was actually in Tulsa where Neal taught his first BizTalk class on the 2002 version (which is horrible compared to BizTalk 2004 and onward).

Neal was an independent Microsoft Certified Trainer from 2001-2004. After his last mainframe project, which was a Y2K conversion as an IDMS database administrator, he re-tooled himself in the Microsoft platform. Back then, this meant Visual Basic; but as soon as .NET and C# came out, Neal got trained in that, and became a trainer on it as well.

He was chosen to attend the BizTalk 2004 Trainer the Trainer class in Redmond, Washington. This was an intense one week bootcamp. Microsoft was interesting in pushing BizTalk and increasing sales, so they knew they would need trainers and people in the field with knowledge on the product. After that class, he taught the BizTalk 2004 class over 15 times; it was one of his most popular classes.

As a trainer, Neal got into a variety of topics. Being independent, one has sometimes has to learn the product and then teach it. He taught VB, C#, classic ASP, and even JavaScript and PHP. A Microsoft XML course was also one of his popular classes. The funniest thing that once happened was a Java based company brought him in to teach Microsoft XML, when in fact they want to learn how to do XML in Java. It wasn’t funny at that time!

Neal decided to go back into consulting, having been a consultant since 1994 in the mainframe world. He first BizTalk project was for a E-Commerce company near Ft. Lauderdale Florida that sold watches and diamonds and other luxury goods on three of their own websites. They did an integration with Amazon that put the Florida company’s products on Amazon, and processed the orders into their existing back-end system.

His next project was in Colorado Springs for a non-profit Christian organization that allows individuals to sponsor children in countries around the world. Neal sponsored a child with that company, and has been doing it since then. He said it’s great to watch his sponsored child grow up, and knows the benefits of the program. This organization received orders from the web, then sent them through a backend Service Oriented Architecture consisting of webservices and BizTalk.

From there he actually had two separate contracts in Santa Fe, New Mexico. The first was with the State of New Mexico doing Medicaid. That involved using HIPAA messages such as the 837 for doctors, dentists, hospitals, and pharmacies. The claims were then sent on to an existing mainframe system to be adjudicated for payment. Next, he was brought in to a mortgage company that was doing an complete rewrite of their entire software system, and BizTalk was the hub of their Enterprise Application Integration, which integrated 17 disparate systems.

Next, he had a short project in Waco for an insurance company. What was interesting about this project was they wanted to have a mainframe COBOL/CICS screen make a real-time call to an external company’s web service. This was done by using Microsoft’s Host Integration Server. It used to be a separately bundled product, but now it is included in BizTalk.

From there, Neal landed another great location – San Francisco, California in the heart of the financial district. A bank wanted to integrate with a third party “wealth management system”. It turns out that many Hollywood stars and wealthy people in California hire “wealth managers”, who might do everything from hire their maid staff, find them a chauffeur, and even manage their money for them. They wanted to be able to move money between accounts using their system, without having to logon to the bank’s website. Another big feature was the ability to do wire tranfers from their system.

Then zoom across to the East coast in Boston, where Neal spent one of the good winters working with student loans again. Another non-profit was revamping their business model after changes made by the Obama adminstration. Data files came in from 100s of different colleges across the United States; and it turns out that many of those colleges have tiny IT departments that send a lot of “dirty data”. We were constantly struggling with cleaning-up the data they were sending in, mostly in CSV (Comma Separate Value) files.

Finally, Neal got his first BizTalk contract in his own home town of Dallas. A small company made a handeheld device that fuelers use to fuel airlines. The device collects the data of the fuel put on the plane for later billing purposes, and could actually shut off the pump to prevent overfueling. This was interesting because the BizTalk team there has to process large feeds from major airlines, for every flight at the airports we covered. So there was a lot of data filtering, and over a million messages being processed per day. As you know, flights change often. Then the fuel loads can change as well. The data was received using MQSeries, which was a great companion tool to use with BizTalk. Nightly summary files were also sent to dozens to fuelding companies at dozens of local airports.

Then, a second position in Dallas, Neal worked with an international company that repairs phones, tablet, laptops, PCs, and other electronic devices. The data load there was also astounding, as well as the number of customer/trading partners, many of which were insurance companies. When a person breaks a device, the Dallas office would repair it and send it back to the customer.

Neal is reachable at 214-455-8060 to discuss BizTalk consulting. You might have to leave a message, but he will get back to you (especially if you mention that you are NOT a recruiter). Neal has realized with the internet, there is no need need for the middle man. He is incorporated, works C2C (Corp-to-Corp), and has met all the liability and workers compensation requirements.

The post BizTalk Architect (Dallas) – Talks about past projects appeared first on MyLifeIsMyMessage.net.

DOS Batch or Command File to clean-up (delete/purge/archive) old BizTalk log/debug files

$
0
0

In a previous article, we discussed how to use a Powershell job to delete files over a certain age.

But what if if you want to do it using straight “pure” DOS .bat or .cmd file?  The following shows you how it’s done:

REM Cleanup all files more than 7 days old
e:
cd E:\BizTalk\App\Backup
forfiles /S /M *.* /D -7 /C "cmd /c del @path"

NOTE however, UNC Paths are not supported. You CANNOT even specify UNC name to a remote server in the PATH parameter.

REM Cleanup all files more than 14 days old
forfiles /P \\server\BizTalk\App|Backup /S /M *.* /D -14 /C "cmd /c del @path"

The “forfiles” command is documented here, and
briefly recapped below:
.

It selects and executes any command on a file or set of files.

 

  • With forfiles, you can run a command on or pass arguments to multiple files. For example, you could run the type command on all files in a tree with the .txt file name extension. Or you could execute every batch file (*.bat) on drive C, with the file name “Myinput.txt” as the first argument.
  • With forfiles, you can do any of the following:
    • Select files by an absolute date or a relative date by using the /d parameter.
    • Build an archive tree of files by using variables such as @FSIZE and @FDATE.
    • Differentiate files from directories by using the @ISDIR variable.
    • Include special characters in the command line by using the hexadecimal code for the character, in 0xHH format (for example, 0x09 for a tab).

 

The post DOS Batch or Command File to clean-up (delete/purge/archive) old BizTalk log/debug files appeared first on MyLifeIsMyMessage.net.

BizTalk Error: An xpath expression must be of the form …

$
0
0

If you get the error “An xpath expression must be of the form …” (in an expression shape of a BizTalk orchestration), here’s one possible solution.

I was using a multi-part message, so instead of msgCreateSPServiceOrderAckResp, I had had to specify msgCreateSPServiceOrderAckResp.parameters.

The compiler just shows the error “The expression that you have entered is not valid”. But when you find the small red mark, and mouse over it, you see the following:

Here is the corrected version:

 

 

 

The post BizTalk Error: An xpath expression must be of the form … appeared first on MyLifeIsMyMessage.net.

Example of Xpath Count in BizTalk (and how to check empty/missing data)

$
0
0

One way to check for missing data is to do an xpath count.

The two-step approach (put the xpath in a variable first). Some might find this code cleaner, but you use a variable. Note that you have to use the conversion statement to convert the string result of the xpath to a number, if you need to test that number as I do in the following “if” statement.

 

strCountMessageKeysXPath = "count(//*[local-name()='MessageKey']";

intCountMessageKeys =
System.Convert.ToInt32(
xpath(msgCreateSPServiceOrderAckResp.parameters,strCountMessageKeysXPath)
);

// Yes you can put if statement in expression shapes (but not message assignment shapes) 
if (intCountMessageKeys &gt;= 2) 
{
   strXPath = "//*[local-name()='MessageKey'][2]"; 
   strWebRespMessage2Key = xpath(msgCreateSPServiceOrderAckResp.parameters,"string(" + strXPath + ")"); 
}

 

The one-step approach:

 

strCountMessageKeysXPath = ;

intCountMessageKeys =
System.Convert.ToInt32(
xpath(msgCreateSPServiceOrderAckResp.parameters,"count(//*[local-name()='MessageKey']")
);
// Yes you can put if statement in expression shapes (but not message assignment shapes) 
if (intCountMessageKeys &gt;= 2) 
{
   strXPath = "//*[local-name()='MessageKey'][2]"; 
   strWebRespMessage2Key = xpath(msgCreateSPServiceOrderAckResp.parameters,"string(" + strXPath + ")"); 
}

 

 

NOTE: The reason I have .parameters after the message is that it is a multi-part message.
If you don’t get that correct, you may get the error “The expression you have entered is not valid”, or “An xpath expression must be of the form” if you hover over the error.

 

The post Example of Xpath Count in BizTalk (and how to check empty/missing data) appeared first on MyLifeIsMyMessage.net.

Ideas for How to Diagram BizTalk Process Flows

$
0
0

It’s long been said that a picture is worth a thousand words.  I think it’s necessary to have a few diagrams to show the BizTalk flow of any application. I’m not happy with UML, because they don’t show the many aspects of BizTalk.  I’ve walked into companies before that had no diagram, and the first thing I did was to create one.  In the process, I learned the flow of the system, and I document it for myself and others.  I often pin such diagrams to my cubicle or tape them to my office wall, and refer to them frequently.  They are constantly used in meetings to explain steps and processes to managers, users/customers, and/or other developers.

Ideally, the diagram should include:
1) Some key filenames (or at least partial filenames, as the paths are going to be different from development to QA to Production) 2) Key programs (orchestrations and any C# programs)
3) BizTalk Send/Receives
4) Any touchpoints with existing in-house systems or external trading partners (vendors, customers, etc…)

Here are some of the shapes and colors I’ve been using as part of standard Visio:
1) Light Yellow Parallelogram – Receive or Send Port – If relevant, I often include a map name or pipeline on the shape.
2) Blue Rectangle – Orchestration
3) Disk – Disk
4) Database – Database or Tables in Database
5) Cloud – Internet (FTP or HTTP access to outside company)
6) Red Rectangle – Pollers (C# programs that read database and create XML files)

NOTE: There is a package of Visio 2013 Stencils for BizTalk (by Sandro Pereira).  I have not yet used them, but they relate to representing Biztalk Server physical architectures, integration architectures and solution diagrams.

I’ve also used http://Draw.IO, as sometimes, not everyone has access to a license of Visio.

The following is an example from a larger project where we were processing a variety of Rosetta Net documents. The diagram also includes the project management number for each task (this company was using a system called “Redmine“).  In the example below, I wanted to emphasize some of the logic of the orchestration, and I had room, since I had was putting only one or two Rosetta documents per page. I also included the name of the developer working on in the header (removed from diagram below), as each developer was working on maybe 2-3 Rosetta documents.

Here are some of the shapes and colors I’ve been using as part of standard Visio:
1) Light Yellow Parallelogram – Receive or Send Port – If relevant, I often include a map name or pipeline on the shape.
2) Large Green Portrait Rectangle – New Development Orchestration for this application [all it’s main logic is to the right]
3) Green Landscape Rectangle, Diamonds, etc… – Steps in the orchestration
3) Cylinder – Disk and DB
4) Blue Rectangle – This was an existing orchestration that we share across applications
5) Purplse Hexagram – Pollers (C# programs that read database and create XML files)

 

There is also a free tool called Biztalk Documenter. It’s project description says:

This tool creates documentation for a given  BizTalk server 2006, 2006R2 2009, 2010, 2013, 2013R2 or 2016 TAP installation. This project has used the source code of the original BizTalk 2006 Documenter , updated and improved it. We have also added the SSO documentation by the Red Eyed Monster from the BizTalk 2010 documenter

The related bog is “Documenting Your BizTalk Solutions“.  That blog has a full set of screen shots to show you what comes out of this tool.

When I’ve had one or more long complicated orchestrations, that need extra documentation, I have used TechSmith’s SnagIt to take screen shots, and paste into a Word document.  Then I write paragraphs of text in the document describing what needs further clarification.  Unfortunately, BizTalk Orchestrations don’t have a “text” or “doc” shape.  I often use “Group” shapes in BizTalk Orchestrations to provide additional documentation “inline”, and I even nest them if I need more text than will fit.  I also put long text on the Decide shapes if that is helpful.  Here’s an example:

 

There are advantages and disadvantages to both manual and automated documentation.  Obviously, the automated documentation can be updated any time by just re-running it. But it is usually bulky and sometimes too detailed, and much too large to print.  I’ve always preferred or one or twp page diagram that summarizes the whole system with “the big picture”.  As of yet, I think only a human can do this.  Part of the art is when to abstract – i.e. what to include in the diagram, and what to leave out.  If you try to include too much, you will end up with 3 to 5 pages of diagrams and then you can get lost in the detail.  If you omit too much, then the diagram may be of little value.   It’s even possible that you might want both, a very high level diagram for management, and then a more detailed diagram for architects and developers.

 

Neal Walters has been work exclusively with BizTalk since the 2002 release, and has both been a Microsoft Trainer of BizTalk and a consultant since 2004.  He is now developing a Dallas SEO agency (Search Engine Marketing).

 

The post Ideas for How to Diagram BizTalk Process Flows appeared first on MyLifeIsMyMessage.net.

MSSQL Count by Date (when column is DateTime)

$
0
0

In Microsoft SQL, how can we group by a date, when the column we want to group by is a date time?
For example, you want the number of rows created for each date, and you have a column in the database called Date_Added (or in my example below, TrcDateTime).

Code Sample 1:

select DATEADD(dd, 0, DATEDIFF(dd, 0, trcDateTime)) as Date, 
       count(*) as count 
from trace 
GROUP BY DATEADD(dd, 0, DATEDIFF(dd, 0, trcDateTime))

Output 1:

The above gives the correct counts, but gives a rather  ugly Date, because it shows the time as 00:00:00.00.0000. To remove that, we can convert the date to a string.

Code Sample 1:

select LEFT(CONVERT(VARCHAR, DATEADD(dd, 0, DATEDIFF(dd, 0, trcDateTime)), 120), 10)  as Date, 
       count(*) as count
from trace
GROUP BY DATEADD(dd, 0, DATEDIFF(dd, 0, trcDateTime))

Output 2:

This is how you can convert a DateTime to a String:

LEFT(CONVERT(VARCHAR, trcDateTime, 120), 10)

I took the entire expression from the first query: DATEADD(dd, 0, DATEDIFF(dd, 0, trcDateTime))
and substituted it where the italic trcDateTime was in the expression above.

 

 

 

The post MSSQL Count by Date (when column is DateTime) appeared first on MyLifeIsMyMessage.net.

Quick Shortcut Links to Microsoft BizTalk MSDN Community Forums

$
0
0

It seems to me that Microsoft hides the links to these forums.  You can find them on the Microsoft site, but they are buried under a drop-down list with about 100 other forums.

You can ask questions and get answers in the forums below on the MSDN site (http://Social.Msdn.Microsoft.com).  You can also get good answers in StackOverflow.com.

Some people are still using the forums at BizTalk Gurus: http://www.biztalkgurus.com/forums/

 

BizTalk Geenral: https://social.msdn.microsoft.com/Forums/en-US/home?forum=biztalkgeneral&filter=alltypes&sort=lastpostdesc

 

BizTalk EDI: https://social.msdn.microsoft.com/Forums/en-US/home?forum=biztalkediandas2&filter=alltypes&sort=lastpostdesc

 

Adapters and Adapter Pack: https://social.msdn.microsoft.com/Forums/en-US/home?forum=biztalkr2adapters&filter=alltypes&sort=lastpostdesc

 

BizTalk RFID: https://social.msdn.microsoft.com/Forums/en-US/home?forum=biztalkrfid&filter=alltypes&sort=lastpostdesc

 

BizTalk ESB Toolkit:  https://social.msdn.microsoft.com/Forums/en-US/home?forum=biztalkesb&filter=alltypes&sort=lastpostdesc

You can post a new question/issue to the MSDN Community Forum here:
https://social.msdn.microsoft.com/Forums/en-US/newthread

When you select “BizTalk Server” fro the “Forum category”, you will then get the list of specific BizTalk Forums on the right, as shown below:

 

 

The post Quick Shortcut Links to Microsoft BizTalk MSDN Community Forums appeared first on MyLifeIsMyMessage.net.


BAM Issues in BizTalk 2016

$
0
0

I have documented some of the questions/issues in this BAM issues post in StackOverflow.

BAM Activity shows BAM.xla “variable not defined” Error in Excel on lvwTraces

I found the solution for this in this blog: “BAM ‘variable not defined” Error in Excel“.  But for some reason, that blog doesn’t come up at the top of the Google search when  you search for the various related keywords.  [That’s one reason I’m writing this blog post, to boost up that one.]

The solution is related to your Active-X control settings.  BAM uses a lot of Windows and Active-X plugins to accomplish what it does inside your Excel spreadsheet.   You have to go to “File” then “Options”, select Trust Center – Trust Center Settings – ActiveX Settings. Set ActiveX Settings to anything except “Disable..” as shown on the blog referenced above.

Every time you open a new spreadsheet (to create a new BAM Activity View), you will have to do this step again.  But if you save a spreadsheet and then re-open, those settings will be saved in that spreadsheet.

After doing the above, you may get this next error:

Unable to get resource string

The solution I chose was to install the “Office Multilingual User Interface (MUI) pack”.

The post BAM Issues in BizTalk 2016 appeared first on MyLifeIsMyMessage.net.

BizTalk Pipeline Component Unzip and Select Only Files Matching Mask

$
0
0

I started with this excellent working unzip pipeline component here (by Rui Machado).

I made the following changes to that code:
1) Put it in MyCompany.Common.etc… namespace and project (not shown here)
2) Added a Property Bag Item called FileMask (and a one for future use called “ParmReserved1” (this is standard coding, so I didn’t include here).
3) Added the FitsMask function from StackOverflow
4) Added the functionality to set the %SourceFileName% (aka ReceivedFileName, based on the files inside the zip instead of the zip file dropped).

public void Disassemble(Microsoft.BizTalk.Component.Interop.IPipelineContext pc, Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg)
{
  IBaseMessage Temp = inmsg;
  // uses Ionic.Zip 
  using (ZipFile zip = ZipFile.Read(inmsg.BodyPart.GetOriginalDataStream()))
  {
    foreach (ZipEntry e in zip)
    {
      string strCheckFileName = System.IO.Path.GetFileName(e.FileName);

      if (FitsMask(strCheckFileName, FileMask))
      {
         var ms = new MemoryStream();
         IBaseMessage outMsg;
         outMsg = pc.GetMessageFactory().CreateMessage();
         outMsg.AddPart("Body", pc.GetMessageFactory().CreateMessagePart(), true);
         outMsg.Context = inmsg.Context;

        // Neal Walters - 05/08/2017 - added promoted field with the filename - 
        // This allows us to use the %sourcefilenam% macro in the SendPort to name the file. 
        outMsg.Context.Write("ReceivedFileName",
             "http://schemas.microsoft.com/BizTalk/2003/file-properties", 
             strCheckFileName);

        e.Extract(ms);
        string XMLMessage = Encoding.UTF8.GetString(ms.ToArray());

        MemoryStream mstemp = new System.IO.MemoryStream(
        System.Text.Encoding.UTF8.GetBytes(XMLMessage));

        outMsg.GetPart("Body").Data = mstemp;

       _msgs.Enqueue(outMsg);
      }
   }
 }
}

        private static bool FitsMask(string fileName, string fileMask)
        {
            string pattern =
                 '^' +
                 Regex.Escape(fileMask.Replace(".", "__DOT__")
                                 .Replace("*", "__STAR__")
                                 .Replace("?", "__QM__"))
                     .Replace("__DOT__", "[.]")
                     .Replace("__STAR__", ".*")
                     .Replace("__QM__", ".")
                 + '$';
            return new Regex(pattern, RegexOptions.IgnoreCase).IsMatch(fileName);
        }

The screen shot below show how the FileMask can be specified in the RecieveLocation (via use of the standard Property Bag interface):

(Sorry, don't have SnagIt yet at this client, so have to use the poor man's Snipping Tool).

The post BizTalk Pipeline Component Unzip and Select Only Files Matching Mask appeared first on MyLifeIsMyMessage.net.

BizTalk 2016 – Could not load file or assembly ‘WinSCPnet, Version=1.2.10.6257

$
0
0

Error:

The adapter failed to transmit message going to send port “sp_Test_SFTP” with URL “sftp://sftp.mycompany.com:22/%MessageID%.xml”. It will be retransmitted after the retry interval specified for this Send Port. Details:”System.IO.FileLoadException: Could not load file or assembly ‘WinSCPnet, Version=1.2.10.6257, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf’ or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)
File name: ‘WinSCPnet, Version=1.2.10.6257, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf’ —> System.Exception: SFTP adapter requires WinSCP to be installed. Please refer http://go.microsoft.com/fwlink/?LinkID=730458&clcid=0x409 . —> System.IO.FileNotFoundException: Could not load file or assembly ‘file:///C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.BizTalk.Adapter.Sftp\v4.0_3.0.1.0__31bf3856ad364e35\WinSCPnet.dll’ or one of its dependencies. The system cannot find the file specified.

Solution:

I think BizTalk requires a specific older version of WinSCP and you can’t just download the latest one.
This error could also occur if you didn’t copy the file to the proper directly.

I found Michael Stephenson’s BizTalk 2016 SFTP blog, and it had a nice PowerShell script.

I just had to
1) Change directory names (I had a Software directory similar to him, but I had to create a WinSCP subdirectory under it)
2) Then PowerShell with the “Run as Admin” option.

Then the script ran fine, I restarted BizTalk Host Instance, and it got past this error, on to other errors that I’ll blog about in the near future.

By the way, I was able to run in a 64-bit host with no problem.  I remember that in older version of BizTalk the FTP adapter ran only in 32-bit hosts.

 

 

 

The post BizTalk 2016 – Could not load file or assembly ‘WinSCPnet, Version=1.2.10.6257 appeared first on MyLifeIsMyMessage.net.

BizTalk Pipeline Component Won’t Go into Debug Mode in Visual Studio Debugger

$
0
0

The following may help with a variety of custom pipeline component issues, including why your “Debug” is not catching when you expect it to. There were times today, where I would do “Debug Attach” to the BizTalk Host Instance, and the component would never go into debug mode.

1. Check that date/time of the .DLL in the GAC. There’s a chance you compiled it and though you GAC’ed it but it didn’t. Here’s the folder name to check:

c:\Windows\Microsoft.NET\assembly\GAC_MSIL

You might be using a Post Build Event like this to GAC the .DLL:


which is placed in the project properties dialog as shown below:

Check your View/Output in Visual Studio to see if you have message that it did or didn’t GAC successfully:

Example Successful GAC
1>  Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.0
1>  Copyright (c) Microsoft Corporation.  All rights reserved.
1>  
1>  Assembly successfully added to the cache
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Example Failed GAC
1>  Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.0
1>  Copyright (c) Microsoft Corporation.  All rights reserved.
1>  
1>  Failure adding assembly to the cache:   The process cannot access the file because it is being used by another process.
1>  
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4714,5): error MSB3073: The command "CALL "%VS140COMNTOOLS%vsvars32.bat"
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4714,5): error MSB3073: gacutil.exe /i "C:\Users\nrwalters\Documents\Visual Studio 2015\Projects\ABC.Common\ABC.Common.BizTalkPipelineComponentEmail\bin\Debug\ABC.Common.BizTalkPipelineComponentEmail.dll"" exited with code 1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped =========

Sometimes you have to close Visual Studio, then re-open it and do the ReBuild.
Once I was just doing “Build” and since the code didn’t change, it wasn’t rebuilding, and thus it wasn’t running the Post-Build Event, and thus the GAC didn’t get changed!

Other Steps

2. Always restart your host instance. If you have more than one, make sure you picked the right one.

3. When you do Debug Attach – you also have to make sure you select the proper BTNTSvc.exe. Use Task Manager to get the process ID based on the name, and then in Visual Studio, select based on the “ID” column.

Pipeline Components Directory?

Some blogs say that since BT 2006 this isn’t really needed; that you should just GAC your pipeline components.
Other people argue that it is still necessary. I seem to have success with the first otpion.

The post BizTalk Pipeline Component Won’t Go into Debug Mode in Visual Studio Debugger appeared first on MyLifeIsMyMessage.net.

BizTalk 2016 Powershell Extensions not Found (not Installed)

$
0
0

Error: No snaps-ins have been registered for Windows PowerShell

You run the following:

cls
Add-PSSnapIn -Name BiztalkFactory.PowerShell.Extensions  #NOTE: Must be in 32-bit version of Powershellto use this SnapIn


 

And you get this error:

Add-PSSnapIn : No snap-ins have been registered for Windows PowerShell version 3.


 

Solution:Go the SDK/Utilities/Powershell and install them

Basically follow the steps laid out by here MSDN BizTalk Forum, except you don’t need to download from CodePlex, you can use the one in the install.

  1. Navigate to: C:\Program Files (x86)\Microsoft BizTalk Server 2013 R2\SDK\Utilities\PowerShell
  2. Optionally open and follow the readme.txt
  3. Open a command prompt as an administrator
  4. Change directory to the folder containing the binaries – \SDK\Utilities\PowerShell under the base install location
  5. Run the following command to install/register the dlls
    %windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe .\BizTalkFactory.PowerShell.Extensions.dll

I needed this today to run a powershell to create biztalk hosts.

The post BizTalk 2016 Powershell Extensions not Found (not Installed) appeared first on MyLifeIsMyMessage.net.

How set 32-bit-only flag when creating BizTalk Hosts with Powershell Extension

$
0
0

In a previous blog, I gave a full Powershell Script to Add BizTalk Hosts, but it didn’t show how to set the 32-bit vs 64-bit flag (it has now been updated to include that).

64 bit vs 32 bit Host

In BIzTalk, the flag is called the 32BitOnly flag.  To create a 64-bit Host, set this flag to false (same as unchecking it in the BizTalk Admin Console).

Instead of setting it on the New-Item command, you have to set it as a property on the following line of code, as shown below.

Code Sample

$temp = New-Item -path $hostName -HostType:$HostType -NtGroupName:$myNTHostGroupName -AuthTrusted:$AuthTrusted 
Set-ItemProperty -Path $hostName -Name 'Is32BitOnly' -Value 'False'
#similarly, to set whether or not the Host is a "Tracking Host", use the following line 
Set-ItemProperty -Path $hostName -Name 'HostTracking' -Value 'True' 


 
To get a list of all the miscellaneous properties, I set a break point and use the Get-Members cmdlet:

[DBG]: PS BizTalk:\Platform Settings\Hosts>> $temp | Get-Member


   TypeName: BizTalkFactory.Management.Automation.BtsHost

Name                                  MemberType   Definition                                                                                
----                                  ----------   ----------                                                                                
Equals                                Method       bool Equals(BizTalkFactory.Management.Automation.BtsArtifact other), bool Equals(System...
ExportHostSettings                    Method       void ExportHostSettings(string path)                                                      
GetHashCode                           Method       int GetHashCode()                                                                         
GetType                               Method       type GetType()                                                                            
ImportHostSettings                    Method       void ImportHostSettings(string path)                                                      
ToString                              Method       string ToString()                                                                         
PSChildName                           NoteProperty System.String PSChildName=TrackingHost                                                    
PSDrive                               NoteProperty BizTalkFactory.PowerShell.Extensions.BizTalkDriveInfo PSDrive=BizTalk                     
PSIsContainer                         NoteProperty System.Boolean PSIsContainer=False                                                        
PSParentPath                          NoteProperty System.String PSParentPath=BiztalkFactory.PowerShell.Extensions\BizTalk::Biztalk:\Platf...
PSPath                                NoteProperty System.String PSPath=BiztalkFactory.PowerShell.Extensions\BizTalk::Biztalk:\Platform Se...
PSProvider                            NoteProperty System.Management.Automation.ProviderInfo PSProvider=BiztalkFactory.PowerShell.Extensio...
AllowMultipleResponses                Property     bool AllowMultipleResponses {get;set;}                                                    
AuthTrusted                           Property     bool AuthTrusted {get;set;}                                                               
Catalog                               Property     BizTalkFactory.Management.Automation.BtsCatalog Catalog {get;}                            
Clustered                             Property     bool Clustered {get;}                                                                     
DBQueueSizeThreshold                  Property     uint32 DBQueueSizeThreshold {get;set;}                                                    
DBSessionThreshold                    Property     uint32 DBSessionThreshold {get;set;}                                                      
DehydrationBehavior                   Property     BizTalkFactory.Management.Automation.BtsDehydrationBehavior DehydrationBehavior {get;set;}
DeliveryQueueSize                     Property     uint32 DeliveryQueueSize {get;set;}                                                       
GlobalMemoryThreshold                 Property     uint32 GlobalMemoryThreshold {get;set;}                                                   
HostTracking                          Property     bool HostTracking {get;set;}  
HostType                              Property     BizTalkFactory.Management.Automation.BtsHostType HostType {get;}                          
InflightMessageThreshold              Property     uint32 InflightMessageThreshold {get;set;}                                                
Is32BitOnly                           Property     bool Is32BitOnly {get;set;}  
IsDefault                             Property     bool IsDefault {get;set;}                                                                 
IsHost32BitOnly                       Property     bool IsHost32BitOnly {get;set;}                                                           
LegacyWhitespace                      Property     bool LegacyWhitespace {get;set;}                                                          
MessageDeliveryMaximumDelay           Property     uint32 MessageDeliveryMaximumDelay {get;set;}                                             
MessageDeliveryOverdriveFactor        Property     uint32 MessageDeliveryOverdriveFactor {get;set;}                                          
MessageDeliverySampleSpaceSize        Property     uint32 MessageDeliverySampleSpaceSize {get;set;}                                          
MessageDeliverySampleSpaceWindow      Property     uint32 MessageDeliverySampleSpaceWindow {get;set;}                                        
MessagePublishMaximumDelay            Property     uint32 MessagePublishMaximumDelay {get;set;}                                              
MessagePublishOverdriveFactor         Property     uint32 MessagePublishOverdriveFactor {get;set;}                                           
MessagePublishSampleSpaceSize         Property     uint32 MessagePublishSampleSpaceSize {get;set;}                                           
MessagePublishSampleSpaceWindow       Property     uint32 MessagePublishSampleSpaceWindow {get;set;}                                         
MessagingMaxReceiveInterval           Property     uint32 MessagingMaxReceiveInterval {get;set;}                                             
MessagingReqRespTTL                   Property     uint32 MessagingReqRespTTL {get;set;}                                                     
MsgAgentPerfCounterServiceClassID     Property     guid MsgAgentPerfCounterServiceClassID {get;set;}                                         
Name                                  Property     string Name {get;}                                                                        
NtGroupName                           Property     string NtGroupName {get;}                                                                 
ProcessMemoryThreshold                Property     uint32 ProcessMemoryThreshold {get;set;}                                                  
SubscriptionPauseAt                   Property     uint32 SubscriptionPauseAt {get;set;}                                                     
SubscriptionResumeAt                  Property     uint32 SubscriptionResumeAt {get;set;}                                                    
ThreadPoolSize                        Property     uint32 ThreadPoolSize {get;set;}                                                          
ThreadThreshold                       Property     uint32 ThreadThreshold {get;set;}                                                         
ThrottlingBatchMemoryThresholdPercent Property     uint32 ThrottlingBatchMemoryThresholdPercent {get;set;}                                   
ThrottlingDeliveryOverride            Property     uint32 ThrottlingDeliveryOverride {get;set;}                                              
ThrottlingDeliveryOverrideSeverity    Property     uint32 ThrottlingDeliveryOverrideSeverity {get;set;}                                      
ThrottlingLimitToTriggerGC            Property     uint32 ThrottlingLimitToTriggerGC {get;set;}                                              
ThrottlingPublishOverride             Property     uint32 ThrottlingPublishOverride {get;set;}                                               
ThrottlingPublishOverrideSeverity     Property     uint32 ThrottlingPublishOverrideSeverity {get;set;}                                       
ThrottlingSeverityDatabaseSize        Property     uint32 ThrottlingSeverityDatabaseSize {get;set;}                                          
ThrottlingSeverityInflightMessage     Property     uint32 ThrottlingSeverityInflightMessage {get;set;}                                       
ThrottlingSeverityProcessMemory       Property     uint32 ThrottlingSeverityProcessMemory {get;set;}                                         
ThrottlingSpoolMultiplier             Property     uint32 ThrottlingSpoolMultiplier {get;set;}                                               
ThrottlingTrackingDataMultiplier      Property     uint32 ThrottlingTrackingDataMultiplier {get;set;}                                        
TimeBasedMaxThreshold                 Property     uint32 TimeBasedMaxThreshold {get;set;}                                                   
TimeBasedMinThreshold                 Property     uint32 TimeBasedMinThreshold {get;set;}                                                   
UseDefaultAppDomainForIsolatedAdapter Property     bool UseDefaultAppDomainForIsolatedAdapter {get;set;}                                     
XlangMaxReceiveInterval               Property     uint32 XlangMaxReceiveInterval {get;set;}                                                 

[DBG]: PS BizTalk:\Platform Settings\Hosts>> 

The post How set 32-bit-only flag when creating BizTalk Hosts with Powershell Extension appeared first on MyLifeIsMyMessage.net.

How to set Isolated vs In-Process when creating BizTalk Host with Powershell

$
0
0

The following shows how to set the $HostType for the BizTalk Powershell Extensions.

 if ($HostType -eq "Isolated") 
   {
     $HostTypeCode = 2  #Isolated 
   }
   else 
   {
     $HostTypeCode = 1  #In-Process
   }
 $temp = New-Item -path $hostName -HostType:$HostTypeCode -NtGroupName:$myNTHostGroupName -AuthTrusted:$AuthTrusted 

See full function in this blog about Adding BizTalk Hosts and Hostinstances with Powershell.

The post How to set Isolated vs In-Process when creating BizTalk Host with Powershell appeared first on MyLifeIsMyMessage.net.


Update Adapters with Host Names in BizTalk Powershell Extensions

$
0
0

After you add Host and Host-Instances to BizTalk, they are not useful and cannot be associated with Send/Receive ports until you relate the Host to the Adapter. This can be done in BizTalk Admin Console, but below is a program that allows you to do it with the BizTalk Powershell Extensions.

See related script to use Powershell to add new BizTalk Hosts and Host Instances.

cls
Add-PSSnapIn -Name BiztalkFactory.PowerShell.Extensions  #NOTE: Must be in 32-bit version of Powershellto use this SnapIn
#get-PsSnapIn -registered   ### list registered Snap-In's

function UpdateAdapter($AdapterName, $HostName, $Direction)
{
        # modeled after code from: 
        # https://social.technet.microsoft.com/wiki/contents/articles/32456.powershell-script-for-creating-biztalk-hostshost-instancesadapter-handlers-and-custom-event-log.aspx}

        Write-Host "Starting of `$Adapter=$AdapterName and `$Host=$HostName `$Direction=$Direction"
        #Example: Set-Location –Path '..\SFTP'
        $Pathname = "BizTalk:\Platform Settings\Adapters\$AdapterName"
        Write-Host "`$PathName=$PathName"
        Set-Location –Path $PathName 

        if ($Direction -eq "Send" -or $Direction -eq "Both") 
        {
            Write-Host "Setup Sending" 
            ### Sending 
                                                           #Example:  -eq "SFTP Send Handler (Sending_64)"
            $VarAdapterHandler = Get-ChildItem | Where-Object{$_.Name -eq "$AdapterName Send Handler ($HostName)"}
            if($VarAdapterHandler.Name -eq $null)
            {
                   Write-Host "Adding $AdapterName handler for Host=$HostName"
                   #New-Item  -Path .\Sending_64 -HostName Sending_64 -Direction Send 
                   New-Item  -Path .\$HostName -HostName $HostName -Direction Send
            }
        }

        if ($Direction -eq "Receive" -or $Direction -eq "Both") 
        {
            Write-Host "Setup Receiving" 
            ### Receiving
            $VarAdapterHandler = Get-ChildItem | Where-Object{$_.Name -eq "$AdapterName Receive Handler ($HostName)"}
            if($VarAdapterHandler.Name -eq $null)
            {
                   Write-Host "Adding SFTP Receive handler for Receiving_64 Host"
                   New-Item  -Path .\$Hostname -HostName $HostName -Direction Receive
            }
        }
        Write-Host "End of $AdapterName and $HostName"
        Write-Host "----"

}


### MAIN CODE HERE - Calls Function Above once per Host/Host-Instance ### 


#Pass Three Parms: 1) AdapterName, 2) HostName, 3) Direction [Send/Recive/Both]
#UpdateAdapter  "TrackingHost"   "Both" 

UpdateAdapter "HTTP" "AS2HostReceive" "Receive"
UpdateAdapter "HTTP" "AS2HostSend"    "Send"

UpdateAdapter "SFTP" "SFTPHostReceive" "Receive"
UpdateAdapter "SFTP" "SFTPHostSend"    "Send"

UpdateAdapter "FILE" "FileHostReceive" "Receive"
UpdateAdapter "FILE" "FileHostSend"    "Send"

Write-Host "Script Completed"

The post Update Adapters with Host Names in BizTalk Powershell Extensions appeared first on MyLifeIsMyMessage.net.

List/Start/Stop Host Instances with Biztalk Powershell Extensions

$
0
0

When dealing with Host Instances, you must specify the fully-qualified name, or use a couple of tricks I show in this blog.

I’ve been setting up some pre-canned scripts that I can just open when needed, and that have already been tested. Today I was looking at listing, starting, and stopping BizTalk Host Instances.

Powershell Script

cls
Add-PSSnapIn -Name BiztalkFactory.PowerShell.Extensions  #NOTE: Must be in 32-bit version of Powershellto use this SnapIn

cd "Biztalk:\Platform Settings\Host Instances"
Get-ChildItem | ft -auto      # or just type in "DIR", the "| ft -auto" avoids the Name being cut off with the elipse ... 
Write-Host "`nList Completed"


#Demonstrating 3 ways: 
#  1) Use fully qualified host instance name (a big pain to type it correctly) 
#  2) Use the -match operator to match on a string 
#  3) Use the Host name instead
# With last two, it will start/stop all host-instances on all machines

Stop-HostInstance "Microsoft BizTalk Server OrchHost SERVER01"
Write-Host "Stopped"

#Get-ChildItem |Where-Object { $_.Name -match 'OrchHost' } |Start-HostInstance
Get-ChildItem |Where-Object { $_.Host -eq 'OrchHost' } |Start-HostInstance
Write-Host "Started"

Results of running the above Powershell Script


    Path: BiztalkFactory.PowerShell.Extensions\BizTalk::Biztalk:\Platform Settings\Host Instances


Name                                                           Host Name                 Windows Group                         Running Server
----                                                           ---------                 -------------                         --------------
Microsoft BizTalk Server BizTalkServerApplication SERVER01  BizTalkServerApplication  BizTalk Application Users             SERVER01   
Microsoft BizTalk Server BizTalkServerIsolatedHost SERVER01 BizTalkServerIsolatedHost BizTalk Isolated Host Users           SERVER01   
Microsoft BizTalk Server TrackingHost SERVER01              TrackingHost              SERVER01\BizTalk Application Users SERVER01   
Microsoft BizTalk Server AS2HostReceive SERVER01            AS2HostReceive            SERVER01\BizTalk Application Users SERVER01   
Microsoft BizTalk Server AS2HostSend SERVER01               AS2HostSend               SERVER01\BizTalk Application Users SERVER01   
Microsoft BizTalk Server SFTPHostReceive SERVER01           SFTPHostReceive           SERVER01\BizTalk Application Users SERVER01   
Microsoft BizTalk Server SFTPHostSend SERVER01              SFTPHostSend              SERVER01\BizTalk Application Users SERVER01   
Microsoft BizTalk Server FileHostReceive SERVER01           FileHostReceive           SERVER01\BizTalk Application Users SERVER01   
Microsoft BizTalk Server FileHostSend SERVER01              FileHostSend              SERVER01\BizTalk Application Users SERVER01   
Microsoft BizTalk Server OrchHost SERVER01                  OrchHost                  SERVER01\BizTalk Application Users SERVER01   



List Completed
Stopped
Started

PS BizTalk:\Platform Settings\Host Instances&gt; 

The use of “-ft auto” is used to avoid the ellipsis and show the full name (rather than truncating it).

The post List/Start/Stop Host Instances with Biztalk Powershell Extensions appeared first on MyLifeIsMyMessage.net.

Using BizTalk Poweshell Extensionst to List/Start/Stop SendPorts, ReceivePorts…

$
0
0

Here are some samples you can use to list, start/stop, enable/disable, enlist/unenlist and so on your Send Ports, Receive Ports, and Recieve Locations.

Note the path hierarchy. You must specify you application name. I’m using “BizTalk EDI Application” since anyone with EDI installed will have the same results.

Sample Script

cls
Add-PSSnapIn -Name BiztalkFactory.PowerShell.Extensions  #NOTE: Must be in 32-bit version of Powershellto use this SnapIn

cd "Biztalk:\Applications\BizTalk EDI Application\Send Ports"
Get-ChildItem | ft -auto      # or just type in "DIR", the "| ft -auto" avoids the Name being cut off with the elipse ... 
Write-Host "`nSend Ports - List Completed"
Get-ChildItem |Where-Object { $_.Name -match 'ResendPort' } | Unenlist-SendPort
Get-ChildItem |Where-Object { $_.Name -match 'ResendPort' } | Start-SendPort


cd "Biztalk:\Applications\BizTalk EDI Application\Receive Ports"
Get-ChildItem | ft -auto      # or just type in "DIR", the "| ft -auto" avoids the Name being cut off with the elipse ... 
Write-Host "`nReceive Ports - List Completed"


cd "Biztalk:\Applications\BizTalk EDI Application\Receive Locations"
Get-ChildItem | ft -auto      # or just type in "DIR", the "| ft -auto" avoids the Name being cut off with the elipse ... 
Write-Host "`nReceive Ports - List Completed"

cd "Biztalk:\Applications\BizTalk EDI Application\Receive Locations"
Get-ChildItem |Where-Object { $_.Name -match 'ResendReceiveLocation' } | Disable-ReceiveLocation
Get-ChildItem |Where-Object { $_.Name -match 'ResendReceiveLocation' } | Enable-ReceiveLocation

Note: I didn't put any Write-Host to show when the ports were succesfully stopped or started, you could add that i you want it.

Output of running the above script



    Path: BiztalkFactory.PowerShell.Extensions\BizTalk::Biztalk:\Applications\BizTalk EDI Application\Send Ports


Name       Status  Application            
----       ------  -----------            
ResendPort Started BizTalk EDI Application



Send Ports - List Completed


    Path: BiztalkFactory.PowerShell.Extensions\BizTalk::Biztalk:\Applications\BizTalk EDI Application\Receive Ports


Name                        Application            
----                        -----------            
BatchControlMessageRecvPort BizTalk EDI Application
ResendReceivePort           BizTalk EDI Application



Receive Ports - List Completed


    Path: BiztalkFactory.PowerShell.Extensions\BizTalk::Biztalk:\Applications\BizTalk EDI Application\Receive Locations


Name                       Enabled Application            
----                       ------- -----------            
BatchControlMessageRecvLoc True    BizTalk EDI Application
ResendReceiveLocation      True    BizTalk EDI Application



Receive Ports - List Completed

PS BizTalk:\Applications\BizTalk EDI Application\Receive Locations> 

When you install the Powershell Extensions for BizTalk, there is a readme.txt file created ("d:\Program Files (x86)\Microsoft BizTalk Server 2016\SDK\Utilities\PowerShell\readme.txt") that will show you all the cmdlets that are available (such as Start-SendPort, Unenlist-SendPort, etc...)

The post Using BizTalk Poweshell Extensionst to List/Start/Stop SendPorts, ReceivePorts… appeared first on MyLifeIsMyMessage.net.

BizTalk AS2 Error: The underlying connection was closed: The connection was closed unexpectedly.

$
0
0

The underlying connection was closed: The connection was closed unexpectedly.

I’m sure there are numerous reasons for this error, but here’s one I encountered today.

First the background. We have BizTalk server connecting to an internal Open/AS2 server running on Linux. That Linux server was re-installed on a Virtual Machine; and I had agreed with the Linux guy to change the AS2-ID (defined in the Trading Parties) from BiztalkTest to BizTalkProd. However, he didn’t make the change on his side.

So when he looked at the logs, he could see that it was receiving data, but as he described it “the server didn’t know what to do with it.” That means, it didn’t generate the MDN and send it back to BizTalk.

I had defined my SendPort was a two-way (Static Solicit-Reponse) and was using content-based routing. So we sent the message to the AS2 server, and didn’t get a response back, giving the “underlying connection closed unexpectedly” error.

The post BizTalk AS2 Error: The underlying connection was closed: The connection was closed unexpectedly. appeared first on MyLifeIsMyMessage.net.

How to Filter by Filename by Mask in BizTalk

$
0
0

Business Requirement:

Only send an email to the credit department if the filename contains the word “EXPORT” and and ends with .txt.

Question: How would you do that in BizTalk?

BizTalk has filters on the send ports. So in theory, you could filter on the filename. But guess what?
There is no operator for “contains”, or “matches”, or any RegEx (Regular Expressions).

The image below shows the field we would use: FILE.ReceivedFileName, but there is no operator that helps solve this problem.

My Solution:

On the ReceivePort, I created my own custom pipeline component, did the matching myself, and promoted fields if the results were true. The admin/developer can identify the name of the promoted field as one of the values in my Pipeline Component. He also provides the filemask he wants to match.

The receive port pipeline configuration is shown below.

Then in the SendPort, I can test the promoted fields that were promoted by that Receive Pipeline component.

The post How to Filter by Filename by Mask in BizTalk appeared first on MyLifeIsMyMessage.net.

Viewing all 215 articles
Browse latest View live