Geeks With Blogs

Bill Osuch - Random geek notes

Recently at work we had a need to be able to manipulate the XML version of a HIPAA EDI file before it hit any of our BizTalk orchestrations, so I decided to do this with a custom pipeline component. There are other (possibly better…) ways of doing this, but sometimes you just have to work with what you’ve got. I can never remember all the little bits and pieces you have to set up in a custom pipeline component, so I decided to give the BizTalk Server Pipeline Component Wizard a try. The wizard walks you through a few simple screens, then builds a skeleton component that you can add your code to.

Download and extract the Wizard. Unzipping the downloaded file should give you a Visual Studio solution. Build it, then run the setup.exe file located in the PipelineComponentWizard Setup project.

Create a new BizTalk solution (or open an existing one) that would need to use EdiReceive pipeline. You don’t need to include the Component Wizard project you just built into this solution. For example, you could just create a simple project that takes an EDI file in a receive location and drops the disassembled XML to a Send Port. Compile and deploy it, then configure it and test that it’s working properly.

Now, create an additional project in the same solution. Under BizTalk Projects, you should see a new type of project: BizTalk Server Pipeline Component Project.

NewProject

Click next on the welcome screen and you’ll get to General setup. Here you’ll set the namespace and classname, decide whether you’ll building a receive or send pipeline, where the component will sit in the pipeline (which stage), and the language to use.

GeneralSetup

On the next screen, UI settings, you’ll define the component name, version, and short description.

image

Next you’ll set Design-time variables that can be accessed within Visual Studio. I didn’t really need any for my project, but I added one just to show how it worked.

Variables

Click Next, then Finish. Once the wizard completes you’ll have a new project with a .cs file containing the skeleton code for you to finish, and a .resx file containing the name/value pairs to describe your component. You should have the following sections created in the class:

  • Design-time variables (public properties) defined in the wizard.
  • IBaseComponent members – the Name, Version and Description of the component.
  • IPersistPropertyBag members – utilities to read and write values from the property bag.
  • IComponentUI members – the icon to show in the toolbox, and a Validate method that will be called during the build process. You can implement your own code here.
  • IComponent members – the Execute method that’s going to do the actual work. Initially it just returns the IBaseMessage that it receives, so you have a passthrough pipeline component.

Compile the project, and copy the DLL to the C:\Program Files (x86)\Microsoft BizTalk Server 2010\Pipeline Components directory (your exact path may be different, of course). In Visual Studio, select Tools –> choose Toolbox Items, then select the BizTalk Pipeline Components tab. Check the component you just created and click OK.

Now, add a new pipeline to your BizTalk project. You should see the component you just created in the toolbox. Drag the EDI disassembler to the Disassemble stage, and the new component to the Validate stage.

Pipeline

Display the properties of the new component and you’ll see that the TestProperty created is accessible.

Properties

Build and re-deploy the BizTalk project. In the Administration Console, you’ll now have the new pipeline available when configuring the Receive Location; choose it instead of the EdiReceive pipeline. Start the application, drop a file in, and you should see… absolutely no difference from before! Your pipeline is disassembling the EDI file into XML, and your custom component is just passing it through with no modifications.

Next time in part 2, I’ll talk about what you need to do to actually manipulate the XML and the message properties.

Technorati Tags:

Posted on Tuesday, January 24, 2012 12:40 PM BizTalk | Back to top


Comments on this post: Creating a custom BizTalk 2010 pipeline component–Part I

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Bill Osuch | Powered by: GeeksWithBlogs.net