| Brian's profileBrian's World of BizTalkPhotosBlogLists | Help |
|
|
Brian's World of BizTalkAugust 07 Starting Over...I have been using Microsoft's Live Spaces to blog my BizTalk and work related topics, but I think I am going to transition over to Blogger for both my work and personal blogs. I like the statistics that Live Spaces captures directly on their site, but I preferred the ability to use Google Analytics and categorize posts under multiple categories which is supported by Blogger. I will probably continue to cross-post for awhile, but I expect the Live Space blog will disappear. July 27 PGP Pipeline Component v1.1I ran across a few things that I needed to update and have posted them here as well. Notable changes include:
Link to dll: BAJ.BizTalk.PipelineComponent.PGP.dll Link to source code: PGP.zip July 25 BizTalk SMTP Adapter is Missing BCC FunctionalityOk, so this probably comes to no surprise to many of you. I remember running in to this problem when I was using BTS 2004. However, I thought that the community's cries would be answered with BTS 2006. I have not had a need for it until now, so I never checked, but again the ability to BCC using the SMTP Adapter does not exist. Fortunately, there are many ways to skin this cat. The first 2 that come to mind are:
Anyway, I whipped up some code that would handle my needs. I did not need to support attachments, although it shouldn't be too difficult to modify my code to include them. Essentially, I created 2 classes: SMTPHelper and SMTPMessage. SMTPMessage contains the necessary property values used to send an email. Within BizTalk, I created a variable called smtpMessage of type BAJ.Utilities.SMTPMessage. Inside my orchestration, I placed the following code within an expression shape.
In my process, smtpServer, smtpFromAddress, and smtpFromName are all string variables whose values are stored as AppSettings. Here is the code for my SMTPHelper class: SMTPHelper.zip July 13 FTP, PGP, and MeSo let me break this down for you... Company A (Acme, Inc) wants to exchange data with Company C (Charlie Company). However, I represent Company B (BizTalk United) and we want to collect some of the data as well. A requirement has been made that all data will be transmitted using FTP and will also be encrypted. So, as the broker of the integration, I must resolve how to get data from point A to C and still be able to read the data myself. The solution:
Sounds simple enough once you get passed the PGP Pipeline Component. However, there is another interesting wrinkle in this process. Because both companies (A and C) want to prevent retrieving a file from the FTP server in mid-stream, they have decided to upload a 0 byte file immediately after posting the data file. The existence of the 0 byte file indicates the data file is ready for download. Once again, you can certainly update your FTP ReceiveLocation properties to only get the 0 byte files based on the proper mask, but how do you get the actual .pgp file from the FTP Server? Here is how I did it. Please let me know if you have any other recommendations or suggestions as I am always open to improvement. 1 - Download the 0 byte file (and PGP file) 2 - Decrypt the PGP file Note: This must be done within an Atomic scope. The Disassemble shape contains the following code:
The Decrypt File shape contains the following code:
And the Name File shape simply strips the ".pgp" from the filename. Now I have a decrypted version of the file. 3 - Re-Encrypt the decrypted file Note: This must be done within an Atomic scope. The Assemble File shape contains the following code:
The Name File shape simply appends the ".pgp" to the filename.
4 - Upload the Encrypted File (and 0 byte file) 5 - Process the data Sub-Topic: Oh crap, the decrypted file is empty
After banging my head against a brick wall for 2 days, I came up with a workaround (HACK) that accomplishes my goal. Instead of decrypting the file inside the orchestration, I am using a dynamic port along with the decrypt pipeline to create a physical version of the file in a temporary location. I then get the length of the file to determine my next steps.
Now I am able to proceed successfully. Once all files have been Decrypted, Encrypted, and transferred successfully, I delete the local copies from the hard drive. Of the many things I tried with unsuccessful results, this one still puzzles me as to why it didn't work. From what I can tell, once the EmptyPartException bell has been rung, you can't un-ring it. I used an exception handler to catch the Microsoft.XLANGs.BaseTypes.EmptyPartException. This error was only thrown if I reached a persistence point within my scope. In my exception handler, I attempted to reassign the decrypted message with either the initial receive message, and empty XmlDocument, a dummy XmlDocument, contents from another file, but regardless of how I tried to assign the value, once the error was raised, I couldn't get passed it. Again, please let me know if you see a better way of handling this, I am always looking for improvement. July 12 PGP Pipeline ComponentRecently I was required to perform some PGP encryption and decryption of files. Realizing this was going to require a custom Pipeline Component, off I went to Google to find one. Hey, why reinvent the wheel. I'm not certain why Microsoft didn't put one in place with the release of BTS 2006, but who am I to judge. :) The ones that kept popping up:
GnuPG Pro BizTalk 2006 Bouncy Castle Crypto Here is the code for the PGP Pipeline component. I did not distribute the necessary crypto.dll, so you will need to get it from Bouncy Castle. Remember, you will need to get the source in order to strongly name the assembly. [UPDATED - 7/27/2007] - I have updated the code and source with version 1.1. Link to readme.txt: readme.txt Notes:
Feedback welcomed. |
|
|||
|
|