tag:blogger.com,1999:blog-78894232024-03-07T23:18:18.220+02:00BizTalkers (Tareq Ali)Sharing BizTalk 2004,2006 ExprienceTareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.comBlogger54125tag:blogger.com,1999:blog-7889423.post-38578077066358492482008-08-24T13:43:00.002+03:002008-08-24T13:47:39.641+03:00SQL Server 2008 has been releasedI noticed that I can download SQL Server 2008 from my MSDN subscription section, I saw the following edition:<br />SQL Server 2008 Developer<br />SQL Server 2008 Enterprise<br />SQL Server 2008 Workgroup<br />and<br />SQL Server 2008 Web<br /><br /><strong>Web edition</strong> seems to be new in this release, here is the descirption:<br />SQL Server 2008 Web is a low total-cost-of-ownership option for Web hosters and Web sites that provide scalability and manageability capabilities for small to large scale Web propertiesTareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.comtag:blogger.com,1999:blog-7889423.post-79973323722453314022008-04-26T16:54:00.005+03:002008-04-27T10:28:45.908+03:00Subscriptions ViewerSubscription Viewer was a very useful utility that was installed in the BizTalk installation folder to see the subscriptions. In Biztalk 2006 you can see the susbcriptions in the BizTalk using the Administration Console.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-w-37ZLDt_GCcIE3F6Lnb0wC0s_cEK7RZLW_j5wY7xCaCosFaIDLzcynwyRqlQBqRsAVJjT6CzvTNaeKjUuBXx4pUoGaKSoEfi3b7NgdPqnmHdR58tKEQqWn-LIPgphJ4asR1sg/s1600-h/Subscriptions.jpg"><img id="BLOGGER_PHOTO_ID_5193552898316105874" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-w-37ZLDt_GCcIE3F6Lnb0wC0s_cEK7RZLW_j5wY7xCaCosFaIDLzcynwyRqlQBqRsAVJjT6CzvTNaeKjUuBXx4pUoGaKSoEfi3b7NgdPqnmHdR58tKEQqWn-LIPgphJ4asR1sg/s320/Subscriptions.jpg" border="0" /></a><br />Double click on the subscription to subscription detials.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsNloNMJtFgDaa4Gzr4MPsfdZSjVGNb5b6kE0Mg_lFASytKWHnKpepxjGXd2RGM1P4zD1ixCXy-Bps1BSdknIovVZb4WSAfY_mdDdOEZHutcxE2rH8q8JQyaXtr0Z4o-6nWPgIzQ/s1600-h/Subscriptions-Dialog.jpg"><img id="BLOGGER_PHOTO_ID_5193553138834274466" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsNloNMJtFgDaa4Gzr4MPsfdZSjVGNb5b6kE0Mg_lFASytKWHnKpepxjGXd2RGM1P4zD1ixCXy-Bps1BSdknIovVZb4WSAfY_mdDdOEZHutcxE2rH8q8JQyaXtr0Z4o-6nWPgIzQ/s320/Subscriptions-Dialog.jpg" border="0" /></a>Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.comtag:blogger.com,1999:blog-7889423.post-55863084864734804502008-04-26T16:11:00.009+03:002008-05-07T22:43:16.073+03:00Some good interview questions: local-name function - Persistance Points in Orchestration<p class="MsoNormal" dir="ltr" style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left"><strong>Why do we need to use the local-name function in our XPath expressions?<br /></strong><br />"local-name" function returns the node name in XML Document ignoring the namespace, for example the following XPath expression should fail if the xml document has namespace prefix:<br /><br />/Order/OrderID<br /><br />But this will never fail.<br />/*[local-name()=’Order’]/* [local-name()=’OrderID’]<br /><br /><strong>What is the problem with the above approach?<br /></strong><br />We are ignoring the namespace completely which is not correct, we have sovled the problem by introducing a new one.<br />To overcome this we should include the namespace in the above expression as follows:<br />/*[local-name()='Order' and namespace-uri()='http://namespace']/*[local-name()='OrderID' and namespace-uri()='']<br /><br /><br /><br />Sample Data:</p><p class="MsoNormal" dir="ltr" style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnMEccjn2sQREVZyakt53Oqt-eGHrc56ebl9gUODKhGW5-dp1eIC-WO8uPYCnEOs16vfmMYHsXXEsx0iuW2oLkSUlEoRj6CwQglW-aHTLp8hw-eDjfxFXyRSRp_wWj6HFEXLQ6mQ/s1600-h/Data.jpg"><img id="BLOGGER_PHOTO_ID_5193577091866884274" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnMEccjn2sQREVZyakt53Oqt-eGHrc56ebl9gUODKhGW5-dp1eIC-WO8uPYCnEOs16vfmMYHsXXEsx0iuW2oLkSUlEoRj6CwQglW-aHTLp8hw-eDjfxFXyRSRp_wWj6HFEXLQ6mQ/s320/Data.jpg" border="0" /></a></p><p class="MsoNormal" dir="ltr" style="DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left">Notice the use of the prefix in the above sample date, we have prefix "nso" this prevent using the simple XPath expression mentioned above without using the local-name<br /></p>Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.comtag:blogger.com,1999:blog-7889423.post-26455770407677816962008-04-26T12:28:00.005+03:002008-04-26T14:33:45.761+03:00BizTalk Naming ConventionsI have been through the <a href="http://www.traceofthought.net/misc/BizTalk%20Naming%20Conventions.htm">BizTalk Naming conversions</a>, I think this is a good starting point. However, I don't agree with using Hungarian notation in orchestration shapes as well as using underscore.<br />For example: <span style="color:#ff0000;">Scope_</span>CreditServiceCall, <span style="color:#ff0000;">Rcv_</span>rawCreditReport<br /><br />My reasons are:<br /><br />1- It doesn't follow the same standard in the first section named "BizTalk Messaging Artifacts"<br />2- Microsoft doesn't recommend using Hungarian notation in .NET coding standard.<br />3- If you see list of orchestration objects in a tree it will be difficult to find the object if you have a big list.Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.comtag:blogger.com,1999:blog-7889423.post-28672478903551285712007-01-14T20:57:00.001+02:002008-04-27T10:48:11.472+03:00SQL Server Adaptor Ignores TimeOut PropertyIf you tried to increase the timeout in you SQL Server Port, it will not be saved in the connection string. A workaround is to edit the connection string manually in the property pane (don't open the connection property dialog).<br /> You need to change it everytime you change the adaptor settings<br /><br /><strong>;Connect Timeout=500;</strong><br /><p></p><p><img id="BLOGGER_PHOTO_ID_5019964835759250754" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaWWbdOC91bPytsCF93pznOe5jdBj5m9xwLjwiDzAEU3xC2bxte7DXavAHUt0j0Ix4cUV83hoX1Y_lzu1YFSoOW89IxjwjGcqst76Fg1bnjItxZMTrLTQYyPSavT8V0MC9ZE-v9Q/s320/ConnectionString.JPG" border="0" /><br /></p>Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.comtag:blogger.com,1999:blog-7889423.post-76943888163054861362006-12-25T23:11:00.000+02:002007-01-03T01:12:01.848+02:00UnZip Pipeline components A2Z<p>I have read this blog <a href="http://www.codeproject.com/biztalk/btsunzipdisassembler.asp">entry </a>which is good start for anyone interested in writing UnZip pipeline component for BizTalk, but when you try the code you notice it doesn't work because the code doesn't promote the properties to the newly created messages. When you read the comments, you can find that you need to add some code. This is not only the issue, I'm going to discuss all issues and solutions here.</p><p>My Pipeline does the following (more on that later):</p><p>1. Promotes the Message Type context Property based on the Pipeline properties.</p><p>2. Handle directories in zip file (all files are extracted from zip file even if it is inside any folder)</p><p>3. Reader the stream in the proper way (the articles code doesn't work actually, and I got an exception).</p><p>4. Handle Password for zip files (A property in Pipeline)</p><p></p><p><br />public void Disassemble(Microsoft.BizTalk.Component.Interop.IPipelineContext pc, Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg)<br />{<br />Stream strmZipFile;<br />IBaseMessagePart msgPart;<br />msgPart = inmsg.BodyPart;<br />strmZipFile = msgPart.GetOriginalDataStream();<br />ZipInputStream oZipStream = new ZipInputStream(strmZipFile);<br />if (!string.IsNullOrEmpty(mPassword))<br />oZipStream.Password = mPassword;<br />try<br />{<br />ZipEntry sEntry = oZipStream.GetNextEntry();<br />while (sEntry != null )<br />{<br />if (sEntry.IsDirectory)<br />{<br />sEntry = oZipStream.GetNextEntry();<br />continue;<br />}<br />MemoryStream strmMem = new MemoryStream();<br />byte[] buffer = new byte[4096];<br />int count = 0;<br />while ((count = oZipStream.Read(buffer, 0, buffer.Length)) != 0)<br />strmMem.Write(buffer, 0, count);<br />strmMem.Seek(0, SeekOrigin.Begin);<br />msgPart.Data = strmMem;<br />IBaseMessage outMsg;<br />outMsg = pc.GetMessageFactory().CreateMessage();<br />outMsg.AddPart("Body", pc.GetMessageFactory().CreateMessagePart(), true);<br />outMsg.BodyPart.Data = strmMem;<br />for (int iProp = 0; iProp < inmsg.Context.CountProperties; iProp++)<br />{<br />string strName;<br />string strNSpace;<br />object val = inmsg.Context.ReadAt(iProp, out strName, out strNSpace);<br />// If the property has been promoted, respect the settings<br />if (inmsg.Context.IsPromoted(strName, strNSpace))<br />outMsg.Context.Promote(strName, strNSpace, val);<br />else<br />outMsg.Context.Write(strName, strNSpace, val);<br />}<br />if (this.Namespace != null && this.RootElementName != null)<br />{<br />string messageType = string.Format("{0}#{1}", this.Namespace, this.RootElementName);<br />outMsg.Context.Promote("MessageType", "http://schemas.microsoft.com/BizTalk/2003/system-properties", messageType);<br />}<br />_msgs.Enqueue(outMsg);<br />sEntry = oZipStream.GetNextEntry();<br />}<br />}<br />catch (Exception ex)<br />{<br />Debug.Write(ex.Message + Environment.NewLine + ex.StackTrace);<br />throw;<br />}</p><p>You notice that I have two property "Namespace" and RootElementName, I use it to promote "MessageType" property, the author suggests to load xml document to get the message type, which is not a good idea for large message, so I have created those two properties. This means that all messages come out of the pipeline will have same type and root element (your zip file will contains same message types, not bad limitation). </p><p>Note: </p><p>- I will write a version to use XmlReader to get the message Namespace and Root Element.</p><p>- We also copy the original message context to each newly created message (this code comes from the author feedback in the code project)<br /><br />His code to read and write the stream doesn't work and I got the following exception from "Invalid offset/count combination", I changed the way we read/write the stream and it is working fine now.<br /><br /><br />Last issue to discuss is: what if you have a message that contains envelope and you want to execute the XmlDisassemble pipeline component after running the Unzip pipeline. You can't do that because the Disassemble stage only allows one components to be run (first match).<br /><br />There is a workaround, you can move unzip code to the Decode stage, but you will have a limitation, your zip file should contain one message only, because the decode stage receives single message and outputs single message. You can find a complete sample in Pro BizTalk book, if you don't have the book, don't panic, download the book code samples from <a href="http://www.apress.com/book/supplementDownload.html?bID=10168&sID=3913">apress </a>site.<br /><br /><a href="http://www.geocities.com/tarek_mohammed_eg/UnzipDisassemblerPipeline.zip">Download Source Code</a><br /><br /></p>Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.comtag:blogger.com,1999:blog-7889423.post-1166380335577577932006-12-17T20:27:00.000+02:002006-12-17T21:13:38.256+02:00Custom Pipeline Components in BizTalk 2006 Best Practise1. You will find a lot of people talking about create custom pipelines.<br />2. Read Stephen comment on <a href="http://geekswithblogs.net/sthomas/archive/2006/09/27/92513.aspx">using Custom pipeline<br /></a>3. To add you pipeline to the MSI package:<br />A. Deploy you BizTalk project<br />B. Open BizTalk Admin Console (BTSmmc.msc)<br />C. Open Resources node and Add you new "Add new resources" context menu.<br />D. Check 'Add to Global Assembly Cache on MSI Import'<br /><br /><br /><img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/x/blogger/5308/508/320/183155/Pipeline.jpg" border="0" />Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.comtag:blogger.com,1999:blog-7889423.post-1166361923052957902006-12-17T14:38:00.000+02:002006-12-17T15:32:03.020+02:00BizTalk XmlNamespace Resolver PipelineNamespaces in BizTalk is an essential part of the input documents, although, BizTalk can deal with messages without namespaces, it is not the best practice.<br />Suppose you have an incoming xml message without a namespace and it may have some processing instructions or doctype .<br />The following disassemble pipeline does that clean up and add the namespace to the incoming document.<br />When you complete and deploy your custom pipeline component, you need to add new custom pipeline in your BizTalk Project, and then set the namespace preopery.<br />All messages pass thorough this pipeline will have the same namespace and it will be cleaned up from any processing instructions.<br /><br /><br />Note:<br />I recommend read this article (<a href="http://www.codeproject.com/biztalk/btsunzipdisassembler.asp">UnzipDisassembler - A custom pipeline component for BizTalk Server 2004</a>).Then use <a href="http://www.gotdotnet.com/workspaces/workspace.aspx?id=1d4f7d6b-7d27-4f05-a8ee-48cfcd5abf4a">BizTalk Server Pipeline Component Wizard</a> in the disassemble method, just copy and past that code, you will need to define a preoperty of name 'Namesapce' during the new pipline component wizard.<br />I will not write a complete steps, the important thing here is dealing with streams in the disassemble method.<br /><br /><br /> public void Disassemble(Microsoft.BizTalk.Component.Interop.IPipelineContext pc, Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg)<br /> {<br /> XmlAttribute namespaceAttribute;<br /> string rootNodeName;<br /> XmlDocument originalXmlDocument;<br /> XmlDocument newXmlDocment;<br /> MemoryStream memStream;<br /> byte[] data;<br /><br /><br /> originalXmlDocument = new XmlDocument();<br /> originalXmlDocument.XmlResolver = null;<br /><br /> originalXmlDocument.Load(inmsg.BodyPart.GetOriginalDataStream());<br /> <br /> // This not bad in case of small message size.<br /> newXmlDocment = new XmlDocument();<br /> newXmlDocment.LoadXml(originalXmlDocument.DocumentElement.OuterXml);<br /> namespaceAttribute = newXmlDocment.CreateAttribute("xmlns");<br /> <br /> // That is not accurate, User should specify the root node or we read that information from the schema.<br /> rootNodeName = newXmlDocment.FirstChild.Name;<br /> namespaceAttribute.Value = mNamespace ;<br /> newXmlDocment.DocumentElement.Attributes.Append(namespaceAttribute);<br /><br /> inmsg.RemovePart("Body");<br /> inmsg.AddPart("Body", pc.GetMessageFactory().CreateMessagePart(), true);<br /> <br /><br /> memStream = new MemoryStream();<br /> // what about UTF16 messages?<br /> data = UTF8Encoding.UTF8.GetBytes(newXmlDocment.OuterXml);<br /> memStream.Write(data, 0, data.Length);<br /> memStream.Seek(0, SeekOrigin.Begin);<br /> inmsg.BodyPart.Data = memStream;<br /> inmsg.BodyPart.ContentType = "xml";<br /> inmsg.Context.Promote("MessageType", "http://schemas.microsoft.com/BizTalk/2003/system-properties", mNamespace + "#" + rootNodeName);<br /><br /> _msgs.Enqueue(inmsg);<br /> }Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.comtag:blogger.com,1999:blog-7889423.post-1150499020239568112006-06-17T01:53:00.000+03:002006-06-17T02:07:01.826+03:00Visual Build ProfessionalCurrently, I'm developing a SOA application where we have a lot of projects, the main challenge was to build good CM (Configuration management) strategy.<br />We wrote a lot of scripts to follow continues integration guideline from Martin Folwer (nightly build, create distributed application, notify our client about a new build, upload to FTP , etc.)<br />We put a lot of effort into that scripts and we are in very good shape now, but today, I find this tool, <a href="http://www.kinook.com/VisBuildPro/">Visual Build Professional </a>, which I think it would have saved a lot of time for me.<br />anyway, I got an evaluation version, I will play with it and I will publish my feedback soon.<br /><br /><br /><a href="http://www.kinook.com/VisBuildPro/screenshots.html"><img style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://www.kinook.com/VisBuildPro/Screenshots/Main_small.jpg" border="0" /></a>Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.comtag:blogger.com,1999:blog-7889423.post-1150497731336752382006-06-17T01:29:00.000+03:002006-06-17T01:46:38.433+03:00VS 2005 Web Application Project - BizTalk Publishing Wizard<a href="http://msdn.microsoft.com/asp.net/reference/infrastructure/wap/default.aspx">VS 2005 Web Application Project</a> has been release, I like it so much. It replaces web application templates in VS.NET 2005 so that we can use the old build model (which I like).<br />BizTalk publishing Wizard uses the new project model for generated web services (i.e. No project file is there, just solution file). I don't like this approach.<br />Today, I have tried to create a new project (Web Service project) using vs.net 2005 Web Application Project and I sucessfully move the generated code to it.<br />I was able to test my receive location againts the newly created web services.<br />See the picture below so you can image what could be done (Just copying the files to the new project, but take care of the directory structure).<br /><br /><img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/5308/508/400/BizTalk%202006%20PublishWizard.jpg" border="0" />Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.comtag:blogger.com,1999:blog-7889423.post-1150461907320813702006-06-16T15:39:00.000+03:002006-06-16T15:45:07.320+03:00BizTalk 2004/2006 and Visual Source SafeNow every one can use Source Safe 2005 to store (Map, Schemas, etc.). In VSS 6.0 we used to tell VSS to deal with biztalk files as binary, becuase VSS wouldn't have understood the unicode files, that is good news.<br />An idea comes to my mind, what about developing visualizer to compare biztalk maps and orchestration, so you can see the dif. instead of tracking the xml files.Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.comtag:blogger.com,1999:blog-7889423.post-1147515205354922242006-05-13T13:12:00.000+03:002006-06-16T14:44:58.166+03:00Custom Trace Listener (Debug) for EntLibWhy reinvent the wheel and create this custom trace listner?<br />The current custom trace listerner in the documentation uses debug .write, which doesn't work in the "release" mode.<br />I would like to show trace message to debugview even in release mode.<br />OutputDebugString do the magic, see the code below<br />using System;<br />using System.Collections.Generic;<br />using System.Text;<br />using System.Diagnostics;<br />using System.Runtime.InteropServices;<br />using Microsoft.Practices.EnterpriseLibrary.Common<br /> .Configuration;<br />using Microsoft.Practices.EnterpriseLibrary.Logging<br /> .Configuration;<br />using Microsoft.Practices.EnterpriseLibrary.<br /> Logging;<br /><br /><br />namespace TareqCo.Framework.Logging<br />{<br /> [ConfigurationElementType<br /> (typeof(CustomTraceListenerData))]<br /> public class DebugTraceListener:Microsoft.Practices.<br />EnterpriseLibrary.Logging.TraceListeners.CustomTraceListener<br /> {<br /> [DllImport("kernel32.dll", SetLastError = true)]<br /> public static extern void OutputDebugStringA<br /> (string message);<br /><br /> public override void TraceData(TraceEventCache eventCache,<br /> string source, TraceEventType eventType, int id,<br /> object data)<br /> {<br /> if (data is LogEntry && this.Formatter != null)<br /> {<br /> this.WriteLine(this.Formatter.Format(data as<br /> LogEntry));<br /> }<br /> else<br /> {<br /> this.WriteLine(data.ToString());<br /> }<br /> }<br /><br /> public override void Write(string message)<br /> {<br /> OutputDebugStringA(message);<br /> }<br /><br /> public override void WriteLine(string message)<br /> {<br /> OutputDebugStringA(message);<br /> }<br /><br /> }<br />}Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.comtag:blogger.com,1999:blog-7889423.post-1147511165135153232006-05-13T11:58:00.001+03:002008-04-26T14:25:13.384+03:00All you need to know about GenericsI'm fan of Generics and I used it immediately when it is released, It reduced our amount of code so much<br />Join our Group Of Experts @ http://url123.com/27gd6<br />Find articles and tutorials @ http://url123.com/2shdd<br />Learn about Generic collections @ http://url123.com/27rdu<br />Read an extensive introduction @ http://url123.com/2swdy<br />Read about the pros and cons @ http://url123.com/2s5d3<br />Good book<br /><a href="http://www.amazon.com/gp/product/0764559885/ref=ase_strongtypesco-20/102-7309368-9133757?s=books&v=glance&n=283155&tagActionCode=strongtypesco-20">Professional .NET 2.0 Generics</a><br /><br />Good Luck all of you...Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.comtag:blogger.com,1999:blog-7889423.post-1120725119520655922005-07-07T11:31:00.000+03:002006-06-17T02:09:06.363+03:00SourceSafe Binding Remover (VS 2003 only)Very good tool:<br />Removes all SourceSafe bindings from a selected folder, including subfolders. It displays the file names, and won't delete unless the checkbox is checked so you can see if any important files would be deleted. There is no option to selectively remove files from the list to be deleted. SourceSafe bindings are plain text files ending in scc, either .scc or .vssscc, but the pattern matches any file with an extension ending in *scc. You can change the pattern match in the application config file (need to include the * for wildcard matches).<br /><br />http://www.gotdotnet.com/workspaces/workspace.aspx?id=05b9332b-3b4a-4239-be2f-2a0f86f9ce71Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.com2tag:blogger.com,1999:blog-7889423.post-1120329301440249772005-07-02T21:33:00.000+03:002005-07-02T21:35:01.440+03:00One of the best books I have ever read<a href="http://www.amazon.com/exec/obidos/ASIN/0596007620/qid=1120329246/sr=2-2/ref=pd_bbs_b_2_2/103-1074266-7614258">Programming .NET Components, Second Edition</a>Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.com0tag:blogger.com,1999:blog-7889423.post-1120327810839741562005-07-02T21:05:00.000+03:002006-08-07T11:30:05.763+03:00BizTalk MSMQ AdaptorNobody can admit that MSMQ is a key tool in SOA, so Microsoft comes up with a <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=CBA87D07-7F50-4D7B-A888-388D123F736E&displaylang=en">new adaptor</a>, stable and easy to use adaptor.<br /><br />To test this adaptor, do the following:<br />1.<br />Create a new Queue Name "myQueue", make sure that BizTalk can read messages from this queue. i.e. make sure that the windows account used for BizTalk services has sufficient permission to read from the queue.<br />2.<br />Create a new class that will be serialized and passed to MSMQ, any application can create instance from this class, sets it properties and send it to MSMQ, then you can pick it up using MSMQ adaptor.<br />Note: this class should be placed in a common assembly that can be shared between all other applications.<br /><br />using System.Xml.Serialization;<br /><br />/// <summary><br />/// Reperests a message to be send to MSMQ and picked up BizTalk orchestration.<br />/// </summary><br />[XmlRoot("MSMQMessage", Namespace=<br />"http://MyCompany.Schemas.MSMQMessageSchema")]<br />public class MSMQMessageMessage<br />{<br />/// <summary><br />/// Creates a new <see cref="MSMQMessageMessage">instance.<br />/// </summary><br />public MSMQMessageMessage()<br />{<br />}<br /><br /><br />/// <summary><br />/// Creates a new <see cref="MSMQMessageMessage">instance.<br />/// </summary><br />/// <param name="XMLFilePath">XML file path.</param><br />public MSMQMessageMessage(string XMLFilePath)<br />{<br />this.XMLFilePath = XMLFilePath;<br />}<br /><br /><br />private string mXMLFilePath;<br /><br />/// <summary><br />/// Gets or sets the XML file path.<br />/// </summary><br />/// <value></value><br />public string XMLFilePath<br />{<br />get { return mXMLFilePath; }<br />set { mXMLFilePath = value; }<br /><br />}<br /><br />}<br /><br />}<br /><br />3.<br />Create a console Application that send message to you queue. copy and paste the following:<br />//Submit message to MSMQ<br />string fileName = "C:\xyz.xml";<br />MSMQMessageMessage msg = new MSMQMessageMessage (fileName);<br />// create a message queue if<br />MessageQueue MQueue =new MessageQueue ("\private$\myQueue");<br />// create the message and set the base properties<br />Message msmqMsg = new Message (msg);<br />msmqMsg.Label = fileName;<br />// send the message as part of the transaction<br />MQueue.Send (msmqMsg,MessageQueueTransactionType.Single);<br />// commit the transaction<br />// close the mesage queue<br />MQueue.Close();<br /><br />4.<br />Now the message is serialized and placed in MSMQ.<br /><br />5. Create a new BizTalk Project, reference that assembly that contains "MSMQMessageMessage" type.<br /><br />6.<br />Create a message and give it a type "MSMQMessageMessage" from the referenced assemblies.<br /><br />7.<br />Create a receive and send port, those ports will send and receive the message which we have just defined.<br /><br />Note: Ports bindings should be "Later"<br /><br />8.<br />Deploy you orchestration and create send and receive "physical" ports, receive port‘s transport type should be "MSMQ", give it the queue name. Send port’s transport type should be file, so that it will leave the messages on specific folder.<br /><br />9.<br />Bind the orchestration and run the console application to send message to MSMQ.<br /><br />Note: I will provide you will a complete code sample soon.Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.com1tag:blogger.com,1999:blog-7889423.post-1120323669138256812005-07-02T19:53:00.000+03:002005-07-02T20:56:16.296+03:00BizTalk and COM+ TransactionBizTalk and COM+ Transaction<br /><br />If you would like to call a COM+ Serviced Component from a BizTalk Scope shape, it is very easy, but take care, all your Serviced Components shouldn’t have attribute of “RequiresNew”.<br /><br />When you create an atomic scope shape, BizTalk creates a COM+ service behind the sense,I think so, this Serviced component uses “RequiresNew”. If any component of your COM+ components “RequiresNew” you should get an exception.<br /><br />To try this:<br />Read this article <a href="http://www.codeproject.com/csharp/estransactions.asp">Creating COM+ Objects using EnterpriseServices in .NET</a><br /><br />Read this article, compile, deploy the code, call it from your orchestration, you should get an error from BizTalk in the event viewer. Change the attributes from “RequiresNew” to requires, everything will be fine.<br /><br /><br />Note: <br />you can use the code from the above article to make sure that transaction works as you expected.<br /><br />read this useful <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/BTS_2004WP/html/ed17b4fc-ddc1-4a41-a134-7d11b2ea3a87.asp">article</a>.Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.com0tag:blogger.com,1999:blog-7889423.post-1120321979384619962005-07-02T19:21:00.000+03:002005-07-02T21:04:36.816+03:00[Sharepoint] ICellProvider, ICellConsumerDid you try before to implement a webpart that implements two interfaces? You can do that in two ways:<br />1. <br />Create two separate class, each one implements a one of the interfaces and the main webpart class should be drived from the webpart base class. Create 2 instances from the classes you have just created and pass them to the register interface method, see for a complete sample <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/spptsdk/html/smpxCreateConnectableWPMultipleInterface_SV01080585.asp">this</a>.<br /><br />2. <br />The webpart class should be derived from WebPart base class and implements the two interfaces, I recommend the first option, but in my early days with sharepoint I tried this option, I faced a problem because my webpart implements ICellProvider and ICellConsumer: (ICellProvider.CellConsumerInit) and (ICellProvider.CellProviderInit) has the same name, so you want to use the interface name to differentiate between the method and the event, to do this you have to "<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcondefiningcustomevent.asp">Property syntax</a>" to define you event, this is the trick.<br />See the code <a href="http://www.geocities.com/tarek_mohammed_eg/SearchResult.cs.txt">here</a>.<br /><br />I.e. you can't say "event CellConsumerInitEventHandler CellConsumerInit" but you have to say "event CellConsumerInitEventHandler ICellConsumer.CellConsumerInit" instead.<br />Because we implenent the interface in this way we have to use property syntaxTareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.com0tag:blogger.com,1999:blog-7889423.post-1120320989211330302005-07-02T18:40:00.000+03:002006-07-05T18:31:43.760+03:00[sharepoint]Be blind with event handlerIf you are developing sharepoint event handler take care of the following:<br />1. <br />Enable Event handler in sharepoint server:<br />Windows SharePoint Services --> Configure virtual server settings --> Pick server from list --> Virtual Server General Settings --> Event Handlers --> On<br /><br />2. <br />Every time you change the code you have to:<br /> - Remove old version from GAG<br /> - Re Add the assembly into the GAG<br /> - IISRESET<br /> - You new assembly should be loaded and you can debug it using the W3wp.exe<br /> See my post about this <a href="http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sharepoint.windowsservices.development&mid=1e86c996-2361-4c61-80be-ee6bf02ef588">here</a><br /><br />3. <br />Be careful when you edit document library settings for assembly name and class name: user <a href="http://www.aisto.com/roeder/dotnet/">reflector</a>, see pics below to get assembly name and class name: see <a href="http://www.geocities.com/tarek_mohammed_eg/1.JPG">figure(1)</a> and <a href="http://www.geocities.com/tarek_mohammed_eg/2.JPG">figure (2)</a>, the right values are in read rectangle. <br />Note: for the class name you have to find it implements "ILISTEVENTSINK" as whon in figure (2)Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.com1tag:blogger.com,1999:blog-7889423.post-1120035236562550122005-06-29T11:50:00.000+03:002006-11-24T06:29:29.176+02:00[Sharepoint 2003]There is an error in XML document (1, 40)There is an error in XML document (1, 40)<br />If you are a sharepoint 2003 webpart developer and see this error, it seems to be a general error which indicate nothing. I faced this error and I figured out that I forget to deploy one of my dlls which I use in my webpart. You may also get an error states that your webpart can't be serialized, I think you may also forget to get add you dlls in GAG or site bin folder.Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.com2tag:blogger.com,1999:blog-7889423.post-1116592531947695022005-05-20T15:21:00.000+03:002005-05-20T15:35:31.953+03:00Lazy or Busy, I'm sorryHello Guys,<br />I'm sorry because I didn't post and new biztalk articles last 2 or 3 months, for last 3 months, I was involved in build alot sharepoint solution and web parts, I got more exprience and I will transfer it here on my blog, so expect the following articles very soon:<br />1. Implement ICellProvider - ICellConsumer [Same Webpart]<br />2. BizTalk Sharepoint Adaptor.<br />3. Schema Mapping in MAP Force (XML Spy)<br />4. MSMQ adptor how to.<br />and more...Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.com0tag:blogger.com,1999:blog-7889423.post-1113009287363820102005-04-09T03:14:00.000+02:002005-04-09T03:14:47.363+02:00<DIV xmlns="http://www.w3.org/1999/xhtml"><br /><P><STRONG><SPAN class=clsSubhead>Because I'm very interested in source Safe, Read this: </SPAN></STRONG></P><br /><P><STRONG><SPAN class=clsSubhead>From MSND Magazine, April issue.</SPAN></STRONG></P><STRONG><SPAN class=clsSubhead></SPAN><br /><P><STRONG><SPAN class=clsSubhead>Team Foundation Source Control</SPAN></STRONG></P><br /><P></STRONG>Before creating any designs or code, you will want to set up source control using Team Foundation Source Control. Formerly known by its code name "Hatteras," Team Foundation Source Control is a much more robust platform than Microsoft Visual SourceSafe<SUP class=clsSmall>®</SUP>. All of the content you store in this new source control system is automatically backed up in a SQL Server 2005 database for easy administration. The design goals for this new source control system include high scalability and performance, two features that are lacking in Visual SourceSafe. The new source control system will include more robust branching and merging capabilities. Because of this, multi-checkout will be turned on by default.</P><br /><P>A new feature called "shelving" is also available. This feature allows you to take checked-out code that you are working on and check it into source control, but not into the primary branch, allowing developers to properly back up their work without forcing incomplete changes onto other developers on their team.</P><br /><P>Visual SourceSafe will still be available and updated to work with Visual Studio 2005. Visual SourceSafe may prove useful on smaller projects with smaller teams that don't require the power of Team Foundation Server and that don't want to put forth the extra effort and expense of installing it. To select which source control engine you want to use, simply open Visual Studio, go to Tools | Options and select Source Control options.</P><br /><P>Once you are configured to use Team Foundation Source Control, any time you create a new project in Visual Studio, you will have the option to add the project to source control. At that time, you will select the Team Foundation Server you wish to use. As a developer, when you are working on tasks you can mark work items to associate the work items with code that you are checking into source control. This association is then stored in the database and can be used later to create build reports. In addition, the new source control system also allows the creation of check-in policies. The purpose of a check-in policy is to restrict what code is allowed to be checked into the source control repository.</P></DIV>Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.com0tag:blogger.com,1999:blog-7889423.post-1108084781444219942005-02-11T03:15:00.000+02:002006-06-16T15:26:08.656+03:00BAS made easy<a href="http://www.gotdotnet.com/workspaces/workspace.aspx?id=8eee92c8-182c-413a-b7a7-3607cc7e7aae">Download Code here</a><br /><br /><br /><strong>Introduction:</strong><br /><br />I know that BAS (Business Active Services is hard to be understood), so I will write this short article that explains it in a very simple way, it will not cover every aspect in BAS, but my main target to show you how to see the sample application.<br /><br /><strong>Learn by example:<br /></strong><br />I will tell a story which show when you can use BAS. Suppose that you have to integrate an inventory application with inventory suppliers. Each supplier feeds the stock with a specific list of items. In your application you will watch stock and when an Item type becomes below the standard threshold, you have to order it from the right supplier. Now you want to send an order message to a specific supplier according to the type of the items.<br /><br />As a BizTalk genius, you will create a list of send ports and create a decide shape to your order orchestration and according to the order type, you send the message. Or you can create a dynamic send port and set its port properties according to the order type. But if you want to add new item type, you will need to modify, build and deploy orchestration. It will work, but Microsoft knows, in advance, that you will face this scenario a lot. So Microsoft introduced BAS.<br /><br />BAS allows you to create those suppliers in Share point site, and you can associate some suppliers information using, what is so called agreement. You can organize those suppliers in roles, according to specific criteria. For example, you can create a role called, Software suppliers, and Hardware suppliers. You can enlist Microsoft, IBM in the software suppliers and Dell, Compaq in the hardware supplier's role. You can receive and send message from those parties. Party is an organization which you want to communicate with.<br /><a href="http://www.geocities.com/tarek_mohammed_eg/Roles-Parties.GIF"><br /><img src="http://www.geocities.com/tarek_mohammed_eg/Roles-Parties.GIF" /> </a><br />To start working with BAS, it is easy; you have to create a Role Link Type, and Role Link instance. You can add port types to the Rule link type either send or receive ports or both.<br /><br /><strong>Note:<br /></strong><br />You can send messages to the party's inbox in the share point site suing some reserved names port types such as SendToInboxPT<br /><br />You can add Parties to rules using BizTalk explorer, but you have to define parties at "Business Activity Services Site", and you can create a new agreement. I may write a tutorial on how install BAS and Business Activity Services Site.<br /><br /><strong>Sample Code:<br /></strong><br />I include a sample code that shows how to work with Roles and Parties in BAS, it is very simple orchestration which receives an order message and according to the order type it forwards the suitable party. In the future I may enhance it to including using agreements.<br /><a href="http://www.geocities.com/tarek_mohammed_eg/orch.GIF" hef="http://www.geocities.com/tarek_mohammed_eg/orch.GIF"><br /><img height="234" src="http://www.geocities.com/tarek_mohammed_eg/orch.GIF" width="337" /> </a><br /><br /><strong>Party Resolution</strong><br /><br />After deploying the solution, you can start the orchestration and place a sample file in the receive location path. Orchestration checks the "OrderType" value if it is set to 1 it forward the order to "Fabrikam" party; else it sends it to "ITWrox" party. Using the following line of code in the "SetDestinationPartyTOFabrikam" expression shape:<br /><br />SendOrderToInboxRL(Microsoft.XLANGs.BaseTypes.DestinationParty) =<br />new Microsoft.XLANGs.BaseTypes.Party("Fabrikam","OrganizationName");<br /><br />What this line of code means for us? This is called party resolution, i.e. select the appropriate party according to certain criteria such as it Organization Name, phone number etc. the following line of code show how to use alias of the Phone number.<br /><br />SendOrderToInboxRL(Microsoft.XLANGs.BaseTypes.DestinationParty) =<br />new Microsoft.XLANGs.BaseTypes.Party("027231370","PhoneNumber");<br /><br />Alias is a property of the party which we select before sending message to the roe link. To add or edit an alias, right click the party after deploying it and choose Edit.<br /><a href="http://www.geocities.com/tarek_mohammed_eg/Alias.GIF"><br /><img height="288" src="http://www.geocities.com/tarek_mohammed_eg/Alias.GIF" width="245" /><br /></a><br />So what will happen if the orchestration can't find the "Fabrikam" belongs to the "SendOrderToInboxRL" role? It will give you the following error:<br /><br />Destination party not found while attempting to send message 'MsgOrder' to (Fabrikam, OrganizationName).<br /><br /><br /><strong>Note:<br /></strong><br />We have only send port in the role link. And according to the party, BAS will send the message to the appropriate send port for the selected party.<br /><br /><strong>Steps to run the sample code:<br /></strong><br />- Build, deploy, orchestration.<br />- Create Parties in the "Business Activity Services Site" for (ITworx and Fabrikam).<br /><a hef="http://www.geocities.com/tarek_mohammed_eg/BASSiteAdmin.GIF"><br /><img height="347" src="http://www.geocities.com/tarek_mohammed_eg/BASSiteAdmin.GIF" width="318" /><br /></a><br /><br />- Create 2 send ports for each Party (ITworx and Fabrikam) and associate them to each party using the Edit party dialog box<br /><a href="http://www.geocities.com/tarek_mohammed_eg/BASAddPorttoParty.GIF"><br /><img height="297" src="http://www.geocities.com/tarek_mohammed_eg/BASAddPorttoParty.GIF" width="247" /><br /></a><br />- Associate the two parties to the rule link "SendOrderToInboxRL"<br /><br /><img src="http://www.geocities.com/tarek_mohammed_eg/EnlistParty.GIF" /><br /><br />- Create the sample Order message and notice the orchestration behavior.<br /><br /><a href="http://www.geocities.com/tarek_mohammed_eg/Debug-Select.GIF"><br /><img style="WIDTH: 418px; HEIGHT: 158px" height="197" src="http://www.geocities.com/tarek_mohammed_eg/Debug-Select.GIF" width="494" /><br /></a><br /><a href="http://www.geocities.com/tarek_mohammed_eg/Debug-Orchestration.GIF"><br /><img height="320" src="http://www.geocities.com/tarek_mohammed_eg/Debug-Orchestration.GIF" width="363" /><br /></a>Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.com9tag:blogger.com,1999:blog-7889423.post-1107358657093587432005-02-02T17:35:00.000+02:002005-02-02T17:45:02.386+02:00Suspended messagesHere is a question which I posted on Microsoft news group,
<br />I want to share <a href="http://hugorodgerbrown.blogspot.com/2005/01/message-subscriptions.html">Hugo</a> response about it:
<br /><strong></strong>
<br /><strong>Tareq:</strong>
<br />
<br />In Content Based routing, If BizTalk Port receives a message and the "subscriber" port has not been enabled yet, the message marked as suspended, and the receive Pipeline marked as terminated, when I enable the "Subscriber" port, why doesn't it subscribe to the suspended messages. What can I do to enable it to subscribe to the suspended messages?
<br />
<br />Second question, if I post a XML message which contains mistake forExample "open tag" which is not close, this was done by mistake, how I can track such messages and how to handle them?
<br />
<br /><strong>Hugo: </strong>
<br /><strong></strong>
<br />The subscription required for the message to be processed is created when the port is enlisted. When the receive location picks up the message,it is delivered to the message box, where the message agent runs through thesubscription table to see if there are any services subscribing to themessage. If not, it is marked as suspended (unresumable). If there is a subscriber, but it is stopped, then the messages is suspended (resumable.) Restart the send port, and the message should clear.If the send port was not enlisted, then there will have been no availablesubscriber for the message when it arrived, so BizTalk cannot process it. Itis actually quite logical to suspend these messages and terminate thepipeline, as the alternative would require BizTalk to save every singlemessage it ever received, on the premise that someone might at some pointwant to subscribe to it. It's a bit like TiVo - you can pause live tv, butyou can't go back to a show that was on last week if you didn't record it! I've posted some links to others' articles on subscriptions here:
<br /><a href="http://hugorodgerbrown.blogspot.com/2005/01/message-subscriptions.html">http://hugorodgerbrown.blogspot.com/2005/01/message-subscriptions.html</a>
<br />
<br /><strong>Tareq: </strong>
<br />
<br />Great post Hugo,but, I tried to post a xml documents that is not valid "Tag is opened and never closed" biztalk consumed it, I want to track such messages, so how ?
<br />
<br /><strong>Hugo: </strong>
<br />
<br />If your receive location is using an XmlReceive pipeline, then malformed Xmldocuments will be suspended, as the XmlDissasembler will throw an exceptionwhilst attempting to parse the document. All suspended documents can beviewed in HAT - look under Operations > Service Instances, selecting Class== "Messaging", and you should see it.
<br />You can use the context-menu option"Save Tracked Message" to save a copy of the message to disk, where you canview the contents. In this case the message never reaches the messagebox, so subscriptions arenever matched. (The message agent only processes messages that are receivedinto the message box.) If you use the PassThru pipeline in your receivelocation, the message will reach the message box regardless, as the xml isnot being parsed.
<br />However, no message properties will be promoted if you usethe PassThru pipeline, so CBR cannot be based on message content. If you do use a PassThru receive pipeline, and have your send port enlistedand routing messages based on non-content criteria (e.g. receive port name),then the message will be routed to the send port regardless of the validityof the xml. However - if the send port uses the XmlSend pipeline, themessage will now fail in the send port, because of the same issue.
<br />It will again be visible in HAT, and the contents of it can be viewed byright-clicking on the messaging service in HAT, and selecting "Save AllTracked Messages". So - if the xml is invalid, it will always fail in an XmlReceive or XmlSendpipeline, which means CBR cannot use message properties, as properties arepromoted into the message context in the XmlReceive pipeline.However - if you use a PassThru pipeline at both ends, and route messagesusing non-message-based filters, then you can put anything you likethrough - an image, word document, whatever.
<br />Hope this helps?
<br />
<br /><strong>Tareq: </strong>
<br />
<br />Great post Hugo,Thank you...Anther Question, In real world senarios, what do u do with those messages, malformed xml documents, etc.
<br />
<br /><strong>Hugo:</strong>
<br />
<br />Good question, and one whose answer really depends on the specific nature ofthe application. If the number of poor messages is low, then manualintervention via HAT may be acceptable. If not, then something more robustis called for.
<br />The WMI object model exposes an event that fires whenever amessage is suspended, so you should be able to plug in to this. Check outMartijn's suspended queue listener for a concrete implementation of this.(<a href="http://martijnh.blogspot.com/2004/07/biztalk-2004-suspended-queue-listener.html" target="winout">http://martijnh.blogspot.com/2004/07/biztalk-2004-suspended-queue-listener.html</a>)
<br />Of course, assuming the messages are generated by a program that understandsxml, this particular exception should never occur, as it ought to beimpossible to produce invalid xml? You really need to think through thepractical implementation of your application - we all make mistakes whenhand-rolling test data, and there's little point worrying about these, solong as you have confidence in the final product? (I'm assuming that inproduction your message are not produced by hand by someone using notepad!) Hugo
<br />
<br />Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.com1tag:blogger.com,1999:blog-7889423.post-1107351001843139372005-02-02T15:21:00.000+02:002005-02-02T15:30:01.843+02:00BizTalk Auto deploy is backHi All,
<br />I want to clarify an issue with <a href="http://www.gotdotnet.com/Workspaces/Workspace.aspx?id=62d94220-c0e0-46d4-a2d6-85d3d911467a">BizTalk auto deploy</a>, if it is the first time to deploy your application you should change the solution configuration "<strong>Build </strong>--> <strong>configuration manager</strong>", as shown in the figure below,
<br />
<br /><img src="http://www.geocities.com/tarek_mohammed_eg/BizTalkautoDeploy/deploy.gif" />
<br />
<br />In the future release, I will automatically include BizTalk projects into the "Deploy" list.
<br />
<br />as a reminder, you can sign, build, deploy, enlist, start or undeploy,build, deploy, enlist, start you orchestrations and ports with one click
<br />
<br /><img src="http://www.geocities.com/tarek_mohammed_eg/BizTalkautoDeploy/deploynow.gif" />
<br />Tareq Alihttp://www.blogger.com/profile/06627862537089090145noreply@blogger.com8