tag:blogger.com,1999:blog-113139962024-03-20T05:56:42.735-04:00Shashikant's Biztalk StreamsThis blog is a medium for communicating and recording my efforts, successes and failures.
It is an effort to share my passion with like minded people.Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.comBlogger72125tag:blogger.com,1999:blog-11313996.post-57882842329016631822012-12-27T14:37:00.000-05:002012-12-27T14:37:59.529-05:00EDI Reporting and curious case of missing 997We all agree that out of box EDI reporting in Biztalk leaves lot of gaps. For example, it is not easy to find all messages which were sent to our partners that didn't send 997 back to us. One can go on Biztalk console and click each message to find if Ack was received. But this is a very tedious approach and time consuming too. Instead, creating a query using BAM views can quickly give us desired results. This way a report can be set up using SSRS that can be viewed across the organization.<br />
<br />
SELECT TOP (100) PERCENT InterchangeControlNo, ReceiverID, ReceiverQ, ApplicationReceiver, DATEADD(HOUR, - 5, TimeCreated) AS ProcessTime, TransactionSetId<br />
FROM dbo.bam_TransactionSetActivity_AllInstances AS T<br />
WHERE (SenderID LIKE ' [your org ID] %') AND (TransactionSetId <> '997') AND (NOT EXISTS<br />
(SELECT RecordID, ActivityID, InterchangeActivityID, GroupControlNo, InterchangeControlNo, ReceiverID, SenderID, ReceiverQ, SenderQ, InterchangeDateTime, <br />
Direction, AckProcessingStatus, AckStatusCode, DeliveredTSCount, AcceptedTSCount, AckIcn, AckIcnDate, AckIcnTime, ErrorCode1, ErrorCode2, <br />
ErrorCode3, ErrorCode4, ErrorCode5, TimeCreated, RowFlags, LastModified<br />
FROM dbo.bam_FunctionalAckActivity_AllInstances AS F<br />
WHERE (GroupControlNo = T.GroupControlNo) AND (SenderID = T.ReceiverID)))<br />
ORDER BY TimeCreated DESC<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-39749658518719051262012-12-06T07:15:00.002-05:002012-12-06T07:15:44.243-05:00Remote Desktop issue with VM roleWhile trying to connect to Biztalk VM image in Azure, if the remote desktop does not connect, try one or all of the following things:<br />
<br />
<ol>
<li>Reduce the size of VM image to small (smaller size and lesses processors)</li>
<li>Ensure endpoint exists or create one. </li>
<li>Delete the VM image and create a new one with a different geographical location. Try different locations within USA. (this did the trick for me)</li>
</ol>
<br />
<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-80965964218190330112011-11-10T20:28:00.006-05:002011-11-14T10:32:31.024-05:00SSIS Package ErrorBiztalk is not always the right tool for Bulk data inserts. SQL Integration Services provide powerful tool set for inserting large bytes of data from source ( flat files / excel files/DB) into DataTables. In my scenario, I created SSIS package using SQL 2008R2 Business Intelligence Development Studio. It was a simple Data flow, read the excel file from a network location and insert to a remote DataTable. Image below:<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjF4u1uiMjXKjxV-RSsYJEBVv-a1e-gby4gynv9dZAvIxiwXYS7lFYB1MCFF3RO_At9eUVZfnLFIPHg_Pz18JEaL4bjNNwKeuFpDJ7_41x5fR2mZS4ezQxNLWGsOSiHgMYhE66h6g/s1600/dataflow.png"><img style="WIDTH: 364px; HEIGHT: 322px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5673548787459778898" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjF4u1uiMjXKjxV-RSsYJEBVv-a1e-gby4gynv9dZAvIxiwXYS7lFYB1MCFF3RO_At9eUVZfnLFIPHg_Pz18JEaL4bjNNwKeuFpDJ7_41x5fR2mZS4ezQxNLWGsOSiHgMYhE66h6g/s400/dataflow.png" /></a><br />On executing the package, <strong>OLE Destination 1</strong> shape would threw the following error:<br />“[OLE DB Destination 1 [421]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.<br />An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "The statement has been terminated.".<br />An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Violation of PRIMARY KEY constraint 'PK_tbl_so'. Cannot insert duplicate key in object 'dbo.tbl_so'.".”<br /><br />I tried various online forums but the solutions didn’t work for me. Then I tried data encryption and it worked. Check the image below.<br /><br /><br /><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1egThv_aJgVXQKhV7yQhVM6w2dOa2XAhJM5hTWFwPzJ1sBO8jnaSDaJSEHrSFD0wCXnfOhNGHyEu6VQZpF8rD9dbfLjS5JwoCaFuU7uBdf9XG9FncUK859V-2sGf44fP0X9Mamg/s1600/SSIS.png"><img style="WIDTH: 399px; HEIGHT: 400px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5673549051274094354" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1egThv_aJgVXQKhV7yQhVM6w2dOa2XAhJM5hTWFwPzJ1sBO8jnaSDaJSEHrSFD0wCXnfOhNGHyEu6VQZpF8rD9dbfLjS5JwoCaFuU7uBdf9XG9FncUK859V-2sGf44fP0X9Mamg/s400/SSIS.png" /></a><br /><br /><br /><span style="color:#ff6666;">Update</span><br /><br />After I deployed the package to remote server, I tried executing it and received validation errror around login/username. I am using SQL authentication for the DB that will receive the data from excel sheet. Internally, SSIS encrypts the credentials information. If you open the package in a notepad, you can view the encrypted information. But, when the same package is run on a different machine the user context changes and decryption process throws the error. Setting the protection level as below can get you around that issue.<br /><br /><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg_z11JK5eNV4XEgfP7F_3XbOZTdNVG8F8SuZkb_Np4HEyN81J3_hxkFqePiFcZynrAdvC0EVWNiB0MHtT9yFQFOgBhXP1a09Q-9vLhjuUcIxC1oa1-rn6vQRkQj49zAt4kruHtw/s1600/protectionlevel.png"><img style="WIDTH: 400px; HEIGHT: 300px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5674873453234216082" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg_z11JK5eNV4XEgfP7F_3XbOZTdNVG8F8SuZkb_Np4HEyN81J3_hxkFqePiFcZynrAdvC0EVWNiB0MHtT9yFQFOgBhXP1a09Q-9vLhjuUcIxC1oa1-rn6vQRkQj49zAt4kruHtw/s400/protectionlevel.png" /></a><div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-79877700768250332732011-08-17T09:28:00.003-04:002011-08-17T11:17:54.427-04:00Microsoft BUILDStarting this year, Microsoft rebranded its Professional Developer Conference (PDC) as BUILD. I have no idea what message they are trying to convey with this name change. For some strange reasons, this change was not broadcasted strongly by the numerous Microsoft blogs and sites. The registration page was so hidden that even search engines could not find it using standard words like “PDC Microsoft conference” etc. Well, for people who still don’t know, BUILD is being held in Anaheim, California in middle of September this year. At the time of writing this article, no agenda have been published by Microsoft for the conference. This is rather strange for an elite conference like this. My guess is that there will be breaking news around direction of Biztalk Cloud technologies. Update to Windows mobile platform (“Mango” code name) will get good coverage. Microsoft is really pushing hard to break into the Smartphone market. Even though Mango is looking like a robust platform, it is hard to penetrate the barrier created by Android and iPhone. Recent buy out of MMI by Google, bodes well for Microsoft. It leaves windows mobile as the only true Open Source mobile platform in the market. It is rather ironic that a company traditionally linked with developing proprietary technologies is taking this mantle from a company like Google that is traditionally linked with developing and encouraging Open Source systems. This demonstrates the fast changing technology landscape and underlines the difficulties faced by CIOs in planning strategic IT initiatives.
<br />
<br />Microsoft is consolidating its offering around Desktop, Web, Cloud and Mobile with the latest release of Visual Studio 2011. These are very exciting times for Microsoft Developers, it seems that finally Microsoft is streamlining its technologies and removing the redundancies. Biztalk-Appfabric consolidation is happening along with Silverlight-HTML5 consolidation. Sharepoint story is unchanged and it is one of the few non-redundant technologies in the Microsoft stack.
<br />
<br />So, where do we stand amidst all this? Consolidation of technologies will lead to more clarity for customers. One reason, Biztalk didn’t maintain the steep growth curve was because of the confusion created by conflicting technologies on the Microsoft Connected System stack. Customers like clarity, especially while evaluating different technologies to implement. They tend to select products with more clarity around their future roadmap. Microsoft shops in general are prime candidate for Biztalk, but they saw technologies like AppFabric and WCF close substitute for Biztalk. For most of them, sole reason for buying Biztalk was because they were an EDI shop. On the other hand, Biztalk was a tough sell in non-microsoft shops as it works with Microsoft framework. A java shop will most likely go for a GIS or webMethods implementation.
<br />
<br />Real value of Biztalk lies in developing it as an integration hub for both EDI and Non-EDI integrations and then extending it to link with Sharepoint. Next step will be to combine on-premise and cloud integration on same platform. This is where Azure Appfabric is leading us to. Keep an eye on PDC (BUILD) space for more on this.
<br />
<br /><div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-47215820319116228492011-06-22T20:44:00.003-04:002011-06-23T10:01:57.206-04:00Death of Biztalk -- Are you kidding me?Honestly, I am tired of statements like “BizTalk is Dead” or “BizTalk is Obsolete”. With every release of new technology around Connected System stack, the noise around speculated BizTalk demise gets louder. Right from the time Oslo was released (which never saw light of the day) to recently released Azure App Fabric –June CTP, blogosphere gets noisy with shouts of BizTalk is Dead.<br /><br />In my opinion, if one thinks of BizTalk as a brand then it could be said that BizTalk may die as a brand in near future. Even that is a speculation for sake of argument. But if one considers BizTalk as Integration enabler and a set of tools, then it can’t be dead. There may be re-organization around the tools but they will not die down. I agree that redundancies in form of Windows App Fabric and Windows Azure App Fabric do take something away from BizTalk. They also create confusion in the mind of new and existing clients. Especially, when the marketing pitch is not in tune with technical pitch. Few years ago, I would just blindly recommend BizTalk in scenarios involving hosted workflows and service compositions. But now it is not so easy. Microsoft has labeled BizTalk as Integration Server, Windows App Fabric is termed as Application Server and Windows Azure App Fabric is a cloud integration platform. It can get confusing between these 3 technologies. If I need to mathematically establish a relationship between these 3, it will look something like:<br /><br /><strong>BizTalk >= Windows Server Fabric + Windows Azure App Fabric.<br /><br /></strong>It can be argued that in near future Windows Azure App Fabric may expand to include more of the existing BizTalk tool set and that may make the relationship more like<br /><br /><strong>BizTalk = Windows Server Fabric + Windows Azure App Fabric.</strong><br /><br />This is where people jump in and say that BizTalk is dead as it can be replaced by combination of the two technologies! In my opinion:<br /><br />1. Azure App Fabric is not a mature product yet and it is too early to say anything. Remember Oslo?<br /><br />2. It is quite possible that BizTalk tools will be re-organized around cloud platform using Azure App fabric as core. Depending on how one sees it, it could be branded as a new version of BizTalk with Azure App Fabric as the cloud enabler. This will not mean end of BizTalk.<br /><br />3. Other possibility is that BizTalk and Azure App Fabric will continue their parallel paths for foreseeable future. This will not mean end of BizTalk.<br /><br />It could be said that Azure App Fabric is a new technology that BizTalk developers will have to learn. Just like BizTalk 2004 release, made BizTalk developers learn .net. BizTalk 2006R2 made developers look into WCF.<br /><br />Windows Server App Fabric is more of an Application Server than an Integration server. However, BizTalk Appfabric connect allows .net developers leverage LOB adapters and Mapper to create workflow solutions. This compliments BizTalk just like Azure App fabric does.<br /><br />As a BizTalk developer, I have mixed feelings. On one side I feel unhappy that the BizTalk tool set is being broken and leveraged around different Microsoft stacks. Now everyone else will be able to enjoy the excellent tool sets of BizTalk that were once sole proprietorship of BizTalk developers. It kind of takes power away from us. But at the same time, I feel happy that as a BizTalk developer we are placed uniquely to leave our footprints across the different technology stacks that use BizTalk tools .<br /><br />Following are list of tools that are still exclusive to BizTalk. These are key touch points while making a choice between BizTalk and other technologies.<br /><br />• Accelerators (EDI, SWIFT, Rosettanet, RFID, EDIFACT, HL7)<br />• Pipelines<br />• Flat File processing<br />• BAM<br />• BRE (it is exposed as a REST API now but still under BizTalk licensing)<br />• BizTalk Mapper (BizTalk AppFabric connect enables you to use the mapper with Server App Fabric, still under BizTalk licensing)<br />• Non-WCF adapters like FileAct/Interact<br />• Host Integration Server<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com2tag:blogger.com,1999:blog-11313996.post-27436015447319957182011-04-19T11:29:00.008-04:002011-04-20T11:10:04.957-04:00Processing Empty Files in BiztalkIn my current integration project, there is a need to process empty files (0 byte) in Biztalk. Default behavior of FILE adapter is to delete an empty file and raise an event. This empty file is then deleted even before it reaches pipeline on way to Biztalk MsgBox. So there is no way to do a routing based on filename either in a pure message scenario or using an orchestration.<br /><br />One possible solution is to extend the File Adapter that is part of SDK (Image 1.1). Add the 3 projects in a Visual Studio Solution as shown in Image 1.2<br /><br /><strong>Image1.1</strong><br /><br /><div><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbIDjsJuA1T8ccFnuvoO6sGU13sPqQOEQronp_R_g-RnbMnoc7IVLUKEOT1Q1CqglVNACWYLr_UHSLj-qskeO3v0jbE5iumR2AY58RhejRWATeyfhWSzfW1qj5Sxi6Tw-GBK1UdQ/s1600/1.1.png"><img style="WIDTH: 400px; HEIGHT: 314px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5597318613943133474" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbIDjsJuA1T8ccFnuvoO6sGU13sPqQOEQronp_R_g-RnbMnoc7IVLUKEOT1Q1CqglVNACWYLr_UHSLj-qskeO3v0jbE5iumR2AY58RhejRWATeyfhWSzfW1qj5Sxi6Tw-GBK1UdQ/s400/1.1.png" /></a></div><br /><br /><div><strong>Image 1.2</strong></div><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjzf7H2MEfVrsLhTfCyHu6wdmO6-0JogHDw9HgQn9up3YlDmRg6WqP7H2liatbPoHtQQwPl9Bn4O-lnKqVh6YDn8VdoGWdUjkBfRHJHKyWHzlbndk0_ugmN4PLKePFORGJudXhyA/s1600/1.1.png"><img style="WIDTH: 296px; HEIGHT: 157px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5597319044712840418" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjzf7H2MEfVrsLhTfCyHu6wdmO6-0JogHDw9HgQn9up3YlDmRg6WqP7H2liatbPoHtQQwPl9Bn4O-lnKqVh6YDn8VdoGWdUjkBfRHJHKyWHzlbndk0_ugmN4PLKePFORGJudXhyA/s400/1.1.png" /></a><br /><br /><strong>Key steps:<br /></strong><br />1. Build the solution, GAC Microsoft.Samples.BizTalk.Adapter.Common.dll. <br /><br />2. Registry Key.<br /><br />Use the StaticAdapterManagement.reg registry key file given in the sample and update the locations of the dlls mentioned. Microsoft recommends adding additional string for 64 bit machines. I didn’t do and it worked. <br /><br />3. Go to Biztalk admin console and try to add the new EMPTY FILE adapter. It is possible that you may get an error similar too :<br />The system cannot find the file specified.<br /><br />/C:\Program Files (x86)\Microsoft BizTalk Server 2009\SDK\Samples\CustomAdaptersDevelopment\File Adapter\Runtime\Microsoft.BizTalk.SDKSamples.Adapters.DotNetFile.Runtime.dll<br /><br />This error threw me off as my registry key file did not contain this path at all and it left me wondering why is Biztalk even looking for this path. I did a search for this file in the entire registry and I found couple of references. I had no idea what were they used for but I knew that Biztalk was somehow reading them from registry key. I renamed the key for these entries without deleting . I was able to add the adapter to Biztalk successfully. <br /><br />4. Once adapter was added, I assigned it to appropriate Biztalk host so I can use it in send/receive port. While setting the receive handler for this newly added adapter, I got the following error:<br />The Messaging Engine encountered an error when intializing the receive adapter "EmptyFile", HRESULT:"Property /Config/pollingInterval not found on adapter configuration XML.".<br /><br />I decided to debug the code to find the point of error. I found the error in method : ExtractPollingInterval in file ConfigProperties.cs under project Microsoft.Samples.BizTalk.Adapter.Common.csproj <br /><br /><strong>Update the following code</strong><strong><br /><br /><br /></strong>long pollingInterval = ExtractInt(document, "/Config/pollingInterval");<br />string pollingUnitOfMeasureStr = Extract(document,"/Config/pollingUnitOfMeasure", "Seconds");<br /><br /><div><br /><strong>To </strong></div><strong><br /><br /><div></strong></div>long pollingInterval = Convert.ToInt32(IfExistsExtract(document, "/Config/pollingInterval","5"));<br />string pollingUnitOfMeasureStr = IfExistsExtract(document, "/Config/pollingUnitOfMeasure", "Seconds");<br /><br />Or update the root name of ReceiveHandler schema to Config. I did the code change and not the schema change<br /><br /><br />I was in a position to configure this new custom FILE adapter and receive an empty file. In order to get a handle on the empty file, I need to go to method PickUpFilesAndSubmit which is part of DotNetFileReceiverEndpoint.cs under DotNetFile.csproj The line of code that got me the handle to the incoming file is if (item.Length == 0).<br />Once I got the handle, I was able to add my logic to deal with the incoming empty file. In my case, I decide to add a string “EmptyFile” if the incoming file was empty. I would then detect this file in the send adapter using the same custom adapter and assign 0 bytes to it. In between, I will have my orchestration reading the file name of this empty file (added string “EmptyFile”) and route it to appropriate directory folder.<br /><br />This solution requires tampering with contents of an emptry file. It may be to acceptable in some cases. In my case, it was acceptable.<br /><br /><strong><u>Send Side Changes: </u></strong><br /><br /><br />To intercept the EmptyFile (file with “EmptyFile” string) on the send side, I used the method: ProcessMessage in file DotNetFileTransmitterEndpoint.cs under project DotNetFile.csproj.<br />I inserted the following snippet after cloning the stream. This writes an empty file.<br />StreamReader sr = new StreamReader(Stream);<br />string fileContents = sr.ReadLine();<br />if (fileContents.Contains("EmptyFile"))<br />{<br />fileStream.Write(new byte[0],0,0);<br />return null;<br />}<br /><br /><strong>Dynamic Send Port:<br /></strong><br />In order to get this adapter to work with Dynamic Send port following changes will be needed:<br /><br />1. Use DotNetFILE:// (same as the entry in registry) instead of FILE:// in orchestration for setting dynamic address <br /><br /><div><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhra6wpgGxprnHZrkiYMlk2h8QePZA-TbyEZ-_Y2ZGcj7pefPq3N3OiWrQJ93nNPTkk8_OjDxcffRZwPRSI9BpzVSFcXI6fbFfT-Mbn81B2lAVv1pRgS8MT8z8ZtzodDRFPvIWYQ/s1600/1.1.png"><img style="WIDTH: 400px; HEIGHT: 101px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5597319876228629490" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhra6wpgGxprnHZrkiYMlk2h8QePZA-TbyEZ-_Y2ZGcj7pefPq3N3OiWrQJ93nNPTkk8_OjDxcffRZwPRSI9BpzVSFcXI6fbFfT-Mbn81B2lAVv1pRgS8MT8z8ZtzodDRFPvIWYQ/s400/1.1.png" /></a></div><br /><br /><br />2. In the adapter use the following code to extract destination string from the context properties:<br /><br />filePath = message.Context.Read("OutboundTransportLocation", "http://schemas.microsoft.com/BizTalk/2003/system-properties").ToString();<br /><br />Use this destination string to parse the final destination of the file and add code to write the file to that location.<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com2tag:blogger.com,1999:blog-11313996.post-26369240508082601002010-12-30T10:25:00.002-05:002010-12-30T10:37:37.091-05:00Configuring BAM portal on Biztalk 2010So, I installed Biztalk 2010 on Win2008 server with SQL server 2008 R2 on a 32 bit machine. Biztalk configuration worked smoothly as one would expect it to until the wizard tried to enable BAM portal. Biztalk configuration wizard threw an error saying "Default Web Site can't be validated". I did some research and found that almost everyone that had this error got it fixed by installing "IIS6 compatibility" role on the Server. But in my case, this role was already installed. But just to be sure, I uninstalled it--> restarted the server and installed it back. Only to find that it did not make any difference!<br /><br />I tried hacking my way by physically creating BAM application on the IIS but did not work either. Since BAM is a pre-compiled version, I could not debug it as I would do in an asp.net web application. Then, I thought of creating a new website called "BAM" at the same level as the "Default Website" but on a different port (not 80). In my case, I used port 81. I ran the Biztalk Configuration wizard, pointed it to "BAM" site instead of "Default WebSite" and it worked!!<br /><br />Later, I did some research and found out that this is a "bug" or a "known behavior" with Biztalk 2010 installation. It seems creating a new site for BAM is generally accepted solution.<br /><br />Check out :http://social.msdn.microsoft.com/Forums/en/biztalkgeneral/thread/ef650460-c219-4b34-bc7a-41bb7e75ec81<br /><br />I would like to hear from others who faced/or not faced same issue.<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com1tag:blogger.com,1999:blog-11313996.post-20214999105449332062010-12-27T12:26:00.004-05:002010-12-27T14:47:33.349-05:00Biztalk and CEP (Complex Event Processing)For people interested in integrating CEP with Biztalk, check out the white paper by Jesus Rodriguez at :<br /><br /><a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6c1da607-4785-4668-a274-6898c38ea603">http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6c1da607-4785-4668-a274-6898c38ea603</a><br /><br />StreamInsight is part of SQL 2008R2. Do some reading on StreamInsight before checking out this paper.<br /><br />This paper is very conceptual and does not provide any code snippets. If you are looking for some code samples, then use the samples that come with StreamInsight download and extend them.<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-70259186391393051882010-12-20T13:54:00.002-05:002010-12-20T13:58:07.378-05:00Appfabric Connect Feature on Biztalk 2010When Dublin (now Windows Server Appfaric) was close to being released, there was lot of talk around the speculative demise of Biztalk. Some of the key differentiators identified at that time were Mapper tool and ability to resume message flow using persistence data store. At that time, I wrote that it will be matter of time that these differentiators between Biztalk and Dublin will fade away (check the comment section of http://geekswithblogs.net/cyoung/archive/2008/10/15/125848.aspx). Current <strong><em>Avatar</em></strong> of Dublin aka WS Appfabric , provides the ability to persist data and supports resumption of messages. “AppFabric Connect” feature, that is part of Biztalk 2010 installation, exposes Biztalk mapper and LOB directly. So to be used with workflows, that can then be hosted on Windows Server Appfabric which in turn is part of IIS. Light weight applications does not need heavy weight Biztalk database anymore. Low latency scenarios can now easily be constructed using IIS hosting using Dublin.<br /><br />Since this feature is part of Biztalk 2010 installation, Biztalk license is needed to use this feature. In future this can and will change. It will then be possible to create custom WF that can be persisted to a DB and exposed as WCF endpoints, while mapping .net types using Biztalk with same set of mapping functoids that are part of Biztalk world. And all of this will be free!<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-13174552619268559142010-12-16T14:07:00.003-05:002010-12-16T14:27:26.273-05:00Little trick....that will help you long wayDuring the process of creating cloud project using VStudio, don't forget to mark external "reference" assemblies as "Copy Local =True". If this is not done, your application will run fine on your local cloud emulator but throw an "asp.net application error" when executed on the cloud. Every dll that is referenced, other than the default dlls, that are part of cloud project, should have property "copy local = true". When Visual Studio creates deployment package for cloud, it looks for this property. It adds all the dlls with "copy local = true" in the package and when the solution is deployed on the cloud, these additional dlls are deployed on the cloud too. In the absence of these dlls, your cloud application will throw “asp.net application error”.<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-21048281618984229482010-12-14T15:35:00.015-05:002010-12-14T16:58:36.800-05:00Biztalk and the CloudI was in NY city on Dec 1 for the Azure <span id="SPELLING_ERROR_0" class="blsp-spelling-error">Firestarter</span> event at the Microsoft Office. It was a nice overview of Azure. For past year or so, I have been thinking of getting my hands dirty with this technology. Between work and family, never really got a chance to do so. But this time, after the event I promised myself to actually put what I learnt into practice. Moreover so, because the free registration to Azure portal would expire in few weeks time.<br /><br />So, I came up with a simple scenario.<br /><br />1. Expose a <span id="SPELLING_ERROR_1" class="blsp-spelling-error">CreditScore</span> service using <span id="SPELLING_ERROR_2" class="blsp-spelling-error">Biztalk</span> within a firewall.<br />2. Publish this <span id="SPELLING_ERROR_3" class="blsp-spelling-error">Biztalk</span> Orchestration as <span id="SPELLING_ERROR_4" class="blsp-spelling-error">WCF</span> to Cloud Endpoint using <span id="SPELLING_ERROR_5" class="blsp-spelling-error">WCF</span> publishing<br />wizard<br />3. Use a simple windows client application to send a message and receive a reply from this <span id="SPELLING_ERROR_6" class="blsp-spelling-error">Biztalk</span> service exposed within firewall.<br /><br />Step 1:<br /><br />Create a two way <span id="SPELLING_ERROR_7" class="blsp-spelling-error">Biztalk</span> Orchestration that accepts an <span id="SPELLING_ERROR_8" class="blsp-spelling-error">xml</span> message(First Name, Last Name, <span id="SPELLING_ERROR_9" class="blsp-spelling-error">SSN</span>) and returns a message (Credit Score and Comments).<br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglLkzviAc9UlYcT8V8qSksVFufXf-aV9-Sp_jWzhuTA_404ppaBj81m_8E-UrtI1QjmJvvPy82KM4tXhbk9ZWWEjEvHPDltxKnBmvW_ci70A-ihh3Ie92aPkSTjs6HB0d5kz6kaA/s1600/BiztalkOrch.gif"><img style="WIDTH: 400px; HEIGHT: 215px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5550647108985360386" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglLkzviAc9UlYcT8V8qSksVFufXf-aV9-Sp_jWzhuTA_404ppaBj81m_8E-UrtI1QjmJvvPy82KM4tXhbk9ZWWEjEvHPDltxKnBmvW_ci70A-ihh3Ie92aPkSTjs6HB0d5kz6kaA/s400/BiztalkOrch.gif" /></a><br /><br /><br />(Image 1)<br /><br />Step 2.<br /><br />Publish this Orchestration as the cloud endpoint.<br /><br /><br /><br /><strong><u><span id="SPELLING_ERROR_10" class="blsp-spelling-error">Pre</span>-Requisite:<br /></u></strong><br />1. <span id="SPELLING_ERROR_11" class="blsp-spelling-error">Biztalk</span> 2010<br />2. Windows <span id="SPELLING_ERROR_12" class="blsp-spelling-error">AppFabric</span> <span id="SPELLING_ERROR_13" class="blsp-spelling-error">SDK</span> 1.0<br />3. Windows Azure <span id="SPELLING_ERROR_14" class="blsp-spelling-error">AppFabric</span> Account to create the URL of cloud Endpoint (Free, if you have <span id="SPELLING_ERROR_15" class="blsp-spelling-error">MSDN</span> subscription)<br />4. <span id="SPELLING_ERROR_16" class="blsp-spelling-error">Biztalk</span> 2010 adapter pack<br /><br />For details checkout : <a href="http://www.blogger.com/support.microsoft.com/kb/2449478">support.microsoft.com/kb/2449478</a><br /><br />Step 2. Create a windows client to test this <span id="SPELLING_ERROR_17" class="blsp-spelling-error">Biztalk</span> service using endpoint exposed in the cloud.<br /><br /><br /><br /><strong><u><span id="SPELLING_ERROR_18" class="blsp-spelling-error">Pre</span>-Requisite for the client machine:</u></strong><br /><br />1. Visual Studio(2008 <span id="SPELLING_ERROR_19" class="blsp-spelling-error">sp</span>1 or 2010)<br />2. Azure <span id="SPELLING_ERROR_20" class="blsp-spelling-error">AppFabric</span> <span id="SPELLING_ERROR_21" class="blsp-spelling-error">SDK</span> 1.0 (to get <strong><span id="SPELLING_ERROR_22" class="blsp-spelling-error">NetTcpRelayBinding</span></strong> and <strong><span id="SPELLING_ERROR_23" class="blsp-spelling-error">TransportClientEndpointBehavior</span></strong>).<br /><br />a) Open a "Windows Form Application" Project<br /><div>b) Add Reference to "Microsoft.ServiceBus.dll" from location </div><br />"C:\Program Files\Windows Azure <span id="SPELLING_ERROR_24" class="blsp-spelling-error">AppFabric</span> SDK\V1.0\Assemblies\NET3.5\Microsoft.ServiceBus.dll"<br /><br />c)Add Service Reference point to the URL exposed in the cloud : Sample URL:<br /><br /><a href="http://www.blogger.com/shashiraina-demo.servicebus.windows.net/Test.Biztalk.Cloud.Orch/">shashiraina-demo.servicebus.windows.net/Test.Biztalk.Cloud.Orch/</a>. This <span id="SPELLING_ERROR_25" class="blsp-spelling-error">namespace</span> in URL is created using <span id="SPELLING_ERROR_26" class="blsp-spelling-error">AppFabric</span> Account. (Image below)<br /><br /><br /><p></p><img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 400px; DISPLAY: block; HEIGHT: 108px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5550651985937755234" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBVT-Wd5xSPSNiL7AyKFIIVjyiDJ4FznLEVVOszEbHV45u5Vv81iGA17uIEsh1s0wKeud_P3eUcOa50wOEoc1DIm4yYnKGHniG0t-2l8flZjpLq_Hq7kp9lLAtp1icWMVZnXCssw/s400/appfabric.gif" /> (Image 2)<br /><br /><br />d) Use the proxy to generate client side objects. I used code instead of <span id="SPELLING_ERROR_27" class="blsp-spelling-error">config</span> file because, I was not able to get "<span id="SPELLING_ERROR_28" class="blsp-spelling-error">TransportClientEndpointBehavior</span>" and "<span id="SPELLING_ERROR_29" class="blsp-spelling-error">NetTcpRelayBinding</span>" to show up in <span id="SPELLING_ERROR_30" class="blsp-spelling-error">Config</span> file. This may be because I was just using a Windows Application as test client instead of "cloud" supported client. With code, I could easily use the <span id="SPELLING_ERROR_31" class="blsp-spelling-error">ServiceBus</span> <span id="SPELLING_ERROR_32" class="blsp-spelling-error">namespace</span> and get it working.<br /><br />Sample client code is below:<br /><br /><span id="SPELLING_ERROR_33" class="blsp-spelling-error">GetCreditScore</span>.<span id="SPELLING_ERROR_34" class="blsp-spelling-error">GetCreditScoreRequest</span> <span id="SPELLING_ERROR_35" class="blsp-spelling-error">req</span> = new <span id="SPELLING_ERROR_36" class="blsp-spelling-error">GetCreditScoreRequest</span>();<br /><span id="SPELLING_ERROR_37" class="blsp-spelling-error">GetCreditScore</span>.<span id="SPELLING_ERROR_38" class="blsp-spelling-error">GetCreditScoreResponse</span> res = new <span id="SPELLING_ERROR_39" class="blsp-spelling-error">GetCreditScoreResponse</span>();<br /><span id="SPELLING_ERROR_40" class="blsp-spelling-error">NetTcpRelayBinding</span> <span id="SPELLING_ERROR_41" class="blsp-spelling-error">tcpRelayBinding</span> = new <span id="SPELLING_ERROR_42" class="blsp-spelling-error">NetTcpRelayBinding</span>();<br /><span id="SPELLING_ERROR_43" class="blsp-spelling-error">TransportClientEndpointBehavior</span> <span id="SPELLING_ERROR_44" class="blsp-spelling-error">clientEndBeh</span> = new <span id="SPELLING_ERROR_45" class="blsp-spelling-error">TransportClientEndpointBehavior</span>();<br /><span id="SPELLING_ERROR_46" class="blsp-spelling-error">clientEndBeh</span>.<span id="SPELLING_ERROR_47" class="blsp-spelling-error">CredentialType</span> = <span id="SPELLING_ERROR_48" class="blsp-spelling-error">TransportClientCredentialType</span>.<span id="SPELLING_ERROR_49" class="blsp-spelling-error">SharedSecret</span>;<br />clientEndBeh.Credentials.SharedSecret.IssuerName = "owner";<br />clientEndBeh.Credentials.SharedSecret.IssuerSecret = "Extract this from <span id="SPELLING_ERROR_50" class="blsp-spelling-error">Appfabric</span> Portal";// (it will look something like the crossed out section in the Image 2" )<br /><span id="SPELLING_ERROR_51" class="blsp-spelling-error">EndpointAddress</span> endpoint = new <span id="SPELLING_ERROR_52" class="blsp-spelling-error">EndpointAddress</span>("sb://shashiraina-demo.servicebus.windows.net/Test.Biztalk.Cloud.Orch/WcfService_Test_Biztalk_Cloud_Orch.svc");<br /><br /><span id="SPELLING_ERROR_53" class="blsp-spelling-error">WcfService</span>_Test_<span id="SPELLING_ERROR_54" class="blsp-spelling-error">Biztalk</span>_Cloud_<span id="SPELLING_ERROR_55" class="blsp-spelling-error">OrchClient</span> client = new <span id="SPELLING_ERROR_56" class="blsp-spelling-error">WcfService</span>_Test_<span id="SPELLING_ERROR_57" class="blsp-spelling-error">Biztalk</span>_Cloud_<span id="SPELLING_ERROR_58" class="blsp-spelling-error">OrchClient</span>(<span id="SPELLING_ERROR_59" class="blsp-spelling-error">tcpRelayBinding</span>, endpoint);<br />client.Endpoint.Behaviors.Add(clientEndBeh);<br /><br /><span id="SPELLING_ERROR_60" class="blsp-spelling-error">req</span>.Score = new Score(); ;<br />req.Score.FirstName = "<span id="SPELLING_ERROR_61" class="blsp-spelling-error">Shashi</span>";<br />req.Score.LastName = "Raina";<br />req.Score.SSN = "123-234-2323";<br /><br />res.Root = new Root();<br />res.Root = client.GetCreditScore(req.Score);<br /><br />Response from the service is below: (Go Ahead and tried it out from your machine)!<br /><br /><img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 400px; DISPLAY: block; HEIGHT: 196px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5550655808011437650" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVkZalrSgGQC6kt9Rj9MctZKT23IPmQZ6liyf0PvTtsMYF_kozUIvoDYtK_06YPVRzn9LjDkcrsBJEPxUI1UaSlhtyqB5ztFfjjPme9XXtRVy1wqvptqHZ3FcPMna1x3H7EeyDjw/s400/results.gif" /><br /><br />Image 3<br /><br /><br />So, without punching a hole in your DMZ, you could expose your <span id="SPELLING_ERROR_62" class="blsp-spelling-error">Biztalk</span> services to outside world. I have been involved in complex configurations in ISA reverse proxy to expose <span id="SPELLING_ERROR_63" class="blsp-spelling-error">Biztalk</span> services to outside world. But using "<span id="SPELLING_ERROR_64" class="blsp-spelling-error">Appfabric</span> Connect for Services" , all these complex configurations can be eliminated. Moreover, the <span id="SPELLING_ERROR_65" class="blsp-spelling-error">ACS</span> (Access Control Services) that is part of Azure <span id="SPELLING_ERROR_66" class="blsp-spelling-error">Appfabric</span> allows creating your own plug-in security framework.<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com2tag:blogger.com,1999:blog-11313996.post-37572014149212256472010-11-29T17:07:00.000-05:002010-11-29T17:12:36.125-05:00Integrating Biztalk with Mobile CE deviceOne of my recent projects involved developing Biztalk services to be consumed by Windows CE mobile devices. I got a chance to work with compact Microsoft framework. In an ideal world, one would expose Biztalk as WCF service and use advanced feature set to integrate the services with the mobile client using compact framework. There is a whole set of compact power tools with own svc generating utility that matches svcutil.exe of .net framework world. Compact framework svcutil may work well with pure WCF kind of services (not tested though) but it will not work with Biztalk services that are exposed as WCF using WCF publishing wizard. It seems there is a bug in the svc util tool for compact framework and the only other option is to consume exposed WCF as a webservice from the client side. This can be done by simply using Add Web Reference option in the mobile client project. Doing this will generate requisite client side proxy objects to talk with the exposed Biztalk service. Service side is to be exposed as WCF with basic-http binding to be consumed as a web service from mobile client. There is one caveat to this approach though. While using a SSL at transport level, it was observed that the client could not pass the request to the service hosted inside the corporate domain from a client situated on WAN (internet). Everything would work fine for calls made within the LAN though. The key difference between LAN and WAN scenarios was the use of reverse proxy ISA. Client requests would have to be routed through ISA for WAN scenarios whereas in LAN scenario ISA will be automatically by passed. This issue could be circumvented by exposing Biztalk as ASMX service (instead of WCF) and using SOAP adapter. Apparently, the security information that is carried over from client through ISA to Biztalk is carried in the envelope part of the SOAP message over the wire. It is possible that the way this security information is formatted in a service exposed as WCF v/s the one exposed as ASMX service is different. That could possibly explain why the client call will work in WAN scenario for ASMX type service and not work for WCF type service.<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-68000215645888943642010-09-28T16:00:00.003-04:002010-09-28T21:47:39.179-04:00Batching Non-EDI received documentsEDI Batching in Biztalk is done using Batching orchestration that is shipped with Biztalk. This batching orchestration is directly binded with MessageBox and picks up message with EDI.ToBeBatched=True. This flag is set when the message is received using edi receive pipeline. There is a component called "BatchMarker" in the receive pipeline that promotes and sets "EDI.ToBeBatched=True".<br /><br />In scenario when the incoming message is a Non-EDI type (i.e a Positional Flat file), we have two options to promote the context properties that are required for Batching orchestration to work correctly. First option is to use Orchestration and second is to use a custom pipeline. In this example, I will demonstrate how to use an orchestration:<br /><br />1. Create an orchestration that takes the Flat File message as input message<br />2. Create a Outbound Msg (Msgout) representing EDI schema<br />3. Add a map that does FF-->EDI conversion.<br />4. Create a correlation set containing 3 EDI context properites. Set these 3 propeties inside an expression shape within the context of a constuct block.<br /><br />EDI834_Out(EDI.ToBeBatched)=true;<br />EDI834_Out(EDI.BatchId)=1; //get this ID from "Parties"<br />EDI834_Out(EDI.EncodingType)=0;// 0 for X12; 1 FOR EDIFACT<br /><br />5. <strong>Initialize the correlation set in send port. This is the key step to promote the 3 context properties else you may end up "writing" the properties and not promoting them.</strong><br />6. Bind the Orchestration Send Port directly to MessageBox<br />7. Create a Send Port that Filters "EDI.ToBeBatched=False". You may further differentiate by adding filter for BatchID.<br />8.Deploy the orchestation and start the send port.<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com4tag:blogger.com,1999:blog-11313996.post-59493261464109371782010-09-04T23:54:00.006-04:002010-09-05T00:13:12.290-04:00Modifying Biztalk EDI SchemasThere are times when standard Biztalk EDI schemas need to be expanded to include additional validations. It is a 2 step process.<br /><br />1. Modify the relevant EDI schema and preferably modify the namespace to differentiate it from standard schema. Deploy it.<br /><br />2. Go To-->Biztalk Admin Console-->Parties-->Select Partner--> Right Click-->EDI Properties-->Click on "Validation and ACK"-->Check "Extended Validation" (Image below)<br /><br /><br /><p><img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 400px; DISPLAY: block; HEIGHT: 265px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5513276455930023154" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2yArdtzooett7cr0Cpkv7MbrJfiiELmKHlo9xNArVJRhvzdCcsl8xGNFArvnBmbIDTK3XdUfi6KGEIHweL_4B-fC8GlAsUFAnDv-nyYigftFBGPILoApFVcKaZvqcn-ClFS5igw/s400/EDI.gif" /> </p><p> </p><p>Checking "Extended Validation" tells Biztalk Engine to validate against the custom schema validations. This is in addition to standard EDI schema validations that come out of box.</p><p> </p><div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-31486744836709683652010-08-27T09:45:00.004-04:002010-08-27T09:59:33.443-04:00Extending VPC hard driveIt has been a while since I last blogged. During this period, lot of things have happened in my life. We were blessed with twins and I took a new role with a new company. A role that lets me focus on integration more deeply and also puts me more closer to my clients. Recently, I completed a POC integrating Mobile Windows Devices with Biztalk. It was an exciting experience. No, this blog is not about Mobile integration. This is about something that we face a lot while using VPC images. Well, sooner or later we all will run out of C drive space on our VPC. Yes, it is straight forward to add a new hard drive and name it anything (say D). But that still does not do anything to existing C drive space. There are some programs that by default install on C drive and for these programs C drive should have enough space. There is a way t0 install programs that are looking for C drive to a D drive for example. This post is not talking about that. This post will help to extend existing C drive without using paid softwares like Partition Magic. I actually used a free software to achieve this. Below are the steps:<br /><br />1. Add a new hard drive (.vhd file) to VPC of desired size but more than the existing hard drive (.vhd drive) that needs to be extended. Call this New partition D:<br />2. Use DriveImageXML a free software to create an image of existing hard drive (C:)<br />3. Restore the created image on to (D:)<br />4. shut down the VPC and remove the original drive C and keep only drive D:<br />5. Fire it up, you may get issues in booting up the new drive. Use http://www.runtime.org/driveimage_faq.htm. Go to section:<br /> I restored my boot drive, why does it not boot? <br />and follow Fix Manually section.<br />6. This should boot up the machine with new hard drive D:. But you may end up having a blank desktop and no programs will work. This is because they all were installed in drive C and the new drive being used is D. <br />7. To fix this use: http://support.microsoft.com/kb/223188<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-9816559073089302422008-12-27T14:31:00.004-05:002008-12-27T14:58:17.986-05:00Using Biztalk in transaction mode with a WCF clientWhile trying to use a WCF client to send a message to Biztalk as a transaction, I got the following error:<br /><br /><br /><strong>"Cannot access a disposed object. Object name: 'TransactionScope' "</strong><br /><strong></strong><br /><br />On investigation, I found that this can happen when:<br /><br /><ol><li>Recieve port/location does not have a corresponding subscription (orchestration / send port) created.</li><br /><li>Send Port is created but not enlisted. This is same as no subscription found in database.</li></ol><p>When enable <strong>transactions check box</strong> is clicked while configuring receive location as shown below:</p><p><img id="BLOGGER_PHOTO_ID_5284557455781560242" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 290px; CURSOR: hand; HEIGHT: 400px; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiURjImZBvSxVYKx6xD6WbT6tUq3aORifWVKfvBqarwDTTaaxmmM0AWS1WMAADvVY0PhGg7AwFp1lF5tECP3iAUyZAk-za1ne_TqsBhEI9-U46eVo3D0VZT8DNqNafBZVD2TwhOyw/s400/Transactions.jpg" border="0" /><br />Behind the scenes, a transaction scope object is created that will attach itself to incoming message sent from a client and form a one continious transaction involving MSDTC. This enables WCF client to control the whole transaction involving Biztalk. Client can use "commit" and "rollback" commands to commit and rollback message in Biztalk messagebox database. Very powerful!</p><p><strong>Reason:</strong></p><p>At core, Biztalk works on pub-sub mechanism. In absence of any subscription, receive location can't really participate in transaction and create a transaction object. Hence the error is raised "cannot access a dispose object" (transaction object)</p><p><strong>Solution</strong> is simple: Create a subscription for the receive port/location in form of a send port or an orchestration.</p><p></p><p></p><p></p><br /><p></p><br /><p></p><br /><p></p><br /><p></p><br /><strong></strong><div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-43906495137522200222008-10-05T12:43:00.012-04:002008-10-06T10:30:38.636-04:00Using SAP Biztalk 2006 R2 WCF adapter<div>Work involved in configuring SAP adapter can be divided into 2 steps. First step involves work done by Biztalk team and second step involves work done by SAP team.<br /><br /><strong>Step 1: BIZTALK TEAM</strong><br /><br />Biztalk side needs to define a Program ID. SAP adapter then registers this Program ID to the SAP gateway defined in the URL. This Program ID then needs to be registered from SAP side. <strong><em>SAP admin should follow “Performing Tasks Using the SAP GUI for Specific SAP Adapter Scenarios” section of SAPAdapter.chm file.<br /></em></strong><br />Program ID will be unique per listener else SAP will send the document to random listeners. Each Receive location will be tied to a unique Program ID for an environment. Example: If same receive location is being used in 3 environments (DEV, QA and Prod) then 3 Program IDS are required to be set up for that single receive location. RFC checks the connection between SAP and biztalk using program id registered channel. SAP then sends IDOC to biztalk. Biztalk accepts this IDoc and processes it.<br />Configure recv location as shown: </div><br /><div><br /></div><img id="BLOGGER_PHOTO_ID_5254042729000155010" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBLc7eCuik_mZswmv47j2R9wtKDyRLAkTv5OGo5vsrOLs6Mzn2qPZF7FOPS5K6Cf-Fpx0Kd4DpxTyppiyOoryD-jj6D9KG25lVQ2k1vNphcwRec9_g2ddCRnPtVNTUcX0xZKjYCA/s400/biz1.bmp" border="0" /><br /><strong><u>Configure following URL at recv location<br /></u></strong><br />sap://CLIENT=[client ID] ;LANG=EN;@a/[servername]/[system ID]<br />?ListenerGwHost=[hostname]&ListenerGwServ=[gateway service name] &ListenerProgramId=[Program ID}<br /><br />SAP team should supply with the above variables.<br /><strong>Do not forget to ask for user name and password to configure screen below:</strong><br /><br /><strong></strong><img id="BLOGGER_PHOTO_ID_5254048100780658194" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLRsY4NS0oIcreD_FHbPtVpXup18GfoPk8n-TY6wu4tuXPZSv9VSucj98JxDcg2jEVEcFHPw0er0qAyi9NkwjbW1WMOhQHMpSO0qP4FxDDlcHuvOYNzagsw0RtnOF-wFkgj97Gvw/s400/biz2.bmp" border="0" /><br /><strong>Step 2: SAP TEAM</strong><br /><br />SAP team to supply:<br /><br />1. client ID<br />2. servername<br />3. system ID<br />4. hostname<br />5. gateway service name<br />6. User ID<br />7. Password<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-38889601181415381922008-04-24T13:23:00.005-04:002008-05-03T10:02:02.905-04:00Configuring BAM and WSS adapter on 64 bit machine<p>BAM and WSS adapter have conflicting requirements for 64 bit machine. BAM needs 32 bit IIS and WSS 3.0 needs 64 bit IIS. To make matters further complex, it is not possible to host 32 bit IIS and 64 bit IIS on same 64 bit machine. So how can Biztalk communicate with a MOSS server running on 64 bit machine? Following configuration makes this possible:<br /><br />1) Enable 32 bit IIS on the 64 bit machine by running following command:<br /><br />cscript %SystemDrive%\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 <strong>1</strong> </p><p>(1 means “true” and 0 means “false”)<br /><br />2) Now, IIS is 32 bit and follow standard BAM configuration steps.<br />3) Install WSS 2.0 SP2 on the Biztalk machine to enable configuring WSS adapter. Also, configure WSS adapter on MOSS machine that hosts WSS 3.0<br />4) To install WSS 2.0, register ASP.Net 2.0 (32 bit version) from “Windows\Framework” folder by running aspnet_regiis.exe –i<br />5) Download and install WSS 2.0 SP2<br />6) Install WSS 2.0 in server farm mode and then create and extend the website. This website will host the WSS adapter.<br />7) When installing WSS 2.0 on clustered machine, use option “Join existing …”<br />8) Run Biztalk Configuration wizard and configure WSS adapter on Biztalk machine.<br />9) Run Biztalk Configuration Wizard on MOSS machine and configure adapter there.<br />10) Make the AppPool Account that is running WSS 2.0 website a member of SharePoint Group and SharePoint Site Collection on MOSS machine hosting WSS 3.0.<br /><br />When WSS is configured, it creates BTSharePointAdapterWS. WSS adapter uses this web service to communicate with MOSS form libraries, lists and document libraries. This service need not be running on Biztalk machine but it should be running on MOSS machine for proper communication back and forth.<br /><br /></p><div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-15173373092695638922008-01-08T12:01:00.000-05:002008-01-10T13:17:11.587-05:00Cross Updating Windows Workflow Tasks in Parallel ActivityParallel activities in Windows Workflow are independent as the name suggests. How could we then update Task A from Task B when Task A and Task B are running in parallel? After spending 1 hour, I figured it out.<br /><br />1) Use "Update Task" shape for updating Task A and drop it in the "parallel" arm of Task B. The position of this task could be above the "Complete Task" or as required. But it should be under the "create task" shape for Task B.<br /><br />2) <strong>Here is the imporant part</strong>. Set the correlation token as the correlation token used for Task A even though this task is under Task B related tasks. This correlation token will direct the <strong>update</strong> <strong>task</strong> to the correct task (Task A in our case)<br /><br />3) Bind the TaskID to existing Task ID for Task A.<br /><br />3) Use syntax "TaskProperties.ExtendedProperties["NameOfInfopathField_inTaskA_thatis_to_be_updated"]="desiredvalue"<br /><br /><strong>Important:</strong><br /><strong></strong><br />Parallel workflows in WF are actually processed in a sequence. Left branch is processed first and then control moves towards the right . While cross updating tasks, correlation ID is the key that ties the different tasks together. For tasks on the extreme right arm, all the correlation IDs in the workflow are available. But this selection reduces are we move towards left. In order to update a task on the right side of a given task, the correlation ID will not be available from the work flow design view. But going to deign code file(*.designer.cs / *.designer.vb) gives the flexibility to link the correlation ID with the task that is to be updated.<br /><br />i.e.<br /><br />this.UpdateFromTaskOnLeftSide =CorrelationToken (this will be token for the task on the right side that is being updated from left side).<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-30705177970323565882008-01-07T11:31:00.000-05:002008-12-13T00:59:12.669-05:00Accessing SQL data from Infopath Form ControlA control in infopath form can be configured to receive data from XML, WebService, SharePoint List and SQL database (only). In this article I will focus on using SQL database as secondary datasource. I used SQL database to hold values for login in one column and second column gave the user groups for that LogIn. I used these Groups to control the views that a user can access. For Example: You could add rule to restrict an IT user to view data for IT only and not for Finance or Marketing.<br /><br /><br /><br />This is what you do:<br /><br /><br />1) Create a table and name it "RulesGroup". Add two columns : <strong>UserLogIn</strong> and <strong>UserGroup</strong><br /><strong></strong><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyVcpqmb9Pr2jHjdcJ8qWvDubzTrJRCeiqqrKpTqKwuKl8mLOmY-6T5nlfXdhPK_W64AboGONViF_LviRKsbKRrLdHa3VZh0q0ChSttzuLNxGUaccrDMYQ7ruxoUuJm1cA7jMtLQ/s1600-h/Database.bmp"><img id="BLOGGER_PHOTO_ID_5152774993073292258" style="CURSOR: hand" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyVcpqmb9Pr2jHjdcJ8qWvDubzTrJRCeiqqrKpTqKwuKl8mLOmY-6T5nlfXdhPK_W64AboGONViF_LviRKsbKRrLdHa3VZh0q0ChSttzuLNxGUaccrDMYQ7ruxoUuJm1cA7jMtLQ/s400/Database.bmp" border="0" /></a><br /><br />2) In the infopath form create two text box control: UserName and UserGroup<br /><br />3) Create a secondary datasource and configure it to receive data from SQL database. Use the wizard to point to the correct table.<br /><br />4) In the infopath form: Use infopath function <strong>username</strong>() to populate <strong>UserName</strong> text box.<br />Map the <strong>UserGroup</strong> text box with following Xpath:<br /><br />xdXDocument:GetDOM("RolesGroup")/dfs:myFields/dfs:dataFields/d:RolesGroup[@UserLogIn = "shashi"]/@UserGroup<br /><br /><strong><em>PS: XML generated by the wizard marks the 2 user defined columns as "attributes". So there is need to user @ in Xpath expression.</em></strong><br /><strong><em></em></strong><br />In our case if UserName is "shashi" the UserGroup will be "Operations".<br /><br />New users and Groups can be added in DB as required and accordingly Infopath Views can be programmed based on Groups.<br /><br /><strong>Remember</strong>: While using form services to host infopath form, additional requirement will be creating a new Univeral Data Connection(UDC) file in Data Connection Library under the site collection. This UDC file maps the connection details between infopath form and SQL service. SQL server can't really authenticate the user name being passed directly from the infopath form. The user name comes as "" (blank). One way of getting around is to use proxy user name and password in case the user name is blank. But this will compromise security in Big Way. Use of UDC file helps in this regard. Also, it allows you set up custom User Groups based on User Names. These user groups can be then used to limit access to certain views as explained before in this article.<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-44769773599325122092007-12-31T14:51:00.001-05:002008-12-13T00:59:13.106-05:00Integrating MOSS, WF and InfopathI ventured into relatively "unchartered" territory of SharePoint world. I have been working on setting up a a framework involving MOSS, Windows WorkFlow and Infopath 2007. Business requirements are pretty standard. Client wants to set up a business process for "New Hire". When a new hire joins in certain business processes need to be fired. Like creating domain accounts, allocating hardware and setting up the user in different databases. Some of the processes will be executed in series and others in parallel.<br /><br />Goal is to set up a scalable architecture that can potentially hook up with Biztalk in near future. Essentially we are setting up "Business Process Management (BPM)" system. Recently my company established a partnership with a company (PNM Soft) that is one of the leaders in "BPM" software. I evaluated their software to be in a position to recommend it to my clients. It is a very powerful and easy to use software. Does not require much of coding and even a pure business user can design complex BPM processes using it.<br /><br />My ongoing work in developing a scalable framework for my client using MOSS and other tools will also help me in determining the value added by the "BPM" software with respect to designing a BPM process from scratch using standard MSFT technologies.<br /><br /><strong>Solution:</strong><br /><strong></strong><br /><br />1) 2 Infopath forms ( First form is a brower enabled form that is published on "sharepoint", Second Form is infopath Task form that is published on "network"). I tried to get "Single" form to do both. But I ran into problems. Sharepoint won't let me publish the same form as "workflow" attachment and also as "sharepoint" enabled form. The second form is actually what you will call "Task Item" Form. It is one of the 4 forms that Workflow uses.<br /><br />2) Workflow that is attached to a form library. Users publish the "first" form to the form library that triggers the "Workflow". This work flow is "sharepoint" sequential workflow.A good working demo can be found at:<br /><br /><a href="http://weblog.vb-tech.com/nick/archive/2007/02/25/2207.aspx">http://weblog.vb-tech.com/nick/archive/2007/02/25/2207.aspx</a><br /><br /><strong>Following are some helpful tips:</strong><br /><strong><br /><br /></strong>1) Cloning an infopath to create a second form is not a good practice. Infopath has a unique internal ID that will also copy over to new form and can create issues when both forms are used in a WF set up. I tried using one form as an Initiation form and second as Task Item form but could not get it working. I came across issue in passing parameters from work flow to the "Task Item" form. I am not aware of any workaround. But I think it is a good practice to create forms from scratch. I will not recommend the "schema first" approach for same reasons.<br /><br />2) Make sure that the "network" published infopath forms (*.xsn) listed under Metadata section of "workflow.xml" (part of WF solution) exists and are under the correct folder location. Delete the references of forms not being used from "workflow.xml". Else you may get error like "Form is closed".<br /><br />3) If you are using VSTA to code infopath forms. Make sure that the "dll" file is also part of the folder where *.xsn forms are located. Else you may be get an error " <strong><em>Type: InfoPathLocalizedException, Exception Message: The specified form cannot be found</em></strong>". Another thing that is to be kept in mind is use of "FormState" to define global variables. For browser enabled forms, there is need to preserve state across browser sessions. "FormState" helps you do that. The other option is to use workflow to pass the values into the "resource" file that is part of the infopath form. This "resource" file serves as "Secondary" data source and accepts values from Workflow and then updates the Infopath (Task form). I like this option better because using WorkFlow to maintain the state ensures that the "infopath" form is updated only after the workflow is executed. Thus making<br />sure that "state" the infopath work represents is actually the state that workflow<br />indicates. There is no need to use "FormState" property in latter case.<br /><p><strong>Example</strong>: Suppose user clicks on a check box on "Infopath Task form" indicating that the particular step is complete and workflow should flow to next step. If one preserves this state (of "check box" being clicked") using "FormState" then even if the workflow gives error the "checkbox" will still show as clicked and user will get an impression that the process is completed successfully as "check box" is clicked. But having workflow update this "checkbox" using "Extended Properties" ensures that this check box preserves the right state only after the workflow has done what it was suppose to do. </p>I <strong>noticed</strong> that order of populating "secondary data source" from workflow does matter. If the order is not correct the values will not propogate from <strong>workflow</strong> to <strong>secondary</strong> <strong>data</strong> <strong>source</strong> to <strong>Infopath</strong> form.<br /><br /><em><strong>Check out the image below:</strong></em><br /><img id="BLOGGER_PHOTO_ID_5151278269985080274" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzOjYZ52n_7Qf-N0io9AgOj4a9QfiGIWCH-hImLGCvUYcEC_QgXKrvwnUHXHItznjMwKR-Tm5gpa7YeNFSORFiRriGfIVUoEurdwn-voU6W3CmbPRVceQkChZWWQdWpZFFbGZM1Q/s400/Code.bmp" border="0" /><br /><strong>Note</strong>: The order of fields in "secondary" data source schema matches the order in which WorkFlow assign values.<br /><br /><br />Use "Trusted Security" while publising forms with embedded VSTA code.<br /><br />PS: VSTA and VSTO carry the same weight when used for "broswer" only forms.<br /><br />4) Windows Worfklow dll needs to be GACed but the dll for VSTA code is not required to be GACed. But it needs to be copied to the same folder on network where the forms are published.<br /><br />PS: <em>Suppose you create a infopath form with embedded VSTA code and then you remove the code before "publishing" it. You still need to "copy the dll" file in the correct folder containing .xsn form. Else you will get "Form have been closed" error.</em><em> I found this hard way! </em><br /><br />5) Everytime infopath form is changed it should be republished to the network. Also updated dll should be copied. Unistall/Install the feature. Workflows that are already in progress will be updated with the new changes. Keep this is mind before applying the changes. Accordingly wait for "In Progress" workflows to finish.<br /><br />6) There is no need to RE GAC the workflow dll if only infopath forms are changed. Also it is important to restart the IIS after GACing any new version updates. Restart ensures that the new changes come in effect.<br /><br />7) Do not try to change the Unique ID of form by going to "File----> Properties" in design view. It seems that there is more than 1 place where this unique ID is referenced in the form. This is the same ID that is referenced in "<span class="blsp-spelling-error" id="SPELLING_ERROR_0">workflow</span>.<span class="blsp-spelling-error" id="SPELLING_ERROR_1">xml</span>" and indicates to the <span class="blsp-spelling-error" id="SPELLING_ERROR_2">workflow</span> which form should be opened as Task Form, Initiation Form, Association form and Modification<br />Form.<br /><br />8) "check box" control in <span class="blsp-spelling-error" id="SPELLING_ERROR_3">Infopath</span> form can be changed from "Boolean" data type to "Text" data type and can be used to accept updates from <span class="blsp-spelling-error" id="SPELLING_ERROR_4">workflow</span> and this also gives more flexibility to<br />program it using <span class="blsp-spelling-error" id="SPELLING_ERROR_5">VSTA</span> and <span class="blsp-spelling-error" id="SPELLING_ERROR_6">VSTO</span>.<br /><br /><br /><br /><br /><strong>To Do this:</strong><br /><br /><br /><br /><br />Go to Design View -----> DataSource-----> Double Click on the "check box control" ----->Following type window will "pop-up"----->Change Date Type from "Boolean" to "String"---> This will enable the icon "Fx" and then click there. Now you can select the value that you want to pass from "Secondary Data Source" . This seconday data source will be configured to receive the XML from workFlow<br /><br /><br /><br /><br /><br /><br /><br /><img id="BLOGGER_PHOTO_ID_5151005178784531378" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF85z0NS2DGwxOXg2VRAZCEVhbWYu_LtEALkuKRAllS0Ku0uwGTccNKnpTSLeGFfoCcIV4vzdXj5CDJYgBowLEj8QtZ84rGjb3sCGv1GA-2zvSVd6IEu5DjXYu3AnzJf62pslj4g/s400/Recv.bmp" border="0" /> Also, double click on "check" box in form view and make the properties for the "check box" look like.<br /><img id="BLOGGER_PHOTO_ID_5151007815894451138" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7Gf-l1wkBZ5hcVeKHivuxShfa9y-ZRoslItsq5mfjEhu9pGjvsv_SSLF_hVc8OThgkd24vkwWXNw3tuXNsWM_W-fvPmgUfPoQQFzIUHn5DyyEOpUVs03cI1ZgkqkArSgyGX6QfQ/s400/Recv1.bmp" border="0" />Now when you pass values of "true" or "false" as string datatype from workflow, the check box will accept them.<br /><br /><br /><br />9) Use of Initiation form gives easy access the XML data stream that is following into WorkFlow. XML stream can be accessed through <strong>workflowProperties.InitiationData. </strong>I did not want to use Inititiation form as I wanted to "automatically" start WorkFlow when something new is published or something existing changes in Form Library. To do so you need to use following code in <strong>"WorkFlow Activity activated shape"</strong><br /><br /><br />SPWeb thisWeb = new SPSite(workflowProperties.SiteId).OpenWeb(workflowProperties.WebId);<br /><br />SPListItem thisItem = thisWeb.Lists[workflowProperties.ListId].GetItemById(workflowProperties.ItemId);<br /><br /><br />byte[] fileBytes = thisItem.File.OpenBinary();<br />UTF8Encoding encoding = new UTF8Encoding();<br />String xmlString;<br />xmlString = encoding.GetString(fileBytes);<br />xmlString = xmlString.Trim();<br /><br />// Desiralization. InitForm is class generated from schema of incoming message<br /><br />XmlSerializer serializer = new XmlSerializer(typeof(InitForm));<br />XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(xmlString));<br />InitForm initform = (InitForm)serializer.Deserialize(reader);<br /><br /><br />At the end, I concluded that the <span class="blsp-spelling-error" id="SPELLING_ERROR_7">BPM</span> software is very efficient when it comes to designing pure <span class="blsp-spelling-error" id="SPELLING_ERROR_8">BPM</span> solutions. <span class="blsp-spelling-error" id="SPELLING_ERROR_9">MSFT</span> tools are definitely powerful in complex B2B scenario and integration with other systems. But they are "overkill" for simple <span class="blsp-spelling-error" id="SPELLING_ERROR_10">BPM</span> scenarios.<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-5680020817163484962007-08-29T17:53:00.000-04:002008-12-13T00:59:14.837-05:00Implementing WCF<div><strong>Why WCF?<br /></strong><br />WCF aka Windows Communication Foundation services is latest product from MSFT for creating Distributive Applications. Year 2007 has been buzzing with new product releases on a weekly basis. It is sometimes hard to keep track of latest releases. I can speak for myself that I end up missing some new releases now and then. It is tough to keep one eye on client work and another eye on MSFT press releases. Now it has become part of job. Working in consulting sector is a 24/7 job. When you are not working with client, you are scanning different websites looking for bits and bytes on latest product releases and technology trends. I do love my job but sometimes it gets really tough to keep up with the pace of technology changes. Sometimes you have to be like Tiger Woods and chose to leave. If only everyone was as good as him!<br /><br />Distributive Technologies have become center of turf war for technology companies. Webservices is an important piece in this war. Turf is dotted with companies like Java and also open source products like Tungsten.<br /><br />WCF is a further enhancement of ASMX webservice released with .Net framework 2.0. WCF is part of .net framework 3.0 version. Version 3.5 is out too in form of beta version. WCF lets users get benefit of ASMX , WCE and messaging services as one product. WCF supports MSMQ, HTTP and TCP protocol. ASMX webservice only supports HTTP. Additional transports can be configured to WCF. <strong><em>WCF also offers configuration editor with GUI</em></strong> for monitoring performance, tracking messages and errors. This tool helps in reducing operation cost with out of box monitoring and tracing of data. Details at the end.</div><br /><div></div><div>It is highly flexible and configurable solution but does have some drawbacks as compared to .Net remoting. Especially when it comes to running multiple service host instances under single host. .Net remoting actually lets you add service instances. WCF can be run as self-hosting service, IIS or WAS. While running WCF as self hosting service, check the Task manager window. WCF service will show up as Services.exe. There will be only one instance of this service at one given time. Multiple instances are not supported.<br /><br /><br /></div><br /><br /><p><img id="BLOGGER_PHOTO_ID_5104493819819668610" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic889jYqLEBeKUJLct0ifL45Pwyud0gYdDmyuk4PoeshYNlwvElkMoQ2UOl2jRVyf19kCTuaJ7buajzqnHyke1RmKzKyG8noXIMKZ1KnxlEurTITbsH8GvSaLb4HjUoXGr46-geg/s400/services.jpg" border="0" /><br /><br /><strong>Demo:</strong><br /><br />Used MSFT base sample, Organized it and added personal notes and updates<br />1) Create a Blank Solution call WCF<br />2) Add a Project and Call it “Host”<br />3) Add a C# library file and call it “Host.cs”<br />· Add reference to System.ServiceModel.dll<br />4) Add another Project and call it “Client”<br /><br /><br /><strong>I ) <u>Create WCF Host</u></strong><br /><br /><br />5) Define Service Contract<br />// Define a service contract.<br />[ServiceContract(Namespace = "http://Microsoft.Demo.WCF")]<br />public interface IMath<br />{<br />[OperationContract]<br />double Add(double n1, double n2);<br /><br />}<br />Attribute “ServiceContract” marks the Interface to carry metadata for WCF.<br />Attribute “OperationContract” is equivalent to “Public” keyword. Client can access the service.<br />PS: Since the datatype used in simple we have not explicityly defined “DataContract”. For complex datatyype it is important to define DataContract explicitly. It is also a good practice to keep “ServiceContact” and “DataContract” as separate implementation.<br /><br />6) Implement the service<br /><br />Implementing service contract is a rather easy process. Just use a C# (VB) class and implement the service interface. This is the part where the logic behind the service is implemented.<br /><br />//Implement the service<br />public class MathService : IMath<br />{<br />public double Add(double n1, double n2)<br />{<br />double result = n1 + n2;<br />Console.WriteLine("Return: {0}", result);<br />return result;<br />}<br /><br />7) Create Host for the service<br /><br /><br />Till now the service is in form of library class. We will need a host to host the service. As mentioned earlier, there are 3 options:<br /><br />a. Create Self Host<br />b. Use IIS<br />c. Use WAS<br /><br />In this demo we will create our own host because it is easy to Debug. Before we create a host, we need to define the address where the service will reside.<br /><br />This step will contain following five steps:<br /><br />d. Create a base address for the service.<br />e. Create a service host for the service.<br />f. Add a service endpoint<br />g. Enable metadata exchange.<br />h. Open the service host<br /><br />// Step d<br />Uri baseAddress = new Uri("http://localhost:8000/DemoWCF/Service");<br /><br />// Step e<br />ServiceHost serviceHost = new ServiceHost(typeof(MathService), baseAddress);<br />try<br />{<br />// Step f<br />serviceHost.AddServiceEndpoint(<br />typeof(IMath),<br />new WSHttpBinding(),<br />"MathService");<br /><br />// Step g<br />ServiceMetadataBehavior smb = new ServiceMetadataBehavior();<br />smb.HttpGetEnabled = true;<br />serviceHost.Description.Behaviors.Add(smb);<br /><br />This step is required to run the svcutil command later on to download 2 client files (config and class). Otherwise user may get following error:<br /><br />“ There was no endpoint listening at http://localhost:8000/DemoWCF/service that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.<br />The remote server returned an error: (404) Not Found.”<br /><br />This step is optional if user decides to manually create both client files.<br /><br />// Step h<br />serviceHost.Open();<br />Console.WriteLine("The service is ready.");<br />Console.WriteLine("Press <enter>to terminate service.");<br />Console.WriteLine();<br />Console.ReadLine();<br />serviceHost.Close();<br /><br /><strong>II) <u>Create WCF client</u></strong><br /><br /><br /><img id="BLOGGER_PHOTO_ID_5104494013093196946" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" height="253" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjdhbfT1icaa3EczDxX5zcwag_NG9gxlmc0s4N1oDGE-MNqLXOW2TcIjtlL3OktBKN66d1N13tukeHt8KBMdE3LJEhxKIgn5Qtlqlf9OOQsDIh8p2nCYtlIrLSwonCYmfYTrRD9A/s400/DOS.jpg" width="396" border="0" /> 8) Run svcutil command to generate client class and config file<br /><br />C:\Program Files\Microsoft Visual Studio 8\Common7\IDE> svcutil /language:cs /out<br />:generatedClient.cs http://localhost:8000/DemoWCF/service<br /><br />2 generated files will be : output.config and generatedClient.cs.<br /><br />9) Add both of these clients to “Client” Project. The complete solution will look something like the imaage below. Note the added references. Rename them to app.config and MathClient.cs<br /><br /><br /><img id="BLOGGER_PHOTO_ID_5104494279381169314" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS_TuvaBVf4WcVKK3ANJrkP48LH3WVhWqfpBs7TYLasWcxiAJ5VJDjh3BwsttEyTlbtur4u1q2AvxJ4LEQ-uhy95HlSBVdQv6GQ5Ln3MyqGAlnY2nwNs6Yd4Pj-pEvcw94MclFXw/s400/STUDIO.jpg" border="0" /><br />10) Add the following code to Client.CS<br /><br />namespace Microsoft.Demo.WCF<br />{<br />class Client<br />{<br />static void Main()<br /><br />{<br /><br />try<br />{<br />//Create an EndpointAddress instance for the base address<br />This Endpoint address should be concatenation of baseAddress variable in Host class and stringaddress paramter in AddEndPoint method of Host class.<br /><br /><br /><br /><img id="BLOGGER_PHOTO_ID_5104494549964108978" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCvqMXxbApcp9e3hfxcqe25qeOFE09VLeMKMqoPAl3Z3t0JbeRKdjfa6g74o5ip-XZgWqFIktGtai_XG-kfTrH8cZCwmQCs20yOY5yScpLOWmebZGzMkUz2IrnaChjdxrvi34RPg/s400/code.jpg" border="0" /> EndpointAddress epAddress = new EndpointAddress("http://localhost:8000/DemoWCF/Service/MathService");<br />MathClient client = new MathClient(new WSHttpBinding(), epAddress);<br /><br />//Call the contract implementation in Host class from Client class.<br />double value1 = 29;<br />double value2 = 16.00;<br />double result = client.Add(value1, value2);<br />Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);<br /><br /><img id="BLOGGER_PHOTO_ID_5104494790482277570" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzeoiVa8QRxkIFijPzGBgno4-I8Nfjrh6ifSb0FzH7Ua9xlApVyGshXZ-EkG2Aqd4MXl0E-ak7R4Z6rmP7gumoEWGr1S0TbDRodLhuaXCcqw0fyjSqlj3GcNc4lF1VkyQBo6uLlQ/s400/results.jpg" border="0" /><br />//Close WCF client<br />client.Close();<br /><br />Console.WriteLine();<br />Console.WriteLine("Press <enter>to terminate client.");<br />Console.ReadLine();<br />}<br /><br />This is simple scenario where we have single service contract , single implementation and single endpoint.<br /><br /><strong>Scenario:</strong><br /><br />A new client comes in and wants to a new service contract called “Subtract”.<br /><br />Two ways of doing this:<br /><br />1) Add the new service “Subtract” in existing interface IMath<br />2) Create a new Interface IMath1 for “Subtract”<br /><br /><br /><strong>Add the new service “Subtract” in existing interface IMath</strong><br /><strong></strong><br />Most simplest of updates. But it does not gives us seperation between both as it is part of same interface. Implementation is still with same class and same service host and endpoint. Only thing that change is on the client side where the client calls “client.subtract” just like “client.Add” in the demo above.<br /><br /><strong>Create a new Interface IMath1 for “Subtract”</strong><br /><br />Create a new interface say IMath1 that contains “Subtract”. Create a second class say “MathService1”. We can’t use the same class to implement 2 interfaces under the same namespace, so we will need to create a new class to implement the new interface (service contract). Another problem that comes with this is the need to have 2 service shosts. Each service host is tied to unique class (service contract implementation). Since we are using “self created” host we can’t create 2 service hosts to implement 2 unique classes.<br />This is one of the drawback of WCF. Unlike .net remoting where we can add multiple instants of service host under single host, we can’t do same in WCF.<br />Using IIS as host can help solve this issue.<br /><br /><strong><u>Key Points</u></strong><br /><br />1) Each WCF service class implements at least one service contract, which defines the operations this service exposes.<br />2) For distributing different set of service to multiple numbers of clients, class can implement multiple endpoints each with a unique service contract.<br />3) Minimum 1 end point for each service host.<br />4) Each service host is tied up to only one implementation of contract (class)<br />5) To expose multiple services, you can open multiple service Host instances within the same host process.<br />5)<br />6) Although you can have multiple endpoints with a single service but only service type.<br />7) You can also dynamically create service with different implementing types. This can be achieved by dynamically creating new Service Hosts.<br />8) Each endpoint should have unique relative address</p><br /><br /><br /><p><strong><u>WCF Configuration Editor</u></strong></p><br /><br /><br /><p>This tool can be accessed from Visual Studio interface. Go to Tools ---->WCF Configuration Editor.</p><br /><br /><br /><p></p><img id="BLOGGER_PHOTO_ID_5104513752762889426" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgttdWLjQ6DDob3pY9NM0yYAqX6aJsR36zfiJyjvxsyCKQ2iaNBldgwIPo_ScQUu0k1g89EeeaeZkqKVO_LSzhnxak0mI7PPbgv7rOSU3CDkL1bZPpjHiUZ-4M4PNAM0hsVajhXiA/s400/Tools-ConfigEditor.jpg" border="0" /><br /><br /><p></p><p>Read the help file for details. In summary:</p><br /><p>1) Open the config file that was generated after running svcutility. This will populate different placeholders in GUI with relevant data. Click on <strong><em>EndPoint </em></strong>folder to view existing configuration. This information can be changed for the GUI without even touching XML file</p><br /><img id="BLOGGER_PHOTO_ID_5104513954626352354" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDJ8laXROmpc81b8ejzYNUBxYRvn4cOhr8CQl-2JmR2yyddxzb50sTHLi1SouofoNdRWS9x_H5GHGndCd_FZACCu3WLrNQulpBvlrgyITIA9cPLkrUwMhNufxOWcyZmoAx369n2w/s400/OpenConfigFile.jpg" border="0" /><br /><br /><p></p><br /><p>2) Click on Diagnostics folder and use <strong>Toggle</strong> switch to browse through various settings. Check out help file for details.</p><br /><img id="BLOGGER_PHOTO_ID_5104514122130076914" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgllo4bzUW1S-iXCrSqWJZDGZVphflCc9zpBmF0X-KNMYFJNbZZgGJYV3IeqVK-H-lia0pOhyphenhyphenG9HPFBkW8YicQOJta2r0ce64EgMrXbjXjx-nPlW5lsjIAIGvMOpwvSC5HRXW23g/s400/Diagnostics.jpg" border="0" /><br /><p>3) Closing the editor after changes will update the changes in the original <strong><em>app.config</em></strong> that was opened in first step. If we open config file, we see additional tags added to perform all the functions that we proposed in GUI.</p><p>4) Click on Host.exe file to start the service. Click on client.exe to start the client. All the events will be logged in file(s) whose location(s) can be set from "Diagnostic" folder in GUI.</p><div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-22825251747273948502007-08-21T18:04:00.000-04:002008-12-13T00:59:15.137-05:00Rules for Successful BAM implementationI learnt from my experience that by observing following rules BAM execution can become fairly smooth: <strong>Some of the steps are not "need to have" but rather "good to have".</strong><br /><br />1) Install SQL 2005 sp2<br />2) Ensure Analysis Services is installed (Else cubes/aggregations can't be created)<br />3) Do not forget to Configure BAM tools to "Enable Analysis Services for Aggregation" using Biztalk config tool. (Else cubes/aggregations can't be created)<br />4) Ensure that account being used is a member of the Group that is configured in Biztalk Config tool for BAM portal. (Else views in BAM portal may not be visible to the user )<br />5) Ensure that the user account under which BAM Application Pool is running is member of Biztalk Isolated Host and IIS_WG group.<br />6)Run following commands: (Else you may get 401 authentication error)<br /><br /><ul><li>cscript adsutil.vbs SET w3svc/NtAuthenticationProviders "NTLM"</li><li>setspn -A HTTP/servername domain\account</li><li>setspn -A HTTP/servername.fullyqualifieddomainname domain\account</li></ul><p><em>domain\account</em> is account under which BAM App Pool is running on IIS.</p><em>cscript can be found under: C:\Inetpub\AdminScripts<br /><br />setspn.exe can be found under the Windows 2003 CD-ROM at \support\tools\suptools.msi </em><br /><br />If you view the BAM portal but can't view all the "VIEWS" you created. It is most likely that the account you are using does not have permissions on "BAMPrimaryImport" table. Add that account (i.e, biztalkuser) and then assign the role (view) you want that user to see on BAMPortal. Check the image below:<br /><br /><br /><p></p><img id="BLOGGER_PHOTO_ID_5101604157232985202" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgATCNshWbSfqSKgSiW6Uh8ARNQrtYmXABxKhEmSpjng_m8QpElZnLoT_lXuQ0PlZx9lEy-cY4c2N0VON266NIVNeVnxbRwEU_v5LKT9cwXH0RQ8lUc5tfIOSCjPi25Lu8O2LtHgQ/s400/BAM.jpg" border="0" /><br /><p>In the image above. The user (<strong><em>biztalkuser</em></strong>) only have permission for bam_EndToEnd. If you want this user to see other views that you can for example click on "bam_Test1View". User will now be able to see both views on BAM portal. This way you can selectively grant users access to different views(roles). </p><img id="BLOGGER_PHOTO_ID_5101603611772138594" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4O9BlQBWk65vx8_2OGRrxTktey9ZTHfB48i2mdEn8EwtZVCDTp6ggC6StXFqIwYrCGw9hR7jnU0w7-U5O9oWmkfRzTAAYfuPoio0iXo9n8mBZsUptNS1yfOQgRnJWTOPox6E2vg/s400/bamportal.jpg" border="0" /> <p></p><p></p><p><strong><em>Please note</em></strong>: SQL 2005 creates Roles. You just have to assign them to the appropriate user. SQL 2005 does not supports concept of "Groups" anymore. Instead use <strong><em>Roles</em></strong>.</p><div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-22867485626049994592007-08-17T14:05:00.001-04:002008-12-27T14:59:40.716-05:00Strange behavior of Biztalk 2006 on SQL cluster environmentWhile testing Biztalk application on server farm mode at one of my client, I came across something interesting. This biztalk application used SQL adapter to connect from orchestration to execute stored proc. All tests for server farm went OK. Biztalk server fail over sequence worked fine. Net scala worked fine for web farm. We ran into issue when we tried failing over SQL cluster from original (initial) node to another. On the original node, everything worked perfect. On failing over to second node, I found that Biztalk application would not connect to the custom database to execute stored procedure. We thought may be it is a connection pool caching issue. We tried restarting the physical biztalk servers and hosts. Nothing worked. Then I thought that may be it is something to do with 32 Bit SQL adapter not working properly on 64 bit cluster (not a very smart assumption on retrospection). We also played with MSDTC settings by reducing the authentication level. Nothing worked. The fact that threw me off was that everything was working fine on original node. We only had one physical copy of entire Biztalk database on cluster and not multiple database instances. So, it did not make sense to me as if why the same database was acting differently with different instances of SQL on each node.<br /><br />I thought logically for 4 hours and tried different things. Nothing worked. I came back next day and starting thinking out of box or rather illogically. We gave explicit permissions to Biztalk service account on the "custom" database that contained stored procedures. <strong><em>We made Biztalk service account database owner and wolla! it worked!</em></strong> Yeah that simple! We could not understand the behavior but it worked. We thought of doing further post mortem. We took the permission away and failed over to original cluster node. It worked as it was working before. For some reasons Biztalk did not care for permissions while working on original node. We failed over again to second node without the permissions and it did not work again. We granted the permissions and it worked!<br /><br />We left the solution in that working state! But could not explain the reason for this behavior. We have couple of theories but none of them convincing. Is it a Bug? May be. Is it a cluster configuration? May be.<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0tag:blogger.com,1999:blog-11313996.post-67088426736945506072007-08-07T14:59:00.000-04:002007-08-10T15:13:46.248-04:00Biztalk and SilverLightGloves are off! MSFT is going head on against Adobe. With recent launch of Silverlight, a product that will compete against market leader Flash. MSFT dreams to snatch some serious business from Adobe. With Java version not lagging behind, market has just started heating up.<br /><br />SilverLight will enable developers deliver rich browser based applications. Great new tool for web developers. Richer out of Box BAM portal is one area that Biztalk can gain from this new development. Rich BAM portal with interactive charts and graphical real time display of data can really grab attention of Business Users. How about adding this on Biztalk 2008 wishlist!<div class="blogger-post-footer">Shashikant Raina</div>Shashikant Rainahttp://www.blogger.com/profile/03319940567629165057noreply@blogger.com0