Thursday, August 20, 2009

MIME Encoding in .Net

I was wondering if we can implement the MIME encoder and the MIME Decoder methods and properties in a class library and call it in Biztalk Orchestration.I am using Biztalk 2004.My scenario is that"
I have one encoded MIME File with 2 parts.
First Part is XML and the other is a PDF.
The XML Part which comes to me Encoded,i want to decode and send to my client.Now the PDF part which is also encoded text , i don't want to touch.So i want to used MIME encoder only to a partial part of my File(that is the XML part).Is this possible.Can anyone give me a alternate solution?



I was able to find a solution to my problem without using the adapter.
What i did was :
1.In a .net class library i was able to set the ContentTransferEncoding
Type 2.In the orchestration i used the class library to specify the contentTransferEncoding to my attachment part. 3.The attachment has to be an System.XML.XmlDocument.Otherwise this solution wont work. 4.I set the mime encoder in the send pipeline for the body part as "7 bit" and in the orchestration i set the attachment part of Type Base64.
5.This way i was able to generate a MIME file of 2 Content types I have here the .net code that i used for your reference and the code i
used in the orchestration.
.net Code ------------------------------------------- public class Part { public Part() { } public static void SetContentType(Microsoft.XLANGs.BaseTypes.XLANGPart part, string contentTypeValue) { part.SetPartProperty( typeof(Microsoft.XLANGs.BaseTypes.ContentType), contentTypeValue); } public static void SetContentTransferEncoding(Microsoft.XLANGs.BaseTypes.XLANGPart part,string ContentEncoding) { part.SetPartProperty( typeof(MIME.ContentTransferEncoding), ContentEncoding); } public static void SetFileName(Microsoft.XLANGs.BaseTypes.XLANGPart part, string fileName) { part.SetPartProperty( typeof(MIME.FileName), fileName); }
}
---------------------------------------------------------------
Orchestration Code ------------------------------
msgMultiResp.MultiPartMsgPDF=msgAttachment; MIMECustomise.Part.SetContentTransferEncoding(msgMultiResp.MultiPartMsgPDF,­­"Base64");
msgMultiResp(MIME.IsMultipartRelated)=true;
Note:This is a multipart message

No comments: