| Andy's profileAndy's WarholeBlogLists | Help |
|
|
Flat File DisassemblerWhile I was developing a flat file disassembler flat file component to handle multiple flat file formats, I was completely brought off track by something I found on Gilles’ Weblog: ‘In a pipeline component, some streams are not seekable: Improvements to the Archiver’. The confusing text was:
However, when testing my pipeline component the messages seemed to disappear. The message types were determined correctly, the document specification name was determined correctly, but my message did not appear in the output location. After a lot of frustration and time, it finally hit me; maybe the resulting stream was empty. I thought, because of the comment mentioned above, that I was dealing with a copy of the stream, but according to the MSDN:
So, instead of dealing with a copy I was dealing with a clone of the stream. Adding the following lines solved the problem, pffff: // Preserve the stream position // Restore the stream position Failed to access IIS metabaseRecently I was working with WCF and ran into the following error:
The solution was simple. Executing the below statement solved the problem.
The error indicates that the .NET Framework is not registered with IIS. The .NET Framework detects which versions of IIS exist when the .NET Framework is installed, and it automatically registers itself with IIS. If IIS does not exist when .NET Framework is installed, the .NET Framework is not registered with IIS. The command with -i switch is used for installing ASP.NET and upgrading all application pools to ASP.NET version which came with the ASP.NET IIS Registration Tool. It will ignore the previous version of application pool. See Microsoft: ASP.NET IIS Registration Tool (aspnet_regiis.exe). The node to be inserted is from a different document contextOften, when I first try to copy a node from one XML document to another I get the following error:
This time it was because I used InsertAfter() incorrectly.
When copying a node from one document to another you have to use ImportNode() and then add that node to the document.
I have to keep remembering this. BizTalk mapping behavioursWhen using the multiplication functoid in the BizTalk mapper I ran into some strange behaviour. In the source schema I had two elements: Price, defined as string, and NumberOfTransactions, also defined as string. I used the multiplication functoid the determine the TotalSalesAmount, again defined as string with restriction ^-?(\d{0,16})(\.\d{1,4})?$, in the destination schema. The result surprised me; the price, 0.0340, multiplied by the transctions, 6, resulted in a total amount of 0.20400000000000002. Obviously, the result was not the result I wanted to see. So, I tried using a custom scriptoid. The scriptoid contained the following functoin:
The result again did not meet my expectations. The total amount ended up being 0.20400000000000002. After being puzzled for a couple of minutes I found the answer. The above code needed just a little adjustment. The final code is:
I simply had to explicitly convert the result back into the right datatype, i.e. string, using the defined culture. Another valuable leason learned. Macros in Send File AdapterI always seem to forget the most common macros when using the Send File Adapter in BizTalk, so this is a reminder.
Business Rule Engine tipsLately I was making a Proof of Concept including the BRE. After making a vocabulary and some rules I tested the policy. The rules were successfully fired. I then built an orchestration implementing a Call Rules shape. After deploying the orchestration I tested the application. However, the rules did not fire. A couple of hours later I found the ‘problem’. So to not forget in the future: Put the Call Rules shape within an Atomic Transaction. Pipeline Component:invalid pipeline component assemblyTechnorati Tags: BizTalk 2006,Pipeline Component Ever having trouble adding a custom pipeline component to the BizTalk pipeline Components toolbox? "You have selected an invalid pipeline component assembly. Please check security settings for the assembly if you are loading it from an UNC path." Some hints to resolve this error:
Most of the times the problem occurs when building the component manually. A useful tool is the pipeline component wizard. Assigning a Guid to a pipeline componentLately I have been developing multiple pipeline components. One of the things you have to do when developing such a component is assign it a GUID. A quick shortcut is to have this functionality of creating a new GUID available in Visual Studio 2005. Here is how to achieve that: In Visual Studio 2005, go to Tools and select External Tools... The following Dialog opens Set the fields according to the following picture; the Command field is C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\uuidgen.exe. When you know open the Tools menu, a New Guid item is created. When you select and click this item a guid is created in the output window of Visual Studio. Very neat. Debugging Pipeline ComponentsThere are 2 ways to debug pipeline components; the Attach method and the Tool method Attach to process Build the solution in debug mode and deploy the pipeline component from bin\debug\. Make sure the output of the solution (component assembly) is saved to <BizTalk root install>\Pipeline Components. This can either be done by changing the output path of the projects build properties or by executing a post-build event. The script should look like:
Build and deploy the pipeline. NB: In order to avoid an error saying the output dll is being used by another process; - Do not put the pipeline component project and the custom pipeline project in one solution, since the pipeline designer will lock the pipeline component. - Stop the BizTalk service (host instance) in order to be able to copy the assembly to the mentioned directory. Attach a .NET debugger to BTSNTSVC.EXE in the pipeline component project. In an earlier post I decribed how to attach to the right service when running multiple host instances. If you decide to use the SOAP adapter, you have to attach the debugger to the process of the isolated host; W3WP.EXE. Remember that the SOAP adapter runs within the Isolated host and not the in-process host. Set the breakpoints, most likely in the IBaseMessage Execute method Drop a message in a recieve location to invoke the pipeline. The easiest way is using the FILE adapter. The project will enter break mode when a breakpoint hits. The major advantage of this method is that it resembles the situation as it will be in the acceptance and production environments. The major disadvantage is that it is quite hard and complicated. The pipeline.exe tool The pipeline.exe tool can be found in <BizTalk root install>\SDK\Utilities\Pipeline Tools. More information about the tool can be found in the MSDN. Set the output of the solution (custom pipeline component dll) to <BizTalk root install>\Pipeline Components. This can be done by changing the output path of the projects build properties. In the Debug properties of the Visual Studio project, set the Start Action to "Start external program". Set the full path to <BizTalk root install>\SDK\Utilities\PipelineTools\Pipeline.exe. In the Start Options specify the "Command line arguments". Most times I use the full path to the pipeline file (.btp), followed by -d and the full path to the flat file to test, -p, to display the promoted context properties, -c, to display the result to the console, and -t, to display elapsed time of components execution. The result looks like: D:\Project\Pipelines\Receive\Sample.btp -d D:\Project\Pipelines\Receive\Test\test.txt -p -c -t Set the breakpoints, most likely in the IBaseMessage Execute method Right the project and Select Debug, Start new instance to start debugging The major advantage if this method is that it is fast and easy. The major disadvantage is that pipeline.exe does not access the BizTalk databases, so some components will not execute properly. XML Validator pipeline component error in Send PipelineThe MSDN mentions "The XML Validator pipeline component can be used in both send and receive pipelines in any stage except for Disassemble or Assemble."
So, when your not paying attention, and put the the component in the assemble stage of a send pipeline, you get the following error:
I've learned my lesson. C# Enum.ParseLately, I was working on a BizTalk Server pipeline component to unzip files. An enumeration was created to hold the supported archive types. When working with my enumeration I ended up with the following statement to convert the enum string value to an enum item value:
Somehow, I knew there was a nicer way of coding this. While live searching I ran into a nice post from Christopher Bennage. He thought the code was ugly and contained too many casts. So he created a typesafe parse method using generics in a separate helper class called Enum<T>. Here's the code. It's pretty neat.
My code now looks like:
Nicer and better, it's type safe. Correlating BizTalk Instance with the PID of the BizTalk ServiceJust back from holidays, I needed to debug a c# component used in one of our orchestrations. Since we introduced some additional host instances, I needed to to determine to which host instance (service) to attach to. In the Attach to Process dialog it is not possible to see to which host instance the pid belongs, they, in this example, both show as BTSNTSvc.exe. However, by executing the tasklist command using the command prompt you are able to determine where to attach to.
The result after executing the command will be something like: As the orchestrations are run within the BtsProcessingHost, the belonging PID can now easily be found and the component attached the corresponding BizTalk service. Promoted properties and datatypesWhen doing some modifications in a BizTalk solution I changed the datatype of an element in a Property Schema from string to long. After deployment it gave me the following error:
I simply forgot BizTalk does not support promoted properties of type long. Changing the datatype back to string solved the problem.
BizTalk schema editor, base data types and restrictions
When you define an element with data type xs:decimal, there is no way that you can control the digits using the XSD schema editor in Visual Studio. However, you can still add the fractionDigit facet, by editing the BizTalk schema in a text/xml editor. Just add the following code under the xs:decimal data type element:
If you than validate an instance the error nicely refers to the fractionDigits facet specified:
Nice feature! While searching the internet I found this article by Stephen Kaufman describing the fractionDigit feature. It was written before BizTalk 2006 was even there. I'm wandering why this feature was not incorporated in BizTalk Server 2006 (R#). Flat-file Custom Date/Time FormatsTechnorati Tags: BizTalk Server 2006;Flat File;Custom Date/Time Format
Lately I've been doing a lot of flat file validations and transformations. One of the conversions dealt with date/time conversions. In the schemas I wanted to use the xs:date datatype. However, the dates in the files supplied did not conform to the ISO 8601 format.
When experimenting with the schemas, I ran into a property called Custom Date/Time Format. In that property you can define the alternative format of the actual supplied value and the flat file disassembler converts it to an xs:date format.
The use of Custom Date/Time Formats is explained in details at the Microsoft's BizTalk Server TechCenter. Team Foundation Server; 'Working folder is already in use'Technorati Tags: Team Foundation System;TFS
Recently we migrated to TFS using virtual machines. However, when trying to get the sources creating work spaces and mapping working folder I ran into problems. The message I got was: 'The working folder is already in use by another workspace on this computer'.
I followed some advice to remove the workspace using the command:
It did not solve my problem. The error indicates tha the server believes this folder is already in use in another workspace. So, I created a workspace using a different machine name and it worked. However, I did not want to use a different name other than my virtual machine name. It took me a moment to realise that there indeed was another workspace with the same name. The person who cloned the virtual machines also had a workspace with the same machine name, but a different user name. Aparently, the workspace is bounded to a machine name and not to machine name and user as I would expect.
Another lesson learned... 'An error has occurred while establishing a connection to the server'
When deploying a BizTalk project from Visual Studio, you sometimes run into this error:
This happened to me when migrating from Visual SourceSafe, VSS, to Team Foundation System, TFS, by copying the projects from a pc to a virtual machine. To solve this error, perform the following steps:
The error happens since the servername is listed in the projectname.btproj.user file that is a part of the project. I often forget the change the servername, so this is to not forget it the next time. BizTalk Server 2006 R3Technorati Tags: BizTalk 2006,BizTalk 2006 R3,VS2008,SQL Server 2008 Today I read a blogpost on BizTalk Server Team Blog announcing the plans to deliver BizTalk server 2006 R3. This new release will support Windows Server 2008, .Net framework 3.5, Visual Studio 2008 and SQL Server 2008. According to Steve Martin's blogpost a CTP of BizTalk Server R3 is expected later this year and the RTM is planned the first half of 2009.
"Could not write to output file"Occasionally, I run into the following error when building a solution containing multiple BizTalk projects:
I found this simple solution here. Just close and reopen Visual Studio 2005. Now you can rebuild your solution. Annoying, but it works. "An error has occurred while establishing a connection to the server"Recently I ran into this when I tried to deploy my BizTalk project from Visual Studio 2005:
I had run into this error before and after a few minutes I remembered what I did wrong: the server name. Since I moved the solution and projects from Visual Source Safe to Team Foundation System in a virtual machine environment, I needed to change the server name of the project. To change the property, complete the following steps:
Now let's hope I won't forget it a next time. |
|
|