by community-syndication | Sep 24, 2010 | BizTalk Community Blogs via Syndication
Suppose you want to unit test a workflow that has some external dependency like a database, web service, file or some other thing that makes testing inconvenient. The need to eliminate external dependencies when testing has led to a world of mocking frameworks that allow you to automatically generate a mock with pre-defined behavior.
I wanted to do the same thing with Activities in workflows and I’ve now added support for this to the latest release of the Workflow Test Helper project using a technique I call XAML Injection. The idea is that you deploy the .xaml file for your activity and the XamlInjector class uses it as input to create a test version of the XAML with the mock classes instead of the real ones.
For example, here is a test activity that calculates a sum of numbers returned from the various test activities. Each test activity returns the number at the end of its name so TestActivity1 will return 1.
Without Xaml Injection the calculated sum for this activity should be 1+1+1+4+4=13.
Suppose I wanted to replace some of the activities with special Mock activities. In that case I create Mock activities that have the same “interface” (Properties and In/Out arguments) as the activity they are mocking.
Then I create a XamlInjector and tell it about the activity types I want to replace. In the following example I’m going to leave the first instance of TestActivity1 in place, replace the second with TestActivity2 and the third with TestActivity3 and I want to replace all instances of TestActivity4 with TestActivity5. The resulting test version of the activity will calculate a sum of 1+2+3+5+5=16.
[TestMethod]
[DeploymentItem(@"WorkflowTestHelper.Tests\TestInject.xaml")]
public void ShouldReplaceTypesInXaml()
{
var xamlInjector = new XamlInjector("TestInject.xaml");
// The first TestActivity1 will not be replaced - will add 1 to sum
// Replace the second TestActivity1 with TestActivity2 - will add 2 to sum
xamlInjector.ReplaceAt(1, typeof (TestActivity1), typeof (TestActivity2));
// Replace third TestActivity1 with TestActivity3 - will add 3 to sum
xamlInjector.ReplaceAt(2, typeof (TestActivity1), typeof (TestActivity3));
// Replace all (2) TestActivity4 with TestActivity5 - will add 10 to sum
xamlInjector.ReplaceAll(typeof (TestActivity4), typeof (TestActivity5));
var activity = xamlInjector.GetActivity();
Debug.WriteLine(string.Format("Invoking Injected XAML activity {0}", activity.GetType()));
var wiTest = new WorkflowInvokerTest(activity);
// Act
wiTest.TestActivity();
// Total should be 1+2+3+10=16
wiTest.AssertOutArgument.AreEqual("sum", 16);
}
Special thanks to Dan Glick for helping me with the XamlReader/Writer code in this release.
Check it out – download Workflow Test Helper today!
by community-syndication | Sep 24, 2010 | BizTalk Community Blogs via Syndication
Pluralsight is pleased to provide all MSDN Subscribers with a FREE 1-Month Standard Subscription to the entire Pluralsight On-Demand! .NET training library.
The On-Demand! library features a wide range of beginner, intermediate, and advanced training courses on current and emerging Microsoft technologies, authored by our renowned team of Microsoft MVPs and RDs. The library contains courses on ASP.NET 4.0, MVC 2.0, Silverlight 4, Windows Azure, Visual Studio 2010, SharePoint 2010, SQL Server 2008, BizTalk Server 2009, and .NET Framework 4.0. The library also covers topics that will make you a better developer – things like design patterns, coding principles, software practices, and higher-level architecture.
To take advantage of this limited time offer, browse to the MSDN Subscriptions Special Offers page and follow the instructions for the Pluralsight On-Demand! offer. Note: you must be signed in to your MSDN Subscriptions account for this page to work.

by community-syndication | Sep 24, 2010 | BizTalk Community Blogs via Syndication
The way security is often still handled these days with each application keeping track of their own users is somewhat dated. Some form of Federated security, where a single separate server is responsible for the security of a whole series of applications, is the way to go. On the internet there are plenty of examples of this with applications using things like OAuth and leaving their security to others. In windows the preferred form of federated security is through Windows Identity Foundation and it is real easy to secure an ASP.NET site or WCF service using Windows Identity Foundation.
How about securing a workflow service?
As a workflow 4 service is just another WCF service securing it is just as easy as the steps below will demonstrate.
Before we start we need to install Windows Identity Foundation and the related WIF SDK using the two links provided.
To start with I created a small workflow service and a simple client application. No security yet and the client works as expected.
The console app is real simple and looks like this:
static void Main(string[] args)
{
try
{
var proxy = new ServiceClient();
var data = proxy.GetData(42);
Console.WriteLine(data);
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(ex.Message);
Console.ResetColor();
}
Console.ReadLine();
}
The service web.config is also standard and pretty short:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings />
<client />
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
This just works as expected and when I run I see the following output:
Securing this service using Windows Identity Foundation
First thing we need when we want to use WIF is a Security Token Service which will handle the actual security checks and provide the application with the required claims. There is an add-on for Active Directory on Windows 2008 we could use but in this case I am going to use the StarterSTS Dominick Baier wrote. Instead of hosting this myself I am going to use a publicly available instance hosted here by Thinktecture.
Adding the STS to the service is quite easy. With the WIF SDK another VS2010 menu option and wizard was installed to guide us through the process. One important thing is that VS2010 must run as administrator else this wizard will fail to complete.
The first page wants to know about the config file and the service URL used.
In the next page select existing STS and enter the address where the STS federation metadata is located, in the case of the Thinktecture StarterSTS this is https://identity.thinktecture.com/stsdm/FederationMetadata/2007-06/FederationMetadata.xml
Next specify to use encryption, using a default generated certificate will do just fine now.
And that is all we need, click through and select finish. If Visual Studio isn’t run in admin mode this will result in an error, if this happens just restart VS2010 with admin privileges and do it again.
After this wizard has completed the web.config file will contain quite a bit more data and look something like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="microsoft.identityModel" type="Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<location path="FederationMetadata">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
</system.web>
<system.serviceModel>
<bindings>
<ws2007FederationHttpBinding>
<binding>
<security mode="Message">
<message>
<issuerMetadata address="https://identity.thinktecture.com/stsdm/users/issue.svc/mex" />
<claimTypeRequirements>
<!--Following are the claims offered by STS 'http://sample.thinktecture.com/trust/stsdm'. Add or uncomment claims that you require by your application and then update the federation metadata of this application.-->
<add claimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" isOptional="true" />
<add claimType="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" isOptional="true" />
<!--<add claimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" isOptional="true" />-->
<!--<add claimType="http://sample.thinktecture.com/claims/office" isOptional="true" />-->
</claimTypeRequirements>
</message>
</security>
</binding>
</ws2007FederationHttpBinding>
</bindings>
<client />
<behaviors>
<serviceBehaviors>
<behavior>
<federatedServiceHostConfiguration />
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceCredentials>
<!--Certificate added by FedUtil. Subject='CN=DefaultApplicationCertificate', Issuer='CN=DefaultApplicationCertificate'.-->
<serviceCertificate findValue="CB484E11B065E559BB9D7221F0178E3C12848381" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<extensions>
<behaviorExtensions>
<add name="federatedServiceHostConfiguration" type="Microsoft.IdentityModel.Configuration.ConfigureServiceHostBehaviorExtensionElement, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</behaviorExtensions>
</extensions>
<protocolMapping>
<add scheme="http" binding="ws2007FederationHttpBinding" />
</protocolMapping>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<microsoft.identityModel>
<service>
<audienceUris>
<add value="http://localhost:1533/Service1.xamlx" />
</audienceUris>
<issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<trustedIssuers>
<add thumbprint="7974900A2BB2829BE987C17D2F4503F07C321032" name="http://sample.thinktecture.com/trust/stsdm" />
</trustedIssuers>
</issuerNameRegistry>
</service>
</microsoft.identityModel>
<appSettings>
<add key="FederationMetadataLocation" value="https://identity.thinktecture.com/stsdm/FederationMetadata/2007-06/FederationMetadata.xml" />
</appSettings>
</configuration>
The most important part is the <microsoft.identityModel> section which contains the Windows Identity Foundation setup.
If we run the client now we will see an exception with the following text:
Content Type text/xml; charset=utf-8 was not supported by service http://localhost:1533/Service1.xamlx. The client and service bindings may be mismatched.
No big surprise as the client isn’t aware yet of the new security measures and still sends a request using the BasicHttpBinding. To get the client to work we need to do an update service reference on the generated proxy. This will generate a new customBinding with all required Windows Identity Foundation settings.
Because the STS Dominick Baier has running supports multiple ways the user can authenticate, either username/password or certificate, we still need to fix the configuration a bit. Locate the <issuedTokenParameters> element used and replace it with the first one from the <alternativeIssuedTokenParameters> block using https://identity.thinktecture.com/stsdm/users/issue.svc/mixed/username address.
Running the client application now results in the following error:
SOAP security negotiation with 'https://identity.thinktecture.com/stsdm/users/issue.svc/mixed/username' for target 'https://identity.thinktecture.com/stsdm/users/issue.svc/mixed/username' failed. See inner exception for more details.
This makes sense as re haven’t specified any user credentials for the client yet. Adding the user student with password abc!123 through the client proxy solves this. The client code now looks like:
static void Main(string[] args)
{
try
{
var proxy = new ServiceClient();
proxy.ClientCredentials.UserName.UserName = "student";
proxy.ClientCredentials.UserName.Password = "abc!123";
var data = proxy.GetData(42);
Console.WriteLine(data);
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(ex.Message);
Console.ResetColor();
}
Console.ReadLine();
}
And now the client can work just fine with the secured service thanks to the StarterSTS hosted by Dominick.
Enjoy!
www.TheProblemSolver.nl
Wiki.WindowsWorkflowFoundation.eu
by community-syndication | Sep 24, 2010 | BizTalk Community Blogs via Syndication
Yesterday, another milestone has been reached in the rich history of BizTalk Server. The latest version, BizTalk Server 2010, RTM’ed. The version will be available for purchasing as from October 1.
Today it is already possible to start developing on the 2010 release, because the developer edition is now free and available for download here.
CODit congratulates the product team with this release that looks very stable and has some interesting new features. We participated successfully in the BizTalk Server 2010 TAP program, where we used the BizTalk Server 2010 beta version to work out a full TFS-integrated project lifecycle, including build-automation, automated testing, scrum-methodology
A full article on all new features can be found on the BizTalk Server Team Blog.
A very interesting feature that we blogged about was the integration between AppFabric and BizTalk Server with the Mapper and the LOB Activities. These blog posts can be found here:
- Using the LOB activity in AppFabric workflows
- Using the BizTalk mapper activity in AppFabric workflows.
Sam Vanhoutte, CODit
by community-syndication | Sep 23, 2010 | BizTalk Community Blogs via Syndication
The BizTalk team announced today that the latest version of BizTalk Server, BizTalk Server 2010, has been released to manufacturing. It will be available for purchase starting October 1 2010.
The Developer and Evaluation Editions are available effective today at the links below.
For those of you that were working with the public beta, your results may vary, but I was able to do an in-place upgrade from the BETA to the RTM with no issues at all, all BizTalk applications/settings/artifacts/BAM/etc were maintained. Nice!
The Developer Edition (which is now FREE) download is available here:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=938102b8-a677-4c20-906d-f6ae472b3a6a&displaylang=en
The Evaluation Edition download is available here:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=8b1069cf-202b-462b-8d10-bec65d315c65
I won’t re-hash what the team said, you can read *all* about the new release at the official BizTalk team blog post here:
http://blogs.msdn.com/b/biztalk_server_team_blog/archive/2010/09/22/biztalk-server-2010-released-for-manufacturing.aspx
Summary by Charles Young, one of my co-authors on BizTalk Server 2010 Unleashed, is here.
http://geekswithblogs.net/cyoung/archive/2010/09/23/biztalk-server-2010-rtm.aspx
by community-syndication | Sep 23, 2010 | BizTalk Community Blogs via Syndication
The BizTalk Server team announced today that BizTalk Server 2010 has RTMd.That’s a relief, as my reputation was on the line regarding RTM before the end of the month. Just this Tuesday I confidently told a prospective customer to expect an imminent announcement.
I’ve been playing with BTS 2010 for a little while now.It has been my constant companion while writing several chapters for the forthcoming BizTalk Server 2010 Unleashed.It looks great.As well as bringing BTS up to date with Visual Studio 2010 and SQL Server 2008 R2, it introduces some welcome improvements.First and foremost, for developers, is a re-worked mapper.A decade ago, the mapper was the ‘killer app’ (as Clemens Vasters put it at the time) that sold BTS 2000 licences. A lot has changed since then, but the mapper, although much copied over the years, remains a vital part of BizTalk tooling.The new version is head and shoulders over the previous version and, frankly, over much of the competition as well.In the last few days, I’ve constructed a couple of medium-complexity maps in BTS 2009.I really, really wished I was using BTS 2010.Even though the maps were not by any means the biggest and ugliest I have worked on, things would still have been much easier with the new version.Better still, you can use the new mapper in conjunction with WCF/WF workflow services in .NET 4 (under the beta, you had to have AppFabric installed – I haven’t tested this yet on the RTM version).It’s a great indication of how, as time goes on, BizTalk Server is supporting and extending WCF/WF to an ever-greater degree. There is much more water to flow under this particular bridge.
One more point about the mapper. It seems the hilariously named ‘Suggestive Match’ feature in the beta (wink, wink) has been renamed ‘Predictive Match’. They are a bunch of killjoys over there in Redmond, but I suppose double entrendres have no place in enterprise-level platforms.
The Trading Partner Management features have had a welcome makeover.Some of us older folk remember how BTS began life as the Commerce Interchange Pipeline (CIP) in Microsoft Site Server (ah, what a trip down memory lane!).BizTalk Server was originally conceived principally as a B2B product and has always had some TPM features.Over the years these have languished.BTS has excellent support for EDI standards (EDIFACT, X12 and AS2), but the TPM was relatively poor. That has changed in BTS 2010 with the introduction of a completely reworked model with new support for agreement templating and onboarding as well as new models for centralised management of identities, message types, validation, etc.
There are new features to please the operations guys who have to maintain BTS, including a new improved SCOM management pack, new rapid tuning features and data compression for backups.RFID Server has also been extended with a number of new event handlers and other features.
Looking through the official announcement, I am clearly going to have to revisit some of the adapter content I’ve recently been writing for BizTalk Server 2010 Unleashed. When looking at the beta, I discovered the SSL extensions to the existing FTP adapter, but MS keep on talking about a new FTPS adapter as if it is a separate item. This is currently confusing me.They also talk about new features of the File adapter which I didn’t discover in the beta.The beta documentation clearly stated that the old SQL Server adapter has been removed from the product, but it was still there in the beta.I will be interested to see if it is in the RTM version.If it is, I understand that it will not be supported.The old SOAP adapter, I believe, retains its deprecated status but is still supported.This caused me some pain earlier this year when we discovered that a customer, new to BizTalk Server, needed to integrate with a central system via web services written in an older version of Apache Axis. Axis used to use RPC/Encoded as the default SOAP style, and I had to explain to the customer that, having spent all that money on a bright shiny new integration server, the only way it could support this part of the SOAP specification was through a deprecated adapter.The WCF adapters have no support for RPC.Also, publishing ASMX web services via BizTalk with RPC support is not handled well. You have to make changes to the code generated by the publishing wizard to get everything working as required.<rant>For BizTalk Server to fail to provide good support for a major, if unfashionable, part of the SOAP spec, and to only support RPC via a deprecated adapter verges on the incredible.In the rush to adopt pristine-pure WCF, there is always the fear that Microsoft could lose sight of the whole purpose of BizTalk Server and the value proposition it offers to companies.It is an integration server.It is there to cope with mess and confusion, mediocre and bad practice, delinquent systemsand ancient protocols.Supporting things like RPC is what makes the cost of the license worthwhile.</rant>
I can’t yet comment on the stability of the development tools in BTS 2010. I haven’t experienced any major problems with the BTS 2010 beta, but I’ve yet to do any serious development in the new version. BTS 2009 dev tools were delivered in a poor, sometimes barely usable, state although subsequent hotfixes improved things significantly.The biggest issue in BTS 2009 remains the poor handling of references amongst multiple BizTalk projects.There were other problems as well.On my current project, I’ve been struggling just today with very peculiar and wrong behaviour when deploying a small cluster of BizTalk projects to a single application. I really hope that some headway has been made on these issues in BTS 2010 as they are an open sore in this otherwise excellent, stable and mature product.
So, welcome to BTS 2010, and congratulations to Microsoft on getting this version out of the door in the stated timeframe. Keep up the good work.
by community-syndication | Sep 23, 2010 | BizTalk Community Blogs via Syndication
Yesterday someone contacted me in regards to adding a secondary persistence store to their AppFabric installation – they were trying to configure the environment so that workflow service A persists its instances to Store A, while workflow service B persists to Store B. Simple enough, right? Well, I realized that there was no documentation on how exactly to achieve this configuration. So, here you go
Manual registration of additional persistence stores
- The first step of course, is to physically create and initialize a persistence database. Start the Configure AppFabric wizard, and select next to go to the Hosting Services config page. Tick the Set persistence configuration checkbox, select sqlStoreProvider as the Persistence provider, and click the Configure button:
- In the Persistence Store Configuration window, tick the Initialize persistence store checkbox, specify the Server and Database names for the new persistence database, and then click OK:
Note: Do no tick the “Register AppFabric persistence store in root web.config” checkbox – we will add the required entries manually.
- Now, if you open your root web.config, towards the end of the file you will find a section that “declares” the instance stores that AppFabric knows about. Here’s an extract with the default config from my machine:
- To declare a new persistence store, you should create another <add> element under <instanceStores>. Note that you will also need to define a corresponding connection string under the <connectionStrings> element a bit further down in the file. Your modified web.config file should look similar to:
- Save the file. You now have a second persistence store that you can use for your workflow services.
Scripted Version
To perform the above tasks you can also use the AppFabric PowerShell cmdlets as follows:
- Start a PowerShell cmd window with elevated privileges and import the AppFabric management module:
import-module ApplicationServer
- Create and initialize a new persistence database using the Initialize-ASPersistenceSqlDatabase cmdlet:
Initialize-ASPersistenceSqlDatabase -Database “NewDB” -Server “NewDBServer\SQLEXPRESS” -Admins “Domain\AppServerAdmins” -Readers “DOMAIN\AppServerReaders” -Users “DOMAIN\AppServerUsers”
Note: The user groups you specify for the -Admins, -Readers, and -Users parameters will be specific to your environment
- Use the Add-ASAppSqlInstanceStore cmdlet to register the persistence store in the root web.config file:
Add-ASAppSqlInstanceStore -Name secondarySqlPersistenceStore -ConnectionString “Data Source=sqlServerName2\SQLEXPRESS;Initial Catalog=NewDB;Integrated Security=True” -root
Here is the copy/paste-ready script:
import-module ApplicationServer
Initialize-ASPersistenceSqlDatabase -Database “NewDB” -Server “NewDBServer\SQLEXPRESS” -Admins “Domain\AppServerAdmins” -Readers “DOMAIN\AppServerReaders” -Users “DOMAIN\AppServerUsers”
add-ASAppSqlInstanceStore -Name secondarySqlPersistenceStore -ConnectionString “Data Source=sqlServerName2\SQLEXPRESS;Initial Catalog=NewDB;Integrated Security=True” -root
Final notes
The above steps register the new persistence store at the root level (through the root web.config file). This means that the new store will be available for use by all AppFabric applications running on machine. You may also choose to add a persistence store at a specific scope in the IIS application hierarchy. For the scripted version, the only difference will be in the parameters passed to the cmdlet in step 3 – the full list of parameters for the cmdlet is available on its documentation page.
by community-syndication | Sep 23, 2010 | BizTalk Community Blogs via Syndication
Many of you have been waiting for this, and BizTalk 2010 has just been released to manufacturing. It will be available for purchase starting October 1st, 2010. The evaluation and free Developer editions are now available for download from the BizTalk Server website.
Cheers
Peter
by community-syndication | Sep 23, 2010 | BizTalk Community Blogs via Syndication
It is there! For more information see this link. Tagged: BizTalk, BizTalk 2010
by community-syndication | Sep 23, 2010 | BizTalk Community Blogs via Syndication
During European BizTalk Conference we were told BizTalk 2010 was going to be released before end of September and moment has come. It offers a developer edition, which can be downloaded. BizTalk Server 2010 Developer is a free edition of BizTalk Server that enables developers to build and test applications that run on BizTalk Server on both 32-bit and 64-bit platforms. BizTalk Server 2010 Developer includes all of the functionality of Enterprise Edition, but is licensed only for development, test, and demo use. Solutions from BizTalk Server 2010 Developer Edition can easily be packaged and deployed to a production environment that is configured with any other edition of BizTalk Server 2010.
Besides that BizTalk Server 2010 introduces a new feature “AppFabric Connect”, which combines rich proven features of BizTalk Server and the flexible development experience of .NET to allow users to easily develop simple integration applications (See Installing the BizTalk Server 2010 AppFabric Connect feature). AppFabric Connect uses Windows Workflow Foundation (WF) activities to programmatically access BizTalk’s LOB connectivity and data transformation capabilities. This enables users to easily create new composite applications using the WF model, which can be deployed, hosted, managed in Windows Server AppFabric.
You as developer can setup an environment using virtualization (VM-ware, VPC, Hyper-V or Virtual Box), Visual Studio 2010, BizTalk Server 2010 Developer, SQL Server 2008 Developer and Windows Server AppFabric. Not just that cause you could add Windows Azure SDK to it and you can start building all kinds of state of the art applications.
Cheers!
Technorati: biztalk server 2010 appfabric