If you expand a VM and the Windows OS recognizes the new space as unallocated space, there is a quick fix:

Download a freeware program called Easeus Partition Master – http://download.cnet.com/Easeus-Partition-Master-Home-Edition/3000-2248_4-10863346.html?tag=mncol%3bpop&cdlPid=10982635.  Run this on the Windows VM and it should show 2 drives.  Highlight the one you want to expand, click on (expand/resize), drag divider out to full size of HD  and then “apply”. Reboot and it should be fine.

 

Okay, I admit it, I have never spent the time to learn the intricacies of Enterprise Single Sign On. I guess I had a hard time seeing the value when the only description I heard for quite a long time is that it is where BizTalk stores credentials.

I finally sat down and created a sample application that I could see would be useful.

I want to create a generic pipeline that interrogates the target namespace of the xml document in the decode stage, and applies a map. I actually have this requirement where I need to change the document into a different xml document that I can actually apply an envelope schema to.

<Rant>

I have always seen tutorials about how easy it is to create an envelope schema, reference a document schema and viola, BizTalk is splitting documents like crazy! I watched the podcasts, seen the demos eleventeen times and so I was tasked with doing it. I thought, hey, this is going to be easy!

NOT SO

This is a representation of what the order came in as

<orders xmlns="http://WebSiteVendor">
  <order>
    <Header>
      Stuff
    </Header>
    <Detail>
      Crap
    </Detail>
    <Details>
      Even More Crap
    </Details>
  </order>
  <order>
    <Header>
      More Stuff
    </Header>
    <Detail>
      Yes, Even More Crap
    </Detail>
    <Details>
      Hard to believe, but yes, More Crap
    </Details>
  </order>
</orders>

How am I supposed to create an envelope schema with a document node out of this type of document? I can’t go back to the Website Vendor and have them change it.

However, for the DASM, I require an xml document that looks like this:

<ns0:orders xmlns:ns0="http://WebSiteVendor">
  <ns1:order xmlns:ns1="http://WebSiteVendorOrder">
    <ns1:Header>
      Stuff
    </ns1:Header>
    <ns1:Detail>
      Crap
    </ns1 :D etail>
    <ns1:Detail>
      Even More Crap
    </ns1 :D etail>
  </ns1 :o rder>
  <ns1:order xmlns:ns1="http://WebSiteVendorOrder">
    <ns1:Header>
      More Stuff
    </ns1:Header>
    <ns1:Detail>
      Yes, Even More Crap
    </ns1 :D etail>
    <ns1:Detail>
      Hard to believe, but yes, More Crap
    </ns1 :D etail>
  </ns1 :o rder>
</ns0 :o rders>

Probably the worst thing is that a resolution (how to split this type of document up) has not been explained very well, if at all anywhere on the web.

</Rant>

After exploring all sorts of ways I can prep the data by removing name spaces, adding them back in, etc…, I started feeling like Thomas Edison. When Thomas Edison was interviewed by a young reporter who boldly asked Mr. Edison if he felt like a failure and if he thought he should just give up by now. Perplexed, Edison replied, “Young man, why would I feel like a failure? And why would I ever give up? I now know definitively over 9,000 ways that an electric light bulb will not work. Success is almost in my grasp.” And shortly after that, and over 10,000 attempts, Edison invented the light bulb.

Finally it dawned on me, that if I simply had a map that would execute in the Decode stage, I could then use the XML Disassembler to break up the ‘modified’ message into individual orders. I had created the envelope schema and imported the ‘document’ schema and made it a child.

Oddly enough, what is not terribly documented well is that the Body Xpath attribute needs to be pointing to the ‘parent’ of the document that you want to split up. (What is that about?)

So I looked around and voilà: there is a pipeline component in the SDK that does EXACTLY what I need. (SDK\Samples\Pipelines\XslTransformComponent)

So here is what I wanted to do:

  1. I wanted it to be on the receive side, in the decode stage.
  2. I wanted it to be dynamic so that if multiple messages came in, it would be able to figure out what the correct map was and invoke it.

So I decided that the SSO would be the perfect place to store the following key values:

Key Value
http://targetnamespace.com#node c:\{path}\map.xsl

Obvious, that this table would increase as more and more documents started to be processed by this splitting component.

The first thing I did was download the Enterprise Single Sign On application to allow you to put key value pairs in the SSO Database. You can download the SSO Configuration Application MMC Snap-In. When you install it, it creates a new menu in your Start Menu. You have to register it, but then you can start placing key value pairs.

I created an application called DecodeTransformations. and here is what my dictionary looks like:

image

So now I have to take the existing code and have it use ESSO to resolve the xslt instead of hard coding it in the properties of the pipeline.

As part of the download, Microsoft in their kindness, included sample code on how to retrieve values. You have to supply two values:

  1. Application Name (DecodeTransformations)
  2. Key ({targetnamespace})

I included the class and referenced it in the primary class. Instead of giving you bits and pieces, I am going to tell you what lines I modified, and then show the resulting code (so you can use it yourself).

  1. I  changed the property bag to get the SSOApplication (line 151)
  2. I commented out the code to ensure that there was value during build (line 248)
  3. Instead of loading the xsl first, I wanted to load the xml document up so I can determine what is its namespace. (line 91)
  4. I then determined what the document schema is it, by calling the ReturnTargetNamespace method. (line 94 –> 257)
  5. Now that I had the namespace, I then passed the Application in from the pipeline properties along with the targetnamespace to return the xsl path and returned the xsl path. (line 95)
  1: using System;
  2: using System.IO;
  3: using System.Xml;
  4: using System.Xml.Xsl;
  5: using System.Xml.Linq;
  6: using System.ComponentModel;
  7: using System.Collections;
  8: using Microsoft.BizTalk.Message.Interop;
  9: using Microsoft.BizTalk.Component.Interop;
 10: using Microsoft.Win32;
 11: using SSO.Utility;
 12:
 13: namespace Microsoft.BizTalk.SDKSamples.Pipelines.XslTransformComponent
 14: {
 15: 	/// <summary>
 16: 	/// Implements a pipeline component that applies Xsl Transformations to XML messages
 17: 	/// </summary>
 18: 	/// <remarks>
 19: 	/// XslTransformer class implements pipeline components that can be used in send pipelines
 20: 	/// to convert XML messages to HTML format for sending using SMTP transport. Component can
 21: 	/// be placed only in Encoding stage of send pipeline
 22: 	/// </remarks>
 23: 	[ComponentCategory(CategoryTypes.CATID_PipelineComponent)]
 24: 	[ComponentCategory(CategoryTypes.CATID_Decoder)]
 25: 	[System.Runtime.InteropServices.Guid("FA7F9C55-6E8E-4855-8DAC-FA1BC8A499E2")]
 26: 	public class XslTransformer		: Microsoft.BizTalk.Component.Interop.IBaseComponent,
 27: 									  Microsoft.BizTalk.Component.Interop.IComponent,
 28: 									  Microsoft.BizTalk.Component.Interop.IPersistPropertyBag,
 29: 									  Microsoft.BizTalk.Component.Interop.IComponentUI
 30: 	{
 31: 		#region IBaseComponent
 32: 		/// <summary>
 33: 		/// Name of the component.
 34: 		/// </summary>
 35: 		[Browsable(false)]
 36: 		public string Name
 37: 		{
 38: 			get {	return "XSL Transform Component";	}
 39: 		}
 40: 		/// <summary>
 41: 		/// Version of the component.
 42: 		/// </summary>
 43: 		[Browsable(false)]
 44: 		public string Version
 45: 		{
 46: 			get	{	return "1.0";	}
 47: 		}
 48: 		/// <summary>
 49: 		/// Description of the component.
 50: 		/// </summary>
 51:         [Browsable(false)]
 52:         public string Description
 53:         {
 54:             get { return "XSL Transform Pipeline Component"; }
 55:         }
 56: 		#endregion
 57: 		#region IComponent
 58: 		/// <summary>
 59: 		/// Implements IComponent.Execute method.
 60: 		/// </summary>
 61: 		/// <param name="pc">Pipeline context</param>
 62: 		/// <param name="inmsg">Input message.</param>
 63: 		/// <returns>Converted to HTML input message.</returns>
 64: 		/// <remarks>
 65: 		/// IComponent.Execute method is used to convert XML messages
 66: 		/// to HTML messages using provided Xslt file.
 67: 		/// It also sets the content type of the message part to be "text/html"
 68: 		/// which is necessary for client mail applications to correctly render
 69: 		/// the message
 70: 		/// </remarks>
 71: 		public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
 72: 		{
 73: 			inmsg.BodyPart.Data = TransformMessage(inmsg.BodyPart.Data);
 74: 			inmsg.BodyPart.ContentType = "text/html";
 75: 			return inmsg;
 76: 		}
 77: 		#endregion
 78: 		#region Helper function
 79: 		/// <summary>
 80: 		/// Transforms XML message in input stream to xml message
 81: 		/// </summary>
 82: 		/// <param name="stm">Stream with input XML message</param>
 83: 		/// <returns>Stream with output xml message</returns>
 84: 		private Stream TransformMessage(Stream stm)
 85: 		{
 86: 			MemoryStream ms = null;
 87: 			string validXsltPath = null;
 88: 			try
 89: 			{
 90: 				//Load Xml stream in XmlDocument.
 91: 				XmlDocument doc = new XmlDocument();
 92: 				doc.Load(stm);
 93:                 // Get the target name space
 94:                 string tns = ReturnTargetNamespace(doc);
 95:                 string xsltPath = SSOClientHelper.Read(this.SSOApplication, tns);
 96: 				// Get the full path to the Xslt file
 97: 				validXsltPath = GetValidXsltPath(xsltPath);
 98:                 //Create memory stream to hold transformed data.
 99:                 ms = new MemoryStream();
100: 				// Load transform
101: 				XslTransform transform = new XslTransform();
102: 				transform.Load(validXsltPath);
103: 				//Preform transform
104: 				transform.Transform(doc, null, ms, null);
105: 				ms.Seek(0, SeekOrigin.Begin);
106: 			}
107: 			catch(Exception e)
108: 			{
109: 				System.Diagnostics.Trace.WriteLine(e.Message);
110: 				System.Diagnostics.Trace.WriteLine(e.StackTrace);
111: 				throw e;
112: 			}
113: 			return ms;
114: 		}
115: 		/// <summary>
116: 		/// Get a valid full path to a Xslt file
117: 		/// </summary>
118: 		/// <param name="path">Path provided by user in Pipeline Designer</param>
119: 		/// <returns>The full path</returns>
120: 		/// <remarks>
121: 		/// If user provides absolute path then it is used as long as the file can be opened there
122: 		/// If user provides just a name of file or relative path then we try to open a file in 
123: 		/// [Install foder]\Pipeline Components
124: 		/// </remarks>
125: 		private string GetValidXsltPath(string path)
126: 		{
127: 			string validPath = path;
128: 			if (!System.IO.File.Exists(path))
129: 			{
130: 						RegistryKey rk = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\BizTalk Server\3.0");
131: 						string InstallPath = string.Empty;
132:
133: 						if (null != rk)
134: 					InstallPath = (String)rk.GetValue("InstallPath");
135:
136: 						validPath = InstallPath + @"Pipeline Components\" + path;
137: 				if (!System.IO.File.Exists(validPath))
138: 				{
139: 					throw new ArgumentException("The XSL transformation file " + path + " can not be found");
140: 				}
141: 			}
142: 			return validPath;
143: 		}
144: 		private string GetXSLPathFromSSO(string Application,string MessageType)
145: 		{
146: 			string MapName = SSOClientHelper.Read(Application, MessageType);
147: 			return MapName;
148: 		}
149: 		#endregion
150: 		#region IPersistPropertyBag
151: 		private string _SSOApplication;
152: 		public string SSOApplication
153: 		{
154: 			get { return _SSOApplication; }
155: 			set { _SSOApplication = value; }
156: 		}
157: 		/// <summary>
158: 		/// Gets class ID of component for usage from unmanaged code.
159: 		/// </summary>
160: 		/// <param name="classid">Class ID of the component.</param>
161: 		public void GetClassID(out Guid classid)
162: 		{
163: 			classid = new System.Guid("FA7F9C55-6E8E-4855-8DAC-FA1BC8A499E2");
164: 		}
165: 		/// <summary>
166: 		/// Not implemented.
167: 		/// </summary>
168: 		public void InitNew()
169: 		{
170: 		}
171: 		public void Load(Microsoft.BizTalk.Component.Interop.IPropertyBag pb, Int32 errlog)
172: 		{
173: 			string val = (string)ReadPropertyBag(pb, "SSOApplication");
174: 			if (val != null) SSOApplication = val;
175: 		}
176: 		/// <summary>
177: 		/// Saves the current component configuration into the property bag.
178: 		/// </summary>
179: 		/// <param name="pb">Configuration property bag.</param>
180: 		/// <param name="fClearDirty">Not used.</param>
181: 		/// <param name="fSaveAllProperties">Not used.</param>
182: 		public void Save(Microsoft.BizTalk.Component.Interop.IPropertyBag pb, Boolean fClearDirty, Boolean fSaveAllProperties)
183: 		{
184: 			object val = (object) SSOApplication;
185: 			WritePropertyBag(pb, "SSOApplication", val);
186: 		}
187: 		/// <summary>
188: 		/// Reads property value from property bag.
189: 		/// </summary>
190: 		/// <param name="pb">Property bag.</param>
191: 		/// <param name="propName">Name of property.</param>
192: 		/// <returns>Value of the property.</returns>
193: 		private static object ReadPropertyBag(Microsoft.BizTalk.Component.Interop.IPropertyBag pb, string propName)
194: 		{
195: 			object val = null;
196: 			try
197: 			{
198: 				pb.Read(propName,out val,0);
199: 			}
200: 			catch(System.ArgumentException)
201: 			{
202: 				return val;
203: 			}
204: 			catch(Exception ex)
205: 			{
206: 				throw new ApplicationException( ex.Message);
207: 			}
208: 			return val;
209: 		}
210: 		private static void WritePropertyBag(Microsoft.BizTalk.Component.Interop.IPropertyBag pb, string propName, object val)
211: 		{
212: 			try
213: 			{
214: 				pb.Write(propName, ref val);
215: 			}
216: 			catch(Exception ex)
217: 			{
218: 				throw new ApplicationException( ex.Message);
219: 			}
220: 		}
221: 		#endregion
222: 		#region IComponentUI
223: 		/// <summary>
224: 		/// Component icon to use in BizTalk Editor.
225: 		/// </summary>
226: 		[Browsable(false)]
227: 		public IntPtr Icon
228: 		{
229: 			get	{	return IntPtr.Zero;	}
230: 		}
231: 		/// <summary>
232: 		/// The Validate method is called by the BizTalk Editor during the build 
233: 		/// of a BizTalk project.
234: 		/// </summary>
235: 		/// <param name="obj">Project system.</param>
236: 		/// <returns>
237: 		/// A list of error and/or warning messages encounter during validation
238: 		/// of this component.
239: 		/// </returns>
240: 		public IEnumerator Validate(object projectSystem)
241: 		{
242: 			if (projectSystem==null)
243: 				throw new System.ArgumentNullException("No project system");
244: 			IEnumerator enumerator = null;
245: 			ArrayList   strList  = new ArrayList();
246: 			try
247: 			{
248: 				//GetValidXsltPath(SSOApplication);
249: 			}
250: 			catch(Exception e)
251: 			{
252: 				strList.Add(e.Message);
253: 				enumerator = strList.GetEnumerator();
254: 			}
255: 			return enumerator;
256: 		}
257:         private string ReturnTargetNamespace(XmlDocument xdoc)
258:         {
259:             XmlNodeReader xmlndRdr = new XmlNodeReader(xdoc);
260:             string TargetNamespace = XElement.Load(xmlndRdr).GetDefaultNamespace().ToString();
261:             TargetNamespace = TargetNamespace + "#" + xdoc.DocumentElement.Name;
262:             return TargetNamespace;
263:         }
264: 		#endregion
265: 	}
266: }
267: 

Once that is completed, simply place the dll in the pipeline components folder.

I created the pipeline that has the XSLTransform pipeline component and the XML Disassembler pipeline component and it works like a charm!

Now I can use the same component in multiple locations and can receive multiple messages in the same location and based on the application deployed to SSO, it will resolve where the xsl lives and transform it. Unlike the ESB dispatcher pipeline component, I actually don’t even need to deploy the map, I simply need to place it somewhere and I am ready to go.

Here is what the pipeline looks like

image

 

So I created a script that created a silent install of BizTalk from a server that had SQL server installed to having BizTalk, UDDI, and ESB installed. I figured I was pretty ‘tricky’ by using the dot as the database server name.

However, when I went to deploy a rule from within the Business Rule Engine, I received the following error: Error Message: The database “.:BizTalkRuleEngineDb” associated with the deployment driver does not match the database “.:BizTalkRuleEngineDb” specified during product configuration

I looked over a few blog entries, where the registry needed to be altered:

Open the Registry Editor (regedit) and locate the following key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\BusinessRules\3.0

If you have installed the rule processing components on a 64-bit version of Windows, they key will be at:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\BusinessRules\3.0

Change the following keys DeploymentDriverAssembly and DeploymentDriverClass values under the key.  

    Microsoft.BizTalk.RuleEngineExtensions, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35    

Microsoft.RuleEngine.RuleSetDeploymentDriver

NADA

The ultimate solution was to go into the adm_Group table and change the server name

image

There are two other databases that also refer the DB Server for the rules engine:

  1. adm_OtherDatabases
  2. adm_OtherBackupDatabases

Don’t bother changing them;it does not matter.

Once I made that single entry, I could deploy policies again.

 

“Total Satisfaction Return Policy”

Total Satisfaction

I was in need of a second power adapter for my laptop, a couple of days ago I went into Best Buy and they immediately told me, that for high end laptops, I really should contact the manufacturer to get the proper adapter, as any variation in wattage/voltage could potentially ruin the motherboard.

So I called up Alienware to order a second adapter for my Alienware laptop. Alienware was purchased by Dell, so I was directed to Dell Sales to make the purchase. I gave them my information they confirmed that I had a Alienware M15X, and told them I wanted a second power adapter. They were happy to take my credit card and for a price, shipped it as fast as they could to me.

Today I received the package. I did not think much to open it up and look at it, until my son kept bugging me to open it up. The shape of the converter was much smaller, and so I thought, great, less load on my back as I travel!

However just by looking at it, I noticed that this adapter was not going to work for me:

Adapter

This should be a breeze, Dell has documented taking great strides to improve customer support:

In 2006, Dell acknowledged that it had problems with customer service. Issues included call-transfers[76] of more than 45% of calls and long wait-times.Dell’s blog detailed the response: “We’re spending more than a $100 million — and a lot of blood, sweat and tears of talented people — to fix this.”[77]Later in the year, the company increased its spending on customer service to $150 million.[78]

I called up Alienware support at 6:30pm and told them my situation. Technical support listened to my story and said, that they could not help me and that they would transfer me to customer support. “okay” I thought: they would be able to resolve this situation, it was a mistake, they can send me the correct adapter and give me a return slip for this one that doesn’t work. I then talked to someone at customer service, and they stated that the adapter that was sent to me was for the second generation M15X and that I owned the first generation M15X. WHAT!”  Didn’t I call up Dell (who now owns Alienware) who confirmed with me my computer in their system and sent me the correct adapter?!

They then told me that they could not help me with exchanging this, as this order was generated in the sales department, and only they could rectify the problem. They then transferred me to sales.

Sales then listened to me explain: AGAIN the issue and then said that they could not help me, that I was talking to Dell Sales, and I needed to talk to Alienware, and gave me Alienwares phone number. I told them that the number they had just given me was the number I had called. I asked repeatedly to be transferred to this person’s manager, as I wanted to talk to someone who could help me. He then told me that his manager was on a call. “Fine, I will sit on the phone and listen to you breath until your manager gets off the phone to talk to me” He then proceeded to tell me that he gets paid based on how many calls he gets in a shift and that they manager was taking calls!

I told him, that I knew that, I had once upon a long time ago, worked in a call center myself, but I needed to talk to someone that could help me and follow this issue through to completion. He then told me that he could not help me and that the only people that could help me was customer support, and that the only thing he could do was transfer me.

He then transferred me to customer support. The time was 7:35 MST, which is 9:35 EST. By this time customer support is closed.

So I am here with a power chord that doesn’t fit my computer, that I paid handsomely to get, and NO ONE AT DELL/ALIENWARE can help me with.

Does anyone have any hints at who can help me? I don’t have 3 hours per day to dedicate to this, is there a customer advocate at Dell/Alienware that can champion an issue like this through the maze that Michael Dell has put in place to ensure no return customers (at least not me now), all in the name of Total Satisfaction?

 
  • click start, select run
  • type ‘gpedit.msc’ and hit enter
  • select ‘local computer policy’
  • select ‘computer configuration’
  • select ‘administrative templates’
  • select ‘system’
  • change the value of ‘display shutdown even tracker’ to ‘disabled’
 

While testing a new service I was creating on my BizTalk development machine, I wanted to test the service using the WCF Test Client.
However, when I brought up the tool, I was shown all of the adapters that are created for the WCF LOB adapters: SAP/SQL/ and the two Oracle adapters.
You can comment out the adapters so you don’t see the red x’s in the the tool

InstalledAdapters

By going into the machine.config in the (for me) C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config folder and commenting the endpoint from the client section

<client>
      <endpoint binding="sqlBinding" contract="IMetadataExchange" name="mssql"/>
      <metadata>...
      </metadata>
</client>

to

<client>
      <!--<endpoint binding="sqlBinding" contract="IMetadataExchange" name="mssql"/>-->
      <metadata>...
      </metadata>
</client>

I don’t see the the red x, however, if you don’t have the required assemblies (Oracle, SAP, etc) the tool will close automatically without giving you any results.

Lesson learned: only install the adapters that you will be connecting to, otherwise, the WCF Test Client Tool will close miserably.

 

According to http://msdn.microsoft.com/en-us/library/bb552364.aspx

You can find the WCF Test Client (WcfTestClient.exe) in the following location: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\

If you have Visual Studio 2010 installed on a 64bit OS, it is found here:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\WcfTestClient.exe

 

Error: 1 (Field level error)
SegmentID: CLM
Position in TS: 22
Data Element ID: CLM02__TotalClaimChargeAmount
Position in Segment: 2
Data Value: 8888.99
6: Invalid character in data element

This can be resolved by changing the party definition to allow leading and trailing spaces and zeros.

image

and

image

 

I deal quite a lot with AS2 and BizTalk.  I sometimes lose track of the different types of files when dealing with the certificates.  I found a nice description of all the file types and a nice little converter online.

Here is the good description:

PEM Format
The PEM format is the most common format that Certificate Authorities issue certificates in. PEM certificates usually have extentions such as .pem, .crt, .cer, and .key. They are Base64 encoded ASCII files and contain “—–BEGIN CERTIFICATE—–” and “—–END CERTIFICATE—–” statements. Server certificates, intermediate certificates, and private keys can all be put into the PEM format.

Apache and other similar servers use PEM format certificates. Several PEM certificates, and even the private key, can be included in one file, one below the other, but most platforms, such as Apache, expect the certificates and private key to be in separate files.

DER Format
The DER format is simply a binary form of a certificate instead of the ASCII PEM format. It sometimes has a file extension of .der but it often has a file extension of .cer so the only way to tell the difference between a DER .cer file and a PEM .cer file is to open it in a text editor and look for the BEGIN/END statements. All types of certificates and private keys can be encoded in DER format. DER is typically used with Java platforms. The SSL Converter can only convert certificates to DER format. If you need to convert a private key to DER, please use the OpenSSL commands on this page.

PKCS#7/P7B Format
The PKCS#7 or P7B format is usually stored in Base64 ASCII format and has a file extention of .p7b or .p7c. P7B certificates contain “—–BEGIN PKCS7—–” and “—–END PKCS7—–” statements. A P7B file only contains certificates and chain certificates, not the private key. Several platforms support P7B files including Microsoft Windows and Java Tomcat.

PKCS#12/PFX Format
The PKCS#12 or PFX format is a binary format for storing the server certificate, any intermediate certificates, and the private key in one encryptable file. PFX files usually have extensions such as .pfx and .p12. PFX files are typically used on Windows machines to import and export certificates and private keys.

When converting a PFX file to PEM format, OpenSSL will put all the certificates and the private key into a single file. You will need to open the file in a text editor and copy each certificate and private key (including the BEGIN/END statments) to its own individual text file and save them as certificate.cer, CACert.cer, and privateKey.key respectively.

OpenSSL Commands to Convert SSL Certificates on Your Machine
It is highly recommended that you convert to and from .pfx files on your own machine using OpenSSL so you can keep the private key there. Use the following OpenSSL commands to convert SSL certificate to different formats on your own machine:

OpenSSL Convert PEM
Convert PEM to DER

openssl x509 -outform der -in certificate.pem -out certificate.der

Convert PEM to P7B

openssl crl2pkcs7 -nocrl -certfile certificate.cer -out certificate.p7b -certfile CACert.cer

Convert PEM to PFX

openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt

OpenSSL Convert DER
Convert DER to PEM

openssl x509 -inform der -in certificate.cer -out certificate.pem

OpenSSL Convert P7B
Convert P7B to PEM

openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer

Convert P7B to PFX

openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer

openssl pkcs12 -export -in certificate.cer -inkey privateKey.key -out certificate.pfx -certfile CACert.cer

OpenSSL Convert PFX
Convert PFX to PEM

openssl pkcs12 -in certificate.pfx -out certificate.cer –nodes

Here is their little certificate converter:

https://www.sslshopper.com/ssl-converter.html

 

I had a requirement to consume .PDFs and attach all of them that arrived within 30 minutes to an email with the PDFs as attachments.  I created a multi part message that I named msg_Email of type System.Xml.XmlDocument.  I created the message using a Construct Message shape.  I then loaded the body of the message using the .LoadXML() method.  I then used a helper class named EmailAttacher to attach the new messages needing to be attachments to the existing multi part email message.  Here is the helper class code.

namespace EmailAttacher
{
    public class MessageHelper
    {
        public static void AddAttachment(XLANGMessage destination, XLANGMessage attachment, string filename)
        {
            try
            {
                int count = destination.Count;
                destination.AddPart(attachment[0], string.Format(“Attachment_{0}”, count));
                destination[count].SetPartProperty(typeof(MIME.FileName), filename);
            }
            finally
            {
                //decrement reference count
                destination.Dispose();
                attachment.Dispose();
            }
        }

}

The message assignment shape has the following code to add the newest message to the existing message.

EmailAttacher.MessageHelper.AddAttachment(msg_Email, msg_ToAddAsAttachment,”NameOfAttachedFile”);

Don’t forget to add this, to ensure all message parts that aren’t the body are attachments.

msg_Email(SMTP.MessagePartsAttachments) = 2;

© 2012 BizTalk Blog Suffusion theme by Sayontan Sinha