<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0"><id>tag:blogger.com,1999:blog-14758839</id><updated>2009-06-22T20:56:56.572+01:00</updated><title type="text">Yossi Dahan [BizTalk]</title><subtitle type="html">Yossi Dahan is a business processes and integration consultant living and working in the UK and focusing mostly on Microsoft technologies namely .net and Microsoft BizTalk Server.

Through his blog Yossi hopes to share the challanges, successes and failures he faces day by day, as well as just general thoughts and ideas around the technologies.</subtitle><link rel="alternate" type="text/html" href="http://www.sabratech.co.uk/blogs/yossidahan/default.html" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default?start-index=26&amp;max-results=25" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://www.sabratech.co.uk/blogs/yossidahan/atom.xml" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>210</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><geo:lat>51.322137</geo:lat><geo:long>-0.588733</geo:long><link rel="self" href="http://feeds.feedburner.com/YossiDahan" type="application/atom+xml" /><feedburner:browserFriendly>This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site, subject to copyright and fair use.</feedburner:browserFriendly><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry><id>tag:blogger.com,1999:blog-14758839.post-132046024287222765</id><published>2009-06-22T20:56:00.001+01:00</published><updated>2009-06-22T20:56:56.661+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Federated Identity" /><category scheme="http://www.blogger.com/atom/ns#" term="Geneva" /><title type="text">Implementing Single Sign Out scenario with the Geneva Framework</title><content type="html">&lt;p&gt;One of the items on my to-do list for a while now was to add support for single sign out in our passive scenarios; the idea is that if a user browses to several RPs, and then hits the sign out button on one of them, she would automatically be sign out of all the other RPs visited in this session.&lt;/p&gt;  &lt;p&gt;Whilst, as you will see shortly, the framework has great support for this scenario, and it is easily achieved, it is not the out-of-the box behaviour; out of the box – if you’re using the SignInStatus control (with or without the FAM) and the FederatedPassiveTokenService control, when the user hits the sign-out button of the SignInStatus control, she will be signed out of the current RP, as well as the STS itself, but any other RPs the user had visited in this session will keep her logged in.&lt;/p&gt;  &lt;p&gt;So – if the user browsed to application A, authenticated at the STS, and then browsed to application B, she is not signed on in both applications as well as on the STS; hitting the sign out button in application B will sign her out of application B as well as of the STS; if she tries to browse to application B now (with no browser caching), she will get redirected to the STS, and would need to re-authenticate there; same would happen if she tried to browse to any application other than application A, which is protected by the STS; within application A, however, the user would still be authenticated and she will be able to keep using this app.&lt;/p&gt;  &lt;p&gt;In some cases this may be acceptable, but in our case the users assume that if they hit sign out, they are signed out of the entire “set”, and so we were set on achieving this behaviour.&lt;/p&gt;  &lt;p&gt;It turns out that the framework has great support for this scenario, and that only very little code is required to achieve this; in fact – on the RP side – there’s nothing to do.&lt;/p&gt;  &lt;p&gt;Both the FAM and the SignInStatus controls handle requests to sign off out of the box, all you have to do is send an HTTP request with &lt;em&gt;“wa=wsignoutcleanup1.0”&lt;/em&gt; in the query string and the framework will take care of removing the local cookies; it will even return a nice image to indicate success (you can control which image to show through configuration); &lt;/p&gt;  &lt;p&gt;To see this in action – create a standard scenario with two RPs configured to use a single STS; add to your STS an ASPX page,&amp;#160; which would look something like this (you will need to update the urls to point at your RPs) - &lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="background: #ffee62"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@ &lt;/span&gt;&lt;span style="color: #a31515"&gt;Page &lt;/span&gt;&lt;span style="color: red"&gt;Language&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;C#&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;AutoEventWireup&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;CodeBehind&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SignOut.aspx.cs&amp;quot; &lt;br /&gt;                        &lt;/span&gt;&lt;span style="color: red"&gt;Inherits&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;HRG.Profile.Identity.STS.Web.Passive.SignOut&amp;quot; &lt;/span&gt;&lt;span style="background: #ffee62"&gt;%&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="color: #a31515"&gt;DOCTYPE &lt;/span&gt;&lt;span style="color: red"&gt;html PUBLIC &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &lt;br /&gt;                      &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;html &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; &amp;gt;&lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;body&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;form &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;form1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;img &lt;/span&gt;&lt;span style="color: red"&gt;src&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;https://localhost/ststests/testwebsite4/default.aspx?wa=wsignoutcleanup1.0&amp;quot; /&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;br &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;img &lt;/span&gt;&lt;span style="color: red"&gt;src&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;https://localhost/ststests/testwebsite3/default.aspx?wa=wsignoutcleanup1.0&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;form&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;body&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;html&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;In the code behind add the following - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;protected void &lt;/span&gt;Page_Load(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #2b91af"&gt;FormsAuthentication&lt;/span&gt;.SignOut();&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now run through your scenario - login to one application, then browse to another, then browse to this test page; you should see a couple of “green ticks” indicating you have been signed out of both applications.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now try to browse to either of them (make sure to refresh to pages to avoid browser caching) - you should notice that you’re no longer authenticated in neither (nor the on the STS) and that your’e redirected to the STS’ login page. cool!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So- we’ve proved that there’s really nothing to do on the RP side to achieve single sign out; but what do we need to do on the STS side? well – when the user hits the sign out link button on the SignInStatus control a request goes to the configured url for the STS, so this would be the entry point; what we really need to do is figure out a way to, for example, dynamically generate a page similar to our test page above; to do that we need to be able to a) track the RPs a user had visited and b) control the behaviour of the STS when the user hits sign-out on any RP, to make the required sign out requests to all the other RPs.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Until now I’ve been using the STS control (FederatedPassiveTokenService) in my passive STS, and so – to add behaviour required I would have to extend it, which is not something I felt comfortable doing; the alternative was to get rid of the control altogether and simply write the code required to handle both sign in and sign out from scratch, which is something I wanted to experiment with (in fact – I had to do much of it it in a different area of my solution – bridging single sign out protocols, but that’s for another post), so I though this is a good opportunity to give it a go.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;As it turns out, as the framework has all the code to do the heavy lifting, all I needed to do is “control the flow”, and it was all relatively painless - I removed the controls from my page, and started to replace it by placing code in the code behind - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;First – I needed to figure out what request I’ve received from the caller; this was as simple as two lines - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;WSFederationMessage &lt;/span&gt;message = &lt;span style="color: blue"&gt;null&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: blue"&gt;bool &lt;/span&gt;messageCreated = &lt;span style="color: #2b91af"&gt;WSFederationMessage&lt;/span&gt;.TryCreateFromUri(Request.Url, &lt;span style="color: blue"&gt;out &lt;/span&gt;message);&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;messageCreated now indicates whether the request to the STS was a valid one, message is expected to be either SignInRequestMessage or SignOutRequestMessage (there are two other possible request types that are not currently supported by the framework, but that’s for another day)&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Before I’ll go back to my single sign out scenario, I need to complete the single sign in scenario as I no longer have the control on the page (I could, potentially, leave the control on the page and do nothing if the message was a sign in request – leaving the control to do all the work, and if the message was a single sign out request execute whatever code I needed to achieve that, but I wanted to get rid of the control so I implemented code for both paths) &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So – to implement the single sign in my STS needed to call the STS, get a SignInResponse message and write that to the Http response stream, how is this done? well – there may be many favours, but the main code would look something like this (some elements removed for bravity) - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(message &lt;span style="color: blue"&gt;is &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SignInRequestMessage&lt;/span&gt;)&lt;br /&gt;{&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;   &lt;span style="color: #2b91af"&gt;SignInRequestMessage&lt;/span&gt; requestMessage = message &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SignInRequestMessage;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: green"&gt;// Create our STS backend&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #2b91af"&gt;SecurityTokenService &lt;/span&gt;sts = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MySTS&lt;/span&gt;(stsConfig);&lt;br /&gt;&lt;br /&gt;&lt;span style="color: green"&gt;// Create the WS-Federation serializer to process the request and create the response&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #2b91af"&gt;WSFederationSerializer &lt;/span&gt;federationSerializer = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;WSFederationSerializer&lt;/span&gt;();&lt;br /&gt;&lt;span style="color: #2b91af"&gt;WSTrustSerializationContext &lt;/span&gt;serialisationContext = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;WSTrustSerializationContext&lt;/span&gt;();&lt;br /&gt;&lt;span style="color: green"&gt;// Create RST from the request&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #2b91af"&gt;RequestSecurityToken &lt;/span&gt;request = federationSerializer.CreateRequest(requestMessage, serialisationContext);&lt;br /&gt;&lt;br /&gt;&lt;span style="color: green"&gt;// Get RSTR from our STS backend, &lt;br /&gt;//the thread's principal would not be an IClaimsPrincipal, so create one from the contained identity&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #2b91af"&gt;IClaimsPrincipal &lt;/span&gt;principal = &lt;span style="color: #2b91af"&gt;ClaimsPrincipal&lt;/span&gt;.CreateFromIdentity(&lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;.CurrentPrincipal.Identity);&lt;br /&gt;&lt;span style="color: green"&gt;//issue the RSTR&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #2b91af"&gt;RequestSecurityTokenResponse &lt;/span&gt;response = sts.Issue(principal, request);&lt;br /&gt;&lt;span style="color: green"&gt;// Create Response message from the RSTR&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #2b91af"&gt;SignInResponseMessage&lt;/span&gt; response = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SignInResponseMessage&lt;/span&gt;(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Uri&lt;/span&gt;(response.ReplyTo), &lt;br /&gt;                                                           response, &lt;br /&gt;                                                           federationSerializer, &lt;br /&gt;                                                           serialisationContext); &lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;response.Write(Page.Response.Output);&lt;br /&gt;Response.Flush();&lt;br /&gt;Response.End();&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I’m creating an instance of the STS for each request, but am re-using the sts configuration class (which I keep as an “Application” variable in the STS’ asp.net application).&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I’m then using a federation serialiser to create the RST, run this through the STS (providing the principal, “converted” to a ClaimsPrincipal) and then create a SignInResponseMessage out of the RSTR returned by the STS;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Job done – my STS now supports single sign in without the control; &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;You can already imagine what I needed to do to complete the sign out support- to start with I needed to add an else-if to handle SignOutRequestMessage (as I’ve mentioned – there are other types of requests theoretically possible, but lets not worry about them at the moment) - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;else if &lt;/span&gt;(message &lt;span style="color: blue"&gt;is &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SignOutRequestMessage&lt;/span&gt;)&lt;br /&gt;{&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The first thing I would do there, is sign out the user from the STS itslef - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;FormsAuthentication&lt;/span&gt;.SignOut();&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;All I needed to do now is add bog standard ASP.net code to generate the required Http Get requests to all my RPs; but to do this I needed to keep track of which RPs a user had visited within the session, so I know which RP’s to sign her out of; to help me achieve that I’ve created the following class to track the user’s visited realms - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;VisitedRealmsTracker&lt;br /&gt; &lt;/span&gt;{&lt;br /&gt;     &lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;, &lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; visitedRealms = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;, &lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;();&lt;br /&gt;&lt;br /&gt;     &lt;span style="color: blue"&gt;public void &lt;/span&gt;Add(&lt;span style="color: blue"&gt;string &lt;/span&gt;sessionId, &lt;span style="color: blue"&gt;string &lt;/span&gt;realm)&lt;br /&gt;     {&lt;br /&gt;         &lt;span style="color: blue"&gt;string &lt;/span&gt;key = sessionId + &lt;span style="color: #a31515"&gt;&amp;quot;|&amp;quot; &lt;/span&gt;+ realm;&lt;br /&gt;         &lt;span style="color: blue"&gt;lock &lt;/span&gt;(visitedRealms)&lt;br /&gt;         {&lt;br /&gt;             &lt;span style="color: blue"&gt;if &lt;/span&gt;(!visitedRealms.ContainsKey(key))&lt;br /&gt;                 visitedRealms.Add(key, sessionId);&lt;br /&gt;         }&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; GetAllRealmsForSession(&lt;span style="color: blue"&gt;string &lt;/span&gt;sessionId)&lt;br /&gt;     {&lt;br /&gt;         &lt;span style="color: green"&gt;//find all visited realms for this session and return the second part of they key (after the '|') which would be the realm&lt;br /&gt;         &lt;/span&gt;&lt;span style="color: blue"&gt;return from &lt;/span&gt;visitedRealm &lt;br /&gt;                &lt;span style="color: blue"&gt;in &lt;/span&gt;visitedRealms &lt;br /&gt;                &lt;span style="color: blue"&gt;where &lt;/span&gt;visitedRealm.Value == sessionId &lt;br /&gt;                &lt;span style="color: blue"&gt;select &lt;/span&gt;visitedRealm.Key.Split(&lt;span style="color: #a31515"&gt;'|'&lt;/span&gt;)[1];&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     &lt;span style="color: blue"&gt;public void &lt;/span&gt;ClearUserEntries(&lt;span style="color: blue"&gt;string &lt;/span&gt;sessionId)&lt;br /&gt;     {&lt;br /&gt;         &lt;span style="color: blue"&gt;lock &lt;/span&gt;(visitedRealms)&lt;br /&gt;         {&lt;br /&gt;             &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; keys = &lt;br /&gt;                 visitedRealms.Where(realm =&amp;gt; realm.Value == sessionId)&lt;br /&gt;                              .Select(realm=&amp;gt;realm.Key).ToList();&lt;br /&gt;             &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: blue"&gt;string &lt;/span&gt;key &lt;span style="color: blue"&gt;in &lt;/span&gt;keys)&lt;br /&gt;                 visitedRealms.Remove(key);&lt;br /&gt;         }&lt;br /&gt;     }&lt;br /&gt; }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I’ve added a member of this type to my STS Configuration class, which – you would remember – I now keep as an application variable, and so I could add a call to Add in the STS code handling the sign in request I showed earlier, which would ensure I’m tracking all the visited realms; the sign out logic could now iterate over the results of the GetAllRealmsForSession and handle the logout requests, simple code to achieve this could be something like - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt;(&lt;span style="color: blue"&gt;string &lt;/span&gt;realm &lt;span style="color: blue"&gt;in &lt;font color="#000000"&gt;stsC&lt;/font&gt;&lt;/span&gt;onfig.Tracker.GetAllRealmsForSession(Session.SessionID))&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: green"&gt;//get realm configuration&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #2b91af"&gt;    ReliantPartyConfigurationElement &lt;/span&gt;rpConfig = Configuration.ReliantParties[realm];&lt;br /&gt;    &lt;span style="color: green"&gt;//create an image pointing the at realm's signout url appending the signout and cleanup action&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Image &lt;/span&gt;img = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Image&lt;/span&gt;();&lt;br /&gt;    img.ImageUrl = rpConfig.SignOutUrl.Trim()+&lt;span style="color: #a31515"&gt;&amp;quot;?wa=wsignoutcleanup1.0&amp;quot;&lt;/span&gt;;&lt;br /&gt;    Repeater1.Controls.Add(img);&lt;br /&gt;    &lt;span style="color: green"&gt;//add a line break after each realm&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #2b91af"&gt;LiteralControl &lt;/span&gt;br = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;LiteralControl&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;&amp;lt;br /&amp;gt;&amp;quot;&lt;/span&gt;);&lt;br /&gt;    Repeater1.Controls.Add(br);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This sample code simply creates the same images I’ve previously had hard coded in the test page dynamically.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;With all the code in place – sign in requests are being processed by code instead of the control, with the code now customised to keep track of visited realms, sign-out requests use this tracked information to dynamically build a page that issues the required Http get request to all the visited RPs to sign the use out of all of them; single sign out achieved. easily.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-132046024287222765?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Z2bUU6eTkIeEeHPHK36Ic3I7Eo8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Z2bUU6eTkIeEeHPHK36Ic3I7Eo8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Z2bUU6eTkIeEeHPHK36Ic3I7Eo8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Z2bUU6eTkIeEeHPHK36Ic3I7Eo8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=hilCaLAgkHo:rCFeVmjRs4o:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=hilCaLAgkHo:rCFeVmjRs4o:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=hilCaLAgkHo:rCFeVmjRs4o:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=hilCaLAgkHo:rCFeVmjRs4o:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=hilCaLAgkHo:rCFeVmjRs4o:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=hilCaLAgkHo:rCFeVmjRs4o:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/hilCaLAgkHo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/132046024287222765/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=132046024287222765" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/132046024287222765" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/132046024287222765" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/hilCaLAgkHo/implementing-single-sign-out-scenario.html" title="Implementing Single Sign Out scenario with the Geneva Framework" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/06/implementing-single-sign-out-scenario.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-8744059880873883017</id><published>2009-06-12T11:26:00.000+01:00</published><updated>2009-06-12T11:27:01.638+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Federated Identity" /><category scheme="http://www.blogger.com/atom/ns#" term="Geneva" /><title type="text">Geneva Framework and Url case sensitivity- solved?</title><content type="html">&lt;p&gt;I’ve &lt;a href="http://www.sabratech.co.uk/blogs/yossidahan/2008/12/never-thought-url-would-be-case.html" target="_blank"&gt;blogged &lt;/a&gt;before (somewhat briefly, for a change) about my surprise when I learnt that URLs are [largely theoretically, in my view] case sensitive and the problem that this causes for a Geneva Framework based passive STS implementation.&lt;/p&gt;  &lt;p&gt;In that post I mentioned&amp;#160; a solution suggested by Peter Korn at the time – setting the path of the cookie to the domain root (‘/’) instead of the application path (including virtual directories), as, unlike the rest of the path, the domain name in a URL is not case sensitive, this works well, and I though it was “case closed”; until recently, when I’ve realised this solution has a very significant drawback - as the cookie, containing the authorisation token from the STS, is stored at the root of the domain, it will be served to every application under that domain, which is taking single-sign-on slightly too far :-)&lt;/p&gt;  &lt;p&gt;Following this approach it is not possible allow access to one application and deny it from another (on the same domain) other than through claims processing in the applications themselves, which is a less secure approach from an architecture perspective); clearly not a good solution then…&lt;/p&gt;  &lt;p&gt;So – I needed to go back to storing the cookie in the correct path, which would ensure that the STS is re-visited when trying to access a second application (even in the same domain), which – in turn – would mean that the user’s permissions are re-evaluated, before a second, application-specific, token is provided; with that - came back the problem of the URLs being case sensitive.&lt;/p&gt;  &lt;p&gt;Thankfully, we’re now on the TAP program for the Geneva Framework, and we’re getting great support by the guys at Redmond (can’t thank them enough!), and after bringing up this issue in a discussion, Shiung Yong suggested another approach to solving this - overriding the GetReturnUrlFromResponse method in the WSFAM.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;(Side track: The more I work with the Geneva Framework the more impressed I am with the extensibility options it provides, sure – it’s hard to figure those out on your own if you don’t know about them, and yeah – the resulting solution is often somewhat fragmented, with bits of code in several places, but that’s not much different from many other solutions in this space I suspect – you can see this with many WCF implementations – on the upside, however, if you’re willing to put the sweat, you can do pretty much everything (but yes – the continuum moves from adding a couple lines of code to re-writing the framework :-) )&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;To understand why and how Shiung’s solution works, consider the following scenario, describing the problem (and here’s where my description is bound to get somewhat confusing) - &lt;/p&gt;  &lt;p&gt;Out of the box, the flow of circular redirects, when the URL in the browser is entered in the “wrong” casing, is as follows - &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;font face="Trebuchet MS"&gt;The user types in the RP’s URL, let’s say - all in uppercase, into the browser&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font face="Trebuchet MS"&gt;As the http request to the RP does not contain an authentication token at this point, the FAM at the RP redirects it to the STS, providing the RP’s ‘realm’ to the STS (the ‘realm’ is configured at the RP and is intended to provide a unique URI to the STS, which it can use to identify the RP, and, for example, be used to load the relevant configuration such as which certificates to use when creating the token); the original URI the user had typed in is also provided through the query string (the ru property in wctx); optionally, and crucially, the RP may also provide the wreply query string parameter, based on its configuration; it is expected that the STS will forward the request, after authentication the user, to this address (but this is not mandated), this will become a key point shortly.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font face="Trebuchet MS"&gt;Still at the STS the user authenticates (generally using a login screen), and the STS redirects the request, with a ‘sign in response’ message containing an authentication token back to the RP; as mentioned before it is expected that this would be the address provided by the wreply (and this would be the default behaviour provided by the framework, but this can be easily overridden in the STS’ implementation); for this example, lets assume that the configured value, echoed in the wreply property is set to be in lowercase (remember – the user typed in the URL in the browser in uppercase).&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font face="Trebuchet MS"&gt;The redirect request contains the set-cookie instructions with the token from the STS and so the browser would set the required cookies in the address the STS redirected to - the lowercase address.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;In the step that would follow, the FAM does its sign-in ‘magic’, which concludes by redirecting the request to the URL set in the STS’ response message through the ru field in the query string - this is the URL the user typed into the browser initially, kept by the RP and then the STS - which is all uppercase&lt;/li&gt;    &lt;li&gt;At this point, FAM is called again for the new request, attempting to extract the authentication cookie, but as the cookie was stored on the URL the STS redirected to – which was lowercase - and the browser is now using the URL the user typed initially – which is all uppercase - the cookie is not served by the browser, and thus not found in the server code, and the user is being redirected back to the STS as if this was the first call; &lt;/li&gt;    &lt;li&gt;As the request arrives to the STS with the uppercase url again, the above would happen again and again in an endless cycle.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;font face="Trebuchet MS"&gt;Confused? hopefully not too much…but to summarise - out of the box, if the two (the URL configured as the reply to address in the RP, or any other URL the STS uses to redirect back to the RP)&amp;#160; and the URL typed into the browser by the user) are not [case-sensitive] identical, the cookie will be set, but subsequently not found when attempted to be read and thus authentication at the RP would continuously fail.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;In comes Shiung’s solution - &lt;/p&gt;  &lt;p&gt;As long as there’s a convention in the implementation as to the correct form of the URLs (or if drowning in more configuration is acceptable) the FAM could be extended to over come this - &lt;/p&gt;  &lt;p&gt;Step 5 above mentions the FAM has some ‘magic’ authentication work with a redirect in the end; the built in implementation uses the ru field to obtain the address to redirect to, but there’s a good extension point there in the form of the GetUrlFromResponse method of the FAM which is called to obtain the url; by overriding this function you can provide whatever logic you wish to control the URL the FAM would redirect the request to after authenticating the request.&lt;/p&gt;  &lt;p&gt;Lets say we can agree (as we have) that all reply to addresses will always be configured in lowercase (whilst we can’t control user behaviour, we can control our own configuration), with that agreed we can override the GetUrlFromResponse to always convert the ru value to lowercase before returning it to the bulit in functionality – here’s my version of the method, as suggested by Shiung - &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; CaseInsensitiveFAM : Microsoft.IdentityModel.Web.WSFederationAuthenticationModule     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; GetReturnUrlFromResponse(System.Web.HttpRequest request)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span class="kwrd"&gt;string&lt;/span&gt; returnUrl = &lt;span class="kwrd"&gt;base&lt;/span&gt;.GetReturnUrlFromResponse(request);     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span class="kwrd"&gt;return&lt;/span&gt; returnUrl.ToLower();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt; &lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;  &lt;p&gt;(it is important, of course, to remember to configure the RP to use your custom FAM and not the build-in one - &lt;/p&gt;  &lt;pre class="csharpcode"&gt;        &lt;span class="rem"&gt;&amp;lt;!--&amp;lt;add name=&amp;quot;WSFederationAuthenticationModule&amp;quot;&lt;br /&gt;                 type=&amp;quot;Microsoft.IdentityModel.Web.WSFederationAuthenticationModule, &lt;br /&gt;                       Microsoft.IdentityModel, Version=0.6.1.0, Culture=neutral, &lt;br /&gt;                       PublicKeyToken=31bf3856ad364e35&amp;quot;/&amp;gt;--&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;CaseInsensitiveFAM&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;CaseInsensitiveFAM, Utilities&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;)&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;What had just happened? &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;  &lt;li&gt;By convention, we ensured the RP provided a lowercase reply to address to the STS.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;The STS uses this (lowercase) address to forward the request containing the authentication token, and this is where the cookies will be set.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;The FAM uses GetUrlFromResponse to retrieve the URL to redirect to, my customised version ensures this would always be lowercase, aligned with the RP configuration&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;The browser is redirected, again to the lowercase address, this time to receive the cookies set in step 2 which means the request is now authenticated and the user is let in; no more circular redirects!&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Of course I’ve implemented a hardcoded rule (always lowercase), but you could use configuration, investigate the http request message or any other logic you’d like…&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;font face="Trebuchet MS"&gt;Some issues remain with that approach (that I can think of) - &lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;font face="Trebuchet MS"&gt;If, at this point, the user goes and types the URL in a different casing, as the cookie already exists and the FAM code will not execute again, the user will get redirected to the STS for authentication, but that’s fair enough – I don’t know of any user that would do that in real life..and the result (requiring re-authenticaiton) is quite acceptable&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;font face="Trebuchet MS"&gt;The other thing is that this solution would break should an application be case sensitive (for query string parameters, for example), but we don’t have that problem, and it could be handled by more sophisticated code in the custom FAM, so that’s ok as well.&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I suspect this is not the clearest post I’ve ever published (but, unfortunately, probably not the worst), so I can only hope someone will manage to make sense of it and find it useful; I’m pretty sure I’ll need it for future reference; there’s no chance I’m remembering all of this!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;font size="2" face="Consolas"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-8744059880873883017?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/mIZ5Db9xApCucyTKqByEbB10NBA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mIZ5Db9xApCucyTKqByEbB10NBA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/mIZ5Db9xApCucyTKqByEbB10NBA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mIZ5Db9xApCucyTKqByEbB10NBA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=on2eauYktpo:IySRitMLMZ8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=on2eauYktpo:IySRitMLMZ8:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=on2eauYktpo:IySRitMLMZ8:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=on2eauYktpo:IySRitMLMZ8:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=on2eauYktpo:IySRitMLMZ8:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=on2eauYktpo:IySRitMLMZ8:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/on2eauYktpo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/8744059880873883017/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=8744059880873883017" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/8744059880873883017" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/8744059880873883017" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/on2eauYktpo/geneva-framework-and-url-case.html" title="Geneva Framework and Url case sensitivity- solved?" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/06/geneva-framework-and-url-case.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-6737366949463503825</id><published>2009-05-26T09:35:00.001+01:00</published><updated>2009-05-26T09:35:16.262+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk" /><category scheme="http://www.blogger.com/atom/ns#" term="Deployment" /><category scheme="http://www.blogger.com/atom/ns#" term="Oslo" /><title type="text">Oslo based solution for deploying BizTalk applications – published</title><content type="html">&lt;p&gt;Unfortunately life is a bit hectic for us at the moment, and it’s been a while since I’ve posted anything, or was able to do anything other than family or work. &lt;/p&gt;  &lt;p&gt;As part of this general “neglect” I was unable to spend the time required to complete, and publish, my Oslo based solution for deployment BizTalk applications (given the somewhat ugly, but suitably short, name – BTSDF), but as many waited (ok – more than 5), and some kept asking (2), I thought I’d do my best to get something out of the door, so I have. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;in &lt;a href="http://btsdf.codeplex.com/" target="_blank"&gt;Codeplex&lt;/a&gt;&amp;#160; you can now find an initial version published, which includes – the language definition, the core runtime I have as well as two “executors” in various stages of [non] completeness – my MsBuild generator is already quite useful for simple apps, it generates a set of MSbuild files you can use to deploy the application on any machine as well as the required SDC tasks dlls and targets file; the API executor deploys the app on the current machine, and is quite basic, but a good sample (I think) and a reasonable starting point.&lt;/p&gt;  &lt;p&gt;I’m happy to entertain requests for changes/additions, and even more happy to add any one who’s willing and able to put the time as a contributor; Oslo knowledge is optional! :-)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;You can download the source, build and run it locally – but you will have to remember to copy the two executors dlls from their folders to the main bin\debug folder as there is no compiled reference to them. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I’ve also uploaded an “Alpha release” which includes the compiled assemblies and the supporting files required.&lt;/p&gt;  &lt;p&gt;There’s still more work to do, but it’s getting shape now, and I’m using the MSbuild executor today; it certainly needs a bit more documentation, which I hope to get around to…&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I hope this works for you, let me know what you think (the good and the bad), and – if you have some time and will – drop me a line and I’ll add you to the team!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Yossi&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-6737366949463503825?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xyHS3eL9gJ_baIMP0ApOt67FPC4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xyHS3eL9gJ_baIMP0ApOt67FPC4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xyHS3eL9gJ_baIMP0ApOt67FPC4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xyHS3eL9gJ_baIMP0ApOt67FPC4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=-JAjB5NHseg:ZzGBX-Pv9SY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=-JAjB5NHseg:ZzGBX-Pv9SY:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=-JAjB5NHseg:ZzGBX-Pv9SY:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=-JAjB5NHseg:ZzGBX-Pv9SY:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=-JAjB5NHseg:ZzGBX-Pv9SY:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=-JAjB5NHseg:ZzGBX-Pv9SY:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/-JAjB5NHseg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/6737366949463503825/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=6737366949463503825" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/6737366949463503825" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/6737366949463503825" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/-JAjB5NHseg/oslo-based-solution-for-deploying.html" title="Oslo based solution for deploying BizTalk applications – published" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/05/oslo-based-solution-for-deploying.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-9215986630935662387</id><published>2009-04-01T08:35:00.001+01:00</published><updated>2009-04-02T13:39:47.319+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Federated Identity" /><category scheme="http://www.blogger.com/atom/ns#" term="Geneva" /><title type="text">RoleClaimsMapper for the Geneva Framework</title><content type="html">&lt;p&gt;Briefly back on my STS work - &lt;/p&gt;  &lt;p&gt;Our STS implementation can already replace the authentication implementation of most of our applications; naturally we can’t do that just yet, given that the Geneva-framework has not been released yet, but all of my tests are quite positive so we’re just waiting for the opportunity to start using it.&lt;/p&gt;  &lt;p&gt;However, so far, we&amp;#160; were not in a position to replace the authorisation mechanism, not easily anyway, and that’s something that was on my list for some time now.&lt;/p&gt;  &lt;p&gt;The STS provides a list of claims, which the applications can relatively easily access via code, as many samples show, and this proves very useful; application can investigate various claims about a user and drive their functionality from that.&lt;/p&gt;  &lt;p&gt;It does mean, though, that the applications need to change to support this new claims based mode for authorisation, which is not something we can just assume we would be able to do; as a start, we just want to achieve an in-place replacement for our current authorisation logic.&lt;/p&gt;  &lt;p&gt;Most of our web apps currently use ASP.net membership and roles and so they extensively use ‘IsInRole’ checks to figure out user authorisation and drive the application behaviour, to start with, we had to hook to that mechanism.&lt;/p&gt;  &lt;p&gt;Luckily the Geveva framework has a relatively good support for exactly this need - , out of the box, it would convert any claims of the Microsoft role namespace (‘&lt;a title="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" href="http://schemas.microsoft.com/ws/2008/06/identity/claims/role"&gt;http://schemas.microsoft.com/ws/2008/06/identity/claims/role&lt;/a&gt;’) to roles; so – if a token included a claim of this type with a value of ‘Manager’, a call to HttpContext.Current.User.IsInRole(“Manager”) would return true.&lt;/p&gt;  &lt;p&gt;And so I made sure my STS adds any roles with the correct claim type, very easy. &lt;/p&gt;  &lt;p&gt;However – this is very Microsoft centric. what about all those claims that come from systems that don’t follow Microsoft’s approach? (how dare they!) ? and what about us wanting to have our own claims, using our own types, some matching roles (while others may not…) - &lt;/p&gt;  &lt;p&gt;Well – we needed a way to map any claims to ms-role claims before the Geneva framework does its bit.&lt;/p&gt;  &lt;p&gt;As is often the case - Dominick Baier was most helpful in &lt;a href="http://www.leastprivilege.com/ClaimsAuthenticationManagerInGeneva.aspx" target="_blank"&gt;posting&lt;/a&gt; on exactly that, and so, following his example, I created my RoleClaimsMapper - &lt;/p&gt;  &lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; RoleClaimMapper : ClaimsAuthenticationManager&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; IClaimsPrincipal Authenticate(&lt;span class="kwrd"&gt;string&lt;/span&gt; endpointUri, IClaimsPrincipal incomingPrincipal)&lt;br /&gt;        {&lt;br /&gt;            &lt;span class="rem"&gt;//load configuration section for component&lt;/span&gt;&lt;br /&gt;            RoleClaimsMapperConfigurationSection config = &lt;br /&gt;                (RoleClaimsMapperConfigurationSection)ConfigurationManager.GetSection(&lt;span class="str"&gt;&amp;quot;RoleClaimsMapper&amp;quot;&lt;/span&gt;);&lt;br /&gt;            &lt;span class="rem"&gt;//create a collection of claim types and populate from configuratoin&lt;/span&gt;&lt;br /&gt;            List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; claimsToMap = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;(config.RoleClaims.Count);&lt;br /&gt;            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (RoleClaimConfigurationElement claimElement &lt;span class="kwrd"&gt;in&lt;/span&gt; config.RoleClaims)&lt;br /&gt;                claimsToMap.Add(claimElement.ClaimType);&lt;br /&gt;                &lt;br /&gt;            &lt;span class="rem"&gt;//loop on all identities, we really only expect one, but can easily support multiple.&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (IClaimsIdentity identity &lt;span class="kwrd"&gt;in&lt;/span&gt; incomingPrincipal.Identities)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class="rem"&gt;//extract the claims that we need to map (matching the configured list of claims)&lt;/span&gt;&lt;br /&gt;                IEnumerable&amp;lt;Claim&amp;gt; roleClaims = &lt;br /&gt;                    identity.Claims.Where&amp;lt;Claim&amp;gt;(c =&amp;gt; claimsToMap.Contains(c.ClaimType));&lt;br /&gt;                &lt;span class="rem"&gt;//now create a role claim (using the MS role claim type) for each claim found; &lt;/span&gt;&lt;br /&gt;                &lt;span class="rem"&gt;//need to keep this outside claim loop so we don't modify the collection while iterating&lt;/span&gt;&lt;br /&gt;                List&amp;lt;Claim&amp;gt; claimsToAdd = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Claim&amp;gt;(roleClaims.Count()); &lt;br /&gt;                &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (Claim claim &lt;span class="kwrd"&gt;in&lt;/span&gt; roleClaims)&lt;br /&gt;                    claimsToAdd.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; Claim(Microsoft.IdentityModel.Claims.ClaimTypes.Role, claim.Value,claim.ValueType,&lt;span class="str"&gt;&amp;quot;local&amp;quot;&lt;/span&gt;,claim.Issuer));&lt;br /&gt;                &lt;span class="rem"&gt;//add new claims to current identity&lt;/span&gt;&lt;br /&gt;                identity.Claims.AddRange(claimsToAdd);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; incomingPrincipal;&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I then configured my authentication manager with the framework - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;microsoft.identityModel&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;claimsAuthenticationManager&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;RoleClaimMapper,Identity.Utilities&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;/pre&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;and added my bit of custom configuration&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;RoleClaimsMapper&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;RoleClaims&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;Type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://someDomain.com/identity/claims/SomeRole&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;Type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://someDomain.com/identity/claims/AnotherRole&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;RoleClaims&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;RoleClaimsMapper&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;As you can see this code would take a list of claim types from configuration, and map all claims of these types to roles, adding them to the identity’s claims collection using the required claim type (leaving the original claim intact), and voila – when the app executes it can check the roles, corresponding to the values supplied in my custom claims using - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;HttpContext.Current.User.IsInRole(“[custom claim &lt;span class="kwrd"&gt;value&lt;/span&gt;&amp;quot;]”);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;Very nice indeed!&lt;/pre&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;font color="#ff0000"&gt;UPDATE: Dominic’s comment on this post (on &lt;a href="http://geekswithblogs.net/Connected/archive/2009/04/01/roleclaimsmapper-for-the-geneva-framework.aspx#453535"&gt;http://geekswithblogs.net/Connected/archive/2009/04/01/roleclaimsmapper-for-the-geneva-framework.aspx#453535&lt;/a&gt;) had indirectly suggested an even cleaner solution; instead of duplicating the claims, I can add the claim types I have as roles to each identity’s RoleClaimTypes collection; this achieves the same result in a much cleaner way, here is the updated function - &lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; Microsoft.IdentityModel.Claims.IClaimsPrincipal Authenticate(&lt;span class="kwrd"&gt;string&lt;/span&gt; endpointUri, Microsoft.IdentityModel.Claims.IClaimsPrincipal incomingPrincipal)&lt;br /&gt;        {&lt;br /&gt;            &lt;span class="rem"&gt;//load configuration section for component&lt;/span&gt;&lt;br /&gt;            RoleClaimsMapperConfigurationSection config = &lt;br /&gt;                (RoleClaimsMapperConfigurationSection)ConfigurationManager.GetSection(&lt;span class="str"&gt;&amp;quot;RoleClaimsMapper&amp;quot;&lt;/span&gt;);&lt;br /&gt;                &lt;br /&gt;            &lt;span class="rem"&gt;//loop on all identities, we really only expect one, but can easily support multiple.&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (IClaimsIdentity identity &lt;span class="kwrd"&gt;in&lt;/span&gt; incomingPrincipal.Identities)&lt;br /&gt;                &lt;span class="rem"&gt;//for each identity, add all the claim types that are role claim types.&lt;/span&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (RoleClaimConfigurationElement claimElement &lt;span class="kwrd"&gt;in&lt;/span&gt; config.RoleClaims)&lt;br /&gt;                    identity.RoleClaimTypes.Add(claimElement.ClaimType);&lt;br /&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; incomingPrincipal;&lt;br /&gt;        }&lt;/pre&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-9215986630935662387?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Knh0zI3RY1bGtZYuDyhugQFg2Xw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Knh0zI3RY1bGtZYuDyhugQFg2Xw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Knh0zI3RY1bGtZYuDyhugQFg2Xw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Knh0zI3RY1bGtZYuDyhugQFg2Xw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=PlrKfVFVnOs:jwxUGPMdRag:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=PlrKfVFVnOs:jwxUGPMdRag:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=PlrKfVFVnOs:jwxUGPMdRag:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=PlrKfVFVnOs:jwxUGPMdRag:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=PlrKfVFVnOs:jwxUGPMdRag:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=PlrKfVFVnOs:jwxUGPMdRag:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/PlrKfVFVnOs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/9215986630935662387/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=9215986630935662387" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/9215986630935662387" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/9215986630935662387" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/PlrKfVFVnOs/roleclaimsmapper-for-geneva-framework.html" title="RoleClaimsMapper for the Geneva Framework" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/04/roleclaimsmapper-for-geneva-framework.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-746470482980888842</id><published>2009-03-29T09:51:00.001+01:00</published><updated>2009-03-29T09:51:12.105+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="&quot;M&quot;" /><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk" /><title type="text">Oslo based solution for deploying BizTalk applications – the runtime</title><content type="html">&lt;p&gt;This is a third post in a series describing my Oslo based solution for deploying BizTalk applications; I’ve used this exercise to play around with ‘M’, but it was important for me to work on a real solution, with real benefits – something I could actually use…in &lt;a href="http://sabratech.co.uk/blogs/yossidahan/2009/03/oslo-based-solution-for-deploying.html" target="_blank"&gt;Part I&lt;/a&gt; I discussed the concept and presented both the “source code” of my app and the output I was working toward; &lt;a href="http://www.sabratech.co.uk/blogs/yossidahan/2009/03/oslo-based-solution-for-deploying_14.html" target="_blank"&gt;Part II&lt;/a&gt; was all about the MGrammar part of the solution.&lt;/p&gt;  &lt;p&gt;In this, third, part I will discuss the last missing piece –the runtime.&lt;/p&gt;  &lt;p&gt;Before I start, though, I would say that I did find getting into ‘M’ somewhat confusing at first; and while it’s more than just possible I’m still missing some things , I hope this series could help one or two people in their journey with Oslo – which is, without a doubt, an exciting one!&lt;/p&gt;  &lt;p&gt;There are two things, I believe, that contributed to my confusion - the first is the fact the M is really many things, quite different things, actually; from what I hear Microsoft have identified the challenge some of us (me) are having getting a grasp on ‘M’ and are hard at work to bring things [closer] together; hopefully it won’t be long before we know how the converged language looks like, in the mean time one simply has to remember that - &lt;/p&gt;  &lt;p&gt;There’s &lt;strong&gt;MSchema&lt;/strong&gt; - which you could use to define models,&amp;#160; a bit like xml-schema, or declaring your classes in code or even tables in SQL; I haven’t really touched on MSchema in this series butI might come back to that later.&lt;/p&gt;  &lt;p&gt;Then there’s &lt;strong&gt;MGraph&lt;/strong&gt;, which is a way to define instances of things, possibly ones that have been modelled using MSchema, but, as is evident from my little project, not necessarily - MGraph can be very useful even if you don’t have a model- as long as you have your grammar – in comes &lt;strong&gt;MGrammar&lt;/strong&gt;, the third spect of ‘M’, which can be used to define a syntax for your very own [domain-sepcific-]languge for describing things;     &lt;br /&gt;A ‘runtime’ could then be used to processes instances described as MGrammar as a result of inputs in your language.&lt;/p&gt;  &lt;p&gt;And that is the second thing that really confused me – what is that ‘runtime’? in all the ‘M’ presentations I’ve seen, the ‘runtime’ was merely mentioned and has never received enough “floor space” and yet – an MGrammar without a runtime, in the majority of cases, is, quite useless; you have to have a runtime that would act on your source code; in fact – the runtime would act on the MGraph resulting from your language, which is what makes it all so brilliant, because in a sense, this is where everything comes together – you runtime can work on instances described in your language, on MGraph instances stored in the repository created using MSchema and possibly even ones defined using Quadrant.&lt;/p&gt;  &lt;p&gt;The point is that there must be a runtime that understand the model behind your language , can parse its graph and then do whatever you need it to do; and it is your job to build that runtime.&lt;/p&gt;  &lt;p&gt;So what have I done for my runtime? here’s a quick overview (reminder: the full source code will find its way shortly onto codeplex) - &lt;/p&gt;  &lt;p&gt;My runtime is a console application, one that takes a source code file path as an argument and outputs MSBuild files (and dependencies) that can be used to deploy the application described in the source code onto BizTalk Server.&lt;/p&gt;  &lt;p&gt;The first part of my runtime - which I will not bore you with -&amp;#160; is about validating the command line arguments; standard stuff.&lt;/p&gt;  &lt;p&gt;The second part is about creating&amp;#160; the parser for my language, where, thankfully, the Oslo SDK does all of the heavy lifting – it includes a class called DynamicParser which, once created, you can use to parse your source code.&lt;/p&gt;  &lt;p&gt;To create the DynamicParser you must first compile your language, and that’s easy enough to do – you start by creating a compiler&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;MGrammarCompiler &lt;/span&gt;compiler = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MGrammarCompiler&lt;/span&gt;();&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;and continue by supplying your grammar &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;compiler.SourceItems = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SourceItem&lt;/span&gt;[] {&lt;br /&gt;        &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SourceItem &lt;/span&gt;{&lt;br /&gt;            Name=&lt;span style="color: #a31515"&gt;&amp;quot;BTSDeploy&amp;quot;&lt;/span&gt;,&lt;br /&gt;            ContentType = &lt;span style="color: #2b91af"&gt;ContentType&lt;/span&gt;.Mg,&lt;br /&gt;            TextReader = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;StreamReader&lt;/span&gt;(GetLanguageDefinition())&lt;br /&gt;        }&lt;br /&gt;    };&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;(GetLanguageDefinition() is a simple helper method I wrote to get the grammar file embedded as a resource in the exe)&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now you’re ready to compile your language, but to make things manageable you want to provide it with an error reported; the compiler would report any errors to the stream you would provide, I’ve naturally used the console &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;TextWriterReporter &lt;/span&gt;errorReporter = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TextWriterReporter&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.Out);&lt;br /&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(compiler.Compile(errorReporter) != 0 || errorReporter.HasErrors)&lt;br /&gt;{&lt;br /&gt;    Log(&lt;span style="color: #a31515"&gt;&amp;quot;Failed to compile language definition\nSee above for details&amp;quot;&lt;/span&gt;);&lt;br /&gt;    &lt;span style="color: blue"&gt;return null&lt;/span&gt;;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;If the compilation succeeded you are ready to create your parser - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;DynamicParser &lt;/span&gt;parser = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DynamicParser&lt;/span&gt;();&lt;br /&gt;compiler.LoadDynamicParser(parser);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;That’s part one of three done.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The next step is to use the dynamic parser to parse your source code, the output of which would be a graph representation of the source; luckily the SDK does virtually all the lifting here as well, and it comes down to one line - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;object &lt;/span&gt;rootNode = parser.Parse&amp;lt;&lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;(sourceCodeFileName, &lt;span style="color: blue"&gt;null&lt;/span&gt;, errorReporter);&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Note that the output type is object – which, as you will find out if you try this out, is quite painful– currently all the types used in the Graph are internal, which makes debugging quite difficult (you can’t quite look at any variables you hold in any meaningful way, you have to keep calling methods, as you’ll see next; hopefully this will change one of the next updates to the SDK.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;In any case rootNode is now pointing at the root of a graph – a tree like structure you could ‘walk’ to extract the pieces of information you care about in the source code; here you’re expected to use methods like GetLabel, GetSequenceElements and GetSuccessors to reach nodes and their values in the graph and, of course, to do that you need to know exactly how your graph looks like; my first instinct was to look at the PreviewMode pane in intellipad (usually the right most pane when working with MGrammar) as it shows you a representation of the MGraph created for the source code and language used; this worked quite well, but, as I found out, wasn’t the most trivial thing – the two didn’t align completely and I ended up having to resort to trail-and-error to get the parsing logic right.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The reason is that M has a few shortcuts one could take, but the graph you would be working on is the very basic, more verbose format; some information on this is mentioned &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/51ddc676-3a9b-4de4-92d1-b24f80cd57dc/" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Then, on a recent visit to Redmond, &lt;a href="http://blogs.msdn.com/dkaufman/" target="_blank"&gt;Dana Kaufman&lt;/a&gt; passed on a great tip – if you ‘compile’ your grammar using mg.exe to create the mgx file (basically a ZIP file containing XAML representation of language) and then use mgx.exe on your source file adding&amp;#160; a reference to the mgx file you just created, you end up with an ‘M’ file which is exactly the graph your runtime would be working on.end up with; so useful!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So – here are a few example of how I worked the graph – to start with I knew my root node should be a node with the label ‘Application’, so I checked it this way - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; label = graph.GetLabel(rootNode).ToString();&lt;br /&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (label != &lt;span class="str"&gt;&amp;quot;Application&amp;quot;&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I then knew that the application name would be a child element of the root node, so I extracted it like this &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;// extract the application's data - this should contain two nodes - the application name and the list of items in the application&lt;/span&gt;&lt;br /&gt;List&amp;lt;&lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt; appData = graph.GetSequenceElements(rootNode).ToList&amp;lt;&lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt;();&lt;br /&gt;&lt;span class="rem"&gt;//first line should be the application name, make sure it is not a node and extract the label&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (!graph.IsNode(appData[0]))&lt;br /&gt;    Contents.AppName = appData[0].ToString();&lt;/pre&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;the second node in the appData collection is where the graph ‘continues’, so to get the list of things that compose my application I needed to walk down that path -&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;//the second element should be the list of lines&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;foreach&lt;/span&gt; (&lt;span class="kwrd"&gt;object&lt;/span&gt; section &lt;span class="kwrd"&gt;in&lt;/span&gt; graph.GetSuccessors(appData[i]))&lt;br /&gt;{&lt;br /&gt;  &lt;span class="rem"&gt;//each successor would be a category (reference, importing binding, resource, etc), with a list of items&lt;/span&gt;&lt;br /&gt;  processSection(graph,section);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;with processSection start with &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; sectionName = graph.GetSequenceLabel(graph.GetSuccessors(section).First()).ToString();&lt;br /&gt;List&amp;lt;&lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt; items = graph.GetSuccessors(graph.GetSuccessors(section).First()).ToList&amp;lt;&lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt;();&lt;br /&gt;&lt;br /&gt;Log(&lt;span class="str"&gt;&amp;quot;Found section '{0}'&amp;quot;&lt;/span&gt;, sectionName);&lt;br /&gt;&lt;span class="kwrd"&gt;switch&lt;/span&gt; (sectionName)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I hope that from these few examples you can see what it takes to work the graph – the graphBuilder (which is a somewhat confusing name, as I’m using it to walk the graph, not build it) has all the methods you need to access the various nodes ( but there’s no xpath-like- support), but as all the types are (currently) internal to the MS assembly you’re always working with objects, which is less then ideal.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Again – my full source code is on its way to codeplex, I just want to make sure it’s commented well enough to be well understood, and am struggling with time, but the bottom line is that once you figure out how the graph builder works, learnt how to see your graph visually (using mg.exe and mgx.exe) and got used to the fact that you’re dealing with objects for now, parsing the source code is very easy.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Obviously it is completely down to you what you then do with all the information you’ve extracted from the source code; in my case&amp;#160; my runtime is using a plug-in model so the first part is all about using the Oslo SDK to get an instance of a BizTalkDeployment class populated based on the contents of the input file, this class looks like - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; BizTalkDeployment&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; AppName { get; set; }&lt;br /&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt; References { get; set; }&lt;br /&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt; Build { get; set; }&lt;br /&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;BizTalkAssembly&amp;gt; BizTalkAssemblies { get; set; }&lt;br /&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt; ImportBindings { get; set; }&lt;br /&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;Binding&amp;gt; AddBindings { get; set; }&lt;br /&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;Assembly&amp;gt; Resources { get; set; }&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;I then use late binding and configuration to load a plug in that would take an instance of this class and do the work, be it generation of msbuild scripts, deploying to the local machine using BTSTask or anything else. &lt;br /&gt;&lt;br /&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-746470482980888842?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cHq7QWmw0Kr4GMgEfwJsEza5h-M/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cHq7QWmw0Kr4GMgEfwJsEza5h-M/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/cHq7QWmw0Kr4GMgEfwJsEza5h-M/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cHq7QWmw0Kr4GMgEfwJsEza5h-M/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=Fyn8a6aKIXs:1EC8kf1ylm8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=Fyn8a6aKIXs:1EC8kf1ylm8:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=Fyn8a6aKIXs:1EC8kf1ylm8:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=Fyn8a6aKIXs:1EC8kf1ylm8:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=Fyn8a6aKIXs:1EC8kf1ylm8:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=Fyn8a6aKIXs:1EC8kf1ylm8:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/Fyn8a6aKIXs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/746470482980888842/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=746470482980888842" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/746470482980888842" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/746470482980888842" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/Fyn8a6aKIXs/oslo-based-solution-for-deploying_29.html" title="Oslo based solution for deploying BizTalk applications – the runtime" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/03/oslo-based-solution-for-deploying_29.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-1744328006140756923</id><published>2009-03-23T09:15:00.001Z</published><updated>2009-03-23T09:15:44.039Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk" /><category scheme="http://www.blogger.com/atom/ns#" term="publish-subscribe" /><title type="text">On Atomic Scope and Message Publishing</title><content type="html">&lt;p&gt;A few weeks back I worked on a process that looked something like this - &lt;/p&gt;  &lt;p&gt;It was triggered by the &lt;a href="http://biztalkscheduledtask.codeplex.com/" target="_blank"&gt;scheduled task adapter&lt;/a&gt; and then used a SQL send port to call SP to return list of ‘things’.    &lt;br /&gt;It needed to split the things in the list to individual records, and to start a new, different, process, through pub/sub (to avoid the binary dependency with the called process), for each ‘thing’.&lt;/p&gt;  &lt;p&gt;Fairly simple. &lt;/p&gt;  &lt;p&gt;A lot of have been said on the different ways to split messages, I won’t repeat this discussion here; I would just say that initially I used a different approach – I used the SQL adapter in the initial, triggering, receive port and then used a receive pipeline, with an XmlDisassembler component, to split the incoming&amp;#160; message so that each record was published individually thus avoiding the need to have a ‘master process’; that back fired though, in my case – I quickly realised I’ll be choking the server with the amount of messages published and needed a way to throttle the execution; I’ve played a bit with host throttling but then came to the conclusion the best approach for me would be to throttle in a process, which is what I’ve done.&lt;/p&gt;  &lt;p&gt;And so - to make things interesting, and because I already had it all ready - I decided to use a call to a pipeline from my process to split the message.&lt;/p&gt;  &lt;p&gt;The first thing I realised, trying to take that approach, was that I had to change type of the response message received from the SQL port to be XmlDocument (which is an approach I generally dislike – I’m a sucker for strongly-typed-everything) – but my schema was configured as an envelope so that when I call the pipeline from my process it knows how to split it correctly, but, when used in the SQL port BizTalk split the message too early for me – I needed to whole message in the process first, which was no good to me; if , however, I removed the envelope definition from the schema when I would call the pipeline directly from my process it won’t know how to split the message, which is no good either; nor could i have two schemas (BizTalk, as we all know, dones’t like that bit at all, not without even more configuration); XmlDocument it is.&lt;/p&gt;  &lt;p&gt;It then came back to me (in the form of a compile time error :-)) that the pipeline variable has to exist in an atomic scope, and so I added one to contain my pipeline variable; I then added the necessary loop with the condition set to the GetNext() method of the pipeline and in each iteration constructed a message using the GetCurrent() method; all standard stuff.&lt;/p&gt;  &lt;p&gt;I would then set some context properties to route my message correctly and allow me to correlate the responses (I used a scatter-gather pattern in my master process) and published it to the message box&lt;/p&gt;  &lt;p&gt;What I noticed when testing my shiny new process was that all those sub-processes that were meant to start as a result the published messages in my loop were delayed by quite a few minutes (6-8), which seemed completely unreasonable, so I embarked on a troubleshooting exercise which resulting in that big “I should have thought of that!” moment.&lt;/p&gt;  &lt;p&gt;While the send shape in my loop successfully completed its act of publishing the message in each iteration, moving my loop to the next message and so on, being in an atomic scope BizTalk would not commit the newly published messages to the message box database, allowing subscriptions to kick in, before the atomic scope would finish; that is to allow it to rollback should something in the atomic scope would fail.   &lt;br /&gt;What it meant for me though, was that all the messages were still effectively published at once, which brought me back to square one (or, minus one, actually, considering that the great delay caused my this approach means I’m even worse off from my first debatch-in-pipeline approach).&lt;/p&gt;  &lt;p&gt;And so I went back to the old and familiar approach of splitting the messages using xpath in the process, which allowed me to carefully control the publishing rate of messages for my process and throttle them as needed.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-1744328006140756923?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cx3wg67raZwQHsRpgX1IeIkpwDo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cx3wg67raZwQHsRpgX1IeIkpwDo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/cx3wg67raZwQHsRpgX1IeIkpwDo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cx3wg67raZwQHsRpgX1IeIkpwDo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=iJpvXSmcUh8:EYmtRNgJ1iE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=iJpvXSmcUh8:EYmtRNgJ1iE:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=iJpvXSmcUh8:EYmtRNgJ1iE:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=iJpvXSmcUh8:EYmtRNgJ1iE:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=iJpvXSmcUh8:EYmtRNgJ1iE:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=iJpvXSmcUh8:EYmtRNgJ1iE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/iJpvXSmcUh8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/1744328006140756923/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=1744328006140756923" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/1744328006140756923" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/1744328006140756923" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/iJpvXSmcUh8/on-atomic-scope-and-message-publishing.html" title="On Atomic Scope and Message Publishing" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/03/on-atomic-scope-and-message-publishing.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-5018317770378598202</id><published>2009-03-18T10:17:00.001Z</published><updated>2009-03-18T10:17:28.505Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Service" /><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><title type="text">ASMX, WCF and enums woes</title><content type="html">&lt;p&gt;We’ve been slowly migrating our services from asmx to WCF, but as we’re still using BizTalk 2006 with no support for WCF we’ve been exposing endpoints configured for basicHttpBinding and consume them using the SOAP adapter.&lt;/p&gt; &lt;p&gt;Generally speaking things have been going well, although we completely gave up on the idea of moving the services to WCF and NOT have to change the client, until yesterday we’ve stumbled into a serialisation issue – &lt;/p&gt; &lt;p&gt;The SOAP adapter, as part of its work deserialises the request message arriving through the send port into t he web service proxy class it generated, before calling the web service (which would result in the class now being serialised back into xml, which is another story); that deserialisation failed.&lt;/p&gt; &lt;p&gt;The error message was clear enough and indicated it failed to deserialise an enum parameter the service was expecting, and that ran a bell – I &lt;a href="http://www.sabratech.co.uk/blogs/yossidahan/2008/09/calling-web-service-with-enumeration.html"&gt;posted&lt;/a&gt; on exactly that back in September, but after carefully checking and re-checking everything we could swear that our message (which was now suspended) matches perfectly the schema generated by the add web reference wizard; what’s going on then??&lt;/p&gt; &lt;p&gt;After chasing our tail for a short while we brought up reflector to the rescue and found out the cause of our woe is a combination of a difference in behaviour between WCF and ASMX and the use of BizTalk – here are the details – &lt;/p&gt; &lt;p&gt;Consider the following asmx web method&amp;nbsp; – &lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;WebMethod]&lt;br /&gt; &lt;/span&gt;&lt;span style="color: blue"&gt;public string GetDataUsingDataContract(&lt;/span&gt;&lt;span style="color: #2b91af"&gt;CompositeType.someEnum myEnum)&lt;br /&gt; {&lt;br /&gt;     &lt;/span&gt;&lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #a31515"&gt;"Hello World";&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;With CompositeType being &lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CompositeType&lt;br /&gt; {&lt;br /&gt;   &lt;/span&gt;&lt;span style="color: blue"&gt;public enum &lt;/span&gt;&lt;span style="color: #2b91af"&gt;someEnum&lt;br /&gt;   {&lt;br /&gt;      Value1,&lt;br /&gt;      Value2&lt;br /&gt;   }&lt;br /&gt; }&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;(..and pretend CompositeType has many more things, but these are irrelevant to this topic)&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The definition for myEnum in the WSDL looks like &lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;s:element &lt;/span&gt;&lt;span style="color: red"&gt;minOccurs&lt;/span&gt;&lt;span style="color: blue"&gt;="1" &lt;/span&gt;&lt;span style="color: red"&gt;maxOccurs&lt;/span&gt;&lt;span style="color: blue"&gt;="1" &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;="myEnum" &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;="tns:someEnum" /&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;Where the type tns:someEnum looks like &lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;s:simpleType &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;="someEnum"&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;s:restriction &lt;/span&gt;&lt;span style="color: red"&gt;base&lt;/span&gt;&lt;span style="color: blue"&gt;="s:string"&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;s:enumeration &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;="Value1" /&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;s:enumeration &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;="Value2" /&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;s:restriction&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;s:simpleType&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;As a result the definition of the enum in a proxy generated via the add web reference VS 2005 option (which is what BizTalk would use) looks like – &lt;/p&gt;&lt;pre class="code"&gt;[System.CodeDom.Compiler.&lt;span style="color: #2b91af"&gt;GeneratedCodeAttribute&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"System.Xml"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"2.0.50727.3053"&lt;/span&gt;)]&lt;br /&gt; [System.&lt;span style="color: #2b91af"&gt;SerializableAttribute&lt;/span&gt;()]&lt;br /&gt; [System.Xml.Serialization.&lt;span style="color: #2b91af"&gt;XmlTypeAttribute&lt;/span&gt;(Namespace=&lt;span style="color: #a31515"&gt;"http://tempuri.org/"&lt;/span&gt;)]&lt;br /&gt; &lt;span style="color: blue"&gt;public enum &lt;/span&gt;&lt;span style="color: #2b91af"&gt;someEnum &lt;/span&gt;&lt;/pre&gt;&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt; &lt;/span&gt;{&lt;br /&gt;     Value1,&lt;br /&gt;     Value2,&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;span style="color: gray"&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;All makes sense.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Now, let’s look at what WCF does in the same case; consider the following service – &lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;ServiceContract&lt;/span&gt;]&lt;br /&gt; &lt;span style="color: blue"&gt;public interface &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IService1&lt;br /&gt; &lt;/span&gt;{&lt;br /&gt;&lt;br /&gt;   [&lt;span style="color: #2b91af"&gt;OperationContract&lt;/span&gt;]&lt;br /&gt;    &lt;span style="color: blue"&gt;string &lt;/span&gt;GetDataUsingDataContract(&lt;span style="color: #2b91af"&gt;CompositeType&lt;/span&gt;.&lt;span style="color: #2b91af"&gt;someEnum &lt;/span&gt;myEnum);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; [&lt;span style="color: #2b91af"&gt;DataContract&lt;/span&gt;]&lt;br /&gt; &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CompositeType&lt;br /&gt; &lt;/span&gt;{&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue"&gt;public enum &lt;/span&gt;&lt;span style="color: #2b91af"&gt;someEnum&lt;br /&gt;    &lt;/span&gt;{&lt;br /&gt;        Value1,&lt;br /&gt;        Value2&lt;br /&gt;    }&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;The WSDL generated looks like &lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:simpleType &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;CompositeType.someEnum&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:restriction &lt;/span&gt;&lt;span style="color: red"&gt;base&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;xs:string&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;   &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:enumeration &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Value1&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;&lt;br /&gt;   &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:enumeration &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Value2&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;&lt;br /&gt; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:restriction&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:simpleType&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:element &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;CompositeType.someEnum&lt;/span&gt;" &lt;span style="color: red"&gt;nillable&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;true&lt;/span&gt;" &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;tns:CompositeType.someEnum&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;The key difference is that the name of the class containing the enum has made it into the type name for the enum, which never happened in the ASMX version.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;As a result the proxy is generated as such - &lt;/p&gt;&lt;pre class="code"&gt;[System.CodeDom.Compiler.&lt;span style="color: #2b91af"&gt;GeneratedCodeAttribute&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"System.Runtime.Serialization"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"3.0.0.0"&lt;/span&gt;)]&lt;br /&gt; [System.Runtime.Serialization.&lt;span style="color: #2b91af"&gt;DataContractAttribute&lt;/span&gt;(Name=&lt;span style="color: #a31515"&gt;"CompositeType.someEnum"&lt;/span&gt;, &lt;br&gt;                  Namespace=&lt;span style="color: #a31515"&gt;"http://schemas.datacontract.org/2004/07/WcfService1"&lt;/span&gt;)]&lt;br /&gt; &lt;span style="color: blue"&gt;public enum &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CompositeTypesomeEnum &lt;/span&gt;: &lt;span style="color: blue"&gt;int &lt;/span&gt;&lt;/pre&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;{&lt;br /&gt;   [System.Runtime.Serialization.&lt;span style="color: #2b91af"&gt;EnumMemberAttribute&lt;/span&gt;()]&lt;br /&gt;    Value1 = 0,&lt;br /&gt;   [System.Runtime.Serialization.&lt;span style="color: #2b91af"&gt;EnumMemberAttribute&lt;/span&gt;()]&lt;br /&gt;    Value2 = 1,&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;Again – note the name given to the element now contains the class name and, crucially, a dot (‘.’).&lt;/p&gt;&lt;br /&gt;&lt;p&gt;On it’s own – nothing to malicious – although it’s another nail in the coffin for the idea that you can substitute web service with WCF service, configured them to use basicHttpBinding and all should be the same (ok – am I the only one still wishing this was possible?)&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Enters BizTalk.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;When you use the add web reference wizard to add a reference to the &lt;b&gt;WCF&lt;/b&gt; service, BizTalk generates all the schemas and proxy for you, which is what you would use to create requests going to the service (and process responses).&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Because the WSDL of the WCF service contains the longer name of the enum (with the class name, the dot and the enum name) the .net proxy generated is identical to the one created for the WCF service above; the schema, however, is generated incorrectly!&lt;/p&gt;&lt;br /&gt;&lt;p&gt;BizTalk “kindly” decides that having dots in the element name is not a good idea and removes it so the schema generated looks like this – &lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:schema &lt;/span&gt;&lt;span style="color: red"&gt;xmlns:tns&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;http://schemas.datacontract.org/2004/07/WcfService1&lt;/span&gt;" &lt;span style="color: red"&gt;elementFormDefault&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;qualified&lt;/span&gt;" &lt;br&gt;          &lt;span style="color: red"&gt;targetNamespace&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;http://schemas.datacontract.org/2004/07/WcfService1&lt;/span&gt;" &lt;br&gt;          &lt;span style="color: red"&gt;xmlns:xs&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;&lt;a href="http://www.w3.org/2001/XMLSchema&amp;quot;&amp;gt;"&gt;http://www.w3.org/2001/XMLSchema&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/a&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:element &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;CompositeTypesomeEnum&lt;/span&gt;" &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;tns:CompositeTypesomeEnum&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;&lt;br /&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:simpleType &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;CompositeTypesomeEnum&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;   &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:restriction &lt;/span&gt;&lt;span style="color: red"&gt;base&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;xs:string&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:enumeration &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Value1&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;&lt;br /&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:enumeration &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Value2&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;&lt;br /&gt;   &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:restriction&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:simpleType&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:schema&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;“CompositeTypesomeEnum”??????&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Well, we’ve seen this, and created a message with exactly that element, which – of course – the SOAP adapter failed to deserialise into &lt;/p&gt;&lt;pre class="code"&gt;[System.Runtime.Serialization.&lt;span style="color: #2b91af"&gt;DataContractAttribute&lt;/span&gt;(Name=&lt;span style="color: #a31515"&gt;"CompositeType.someEnum"&lt;/span&gt;, &lt;br&gt;                                                    Namespace=&lt;span style="color: #a31515"&gt;"http://schemas.datacontract.org/2004/07/WcfService1"&lt;/span&gt;)]&lt;br /&gt; &lt;span style="color: blue"&gt;public enum &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CompositeTypesomeEnum &lt;/span&gt;: &lt;span style="color: blue"&gt;int &lt;/span&gt;&lt;/pre&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;{&lt;br /&gt;   [System.Runtime.Serialization.&lt;span style="color: #2b91af"&gt;EnumMemberAttribute&lt;/span&gt;()]&lt;br /&gt;   Value1 = 0,&lt;br /&gt;   [System.Runtime.Serialization.&lt;span style="color: #2b91af"&gt;EnumMemberAttribute&lt;/span&gt;()]&lt;br /&gt;   Value2 = 1,&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The solution was fairly simple – we’ve simple change our xsl to put the element name as the .net proxy requires it, and not as the schema describes it, and it all worked well.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-5018317770378598202?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/HHhrjnVBnHivmrq97LedlPR2EqY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HHhrjnVBnHivmrq97LedlPR2EqY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/HHhrjnVBnHivmrq97LedlPR2EqY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HHhrjnVBnHivmrq97LedlPR2EqY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=Lm54hXlXMnc:U_EFSWLVZoE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=Lm54hXlXMnc:U_EFSWLVZoE:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=Lm54hXlXMnc:U_EFSWLVZoE:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=Lm54hXlXMnc:U_EFSWLVZoE:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=Lm54hXlXMnc:U_EFSWLVZoE:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=Lm54hXlXMnc:U_EFSWLVZoE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/Lm54hXlXMnc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/5018317770378598202/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=5018317770378598202" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/5018317770378598202" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/5018317770378598202" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/Lm54hXlXMnc/asmx-wcf-and-enums-woes.html" title="ASMX, WCF and enums woes" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/03/asmx-wcf-and-enums-woes.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-1103844694751392811</id><published>2009-03-16T08:46:00.001Z</published><updated>2009-03-16T08:46:44.796Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk" /><category scheme="http://www.blogger.com/atom/ns#" term="wish-list" /><category scheme="http://www.blogger.com/atom/ns#" term="Xsl" /><title type="text">Ok, got your message, now let us have xsl re-use!</title><content type="html">&lt;p&gt;From the &lt;a href="http://support.microsoft.com/kb/945924" target="_blank"&gt;Microsoft Knowledgebase&lt;/a&gt;&amp;#160; - &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;The &amp;lt;xsl:import&amp;gt; element is used to import an external XSLT file. The &amp;lt;xsl:include&amp;gt; element is used to include an external XSLT file. You cannot use these elements in custom XSLT files that are defined in the Custom XSL Path Grid Properties in a BizTalk project. You cannot do this because a Uniform Resource Identifier (URI) that is defined in an external XSLT file may be from a nonsecure source such as the Internet.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Am I (well, and Ben Gimblett here)&amp;#160; the only one who thinks this is a lame excuse? since when MS tries to protect developers from stupidity? and in any case, if they really wanted to do that – wouldn’t they have to prevent us from writing ANY code?&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-1103844694751392811?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/YiTbhZyvQj4uZUAiDHNn5BrsJyA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YiTbhZyvQj4uZUAiDHNn5BrsJyA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/YiTbhZyvQj4uZUAiDHNn5BrsJyA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YiTbhZyvQj4uZUAiDHNn5BrsJyA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=uDFUT4xjl4g:SBVVvSASO_A:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=uDFUT4xjl4g:SBVVvSASO_A:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=uDFUT4xjl4g:SBVVvSASO_A:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=uDFUT4xjl4g:SBVVvSASO_A:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=uDFUT4xjl4g:SBVVvSASO_A:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=uDFUT4xjl4g:SBVVvSASO_A:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/uDFUT4xjl4g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/1103844694751392811/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=1103844694751392811" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/1103844694751392811" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/1103844694751392811" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/uDFUT4xjl4g/ok-got-your-message-now-let-us-have-xsl.html" title="Ok, got your message, now let us have xsl re-use!" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/03/ok-got-your-message-now-let-us-have-xsl.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-8760025743043399530</id><published>2009-03-14T10:45:00.001Z</published><updated>2009-03-14T10:57:27.177Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="&quot;M&quot;" /><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk" /><title type="text">Oslo based solution for deploying BizTalk applications – the grammar</title><content type="html">&lt;p&gt;A couple of weeks ago I published a &lt;a href="http://sabratech.co.uk/blogs/yossidahan/2009/03/oslo-based-solution-for-deploying.html" target="_blank"&gt;post&lt;/a&gt; describing my Oslo based deployment framework for BizTalk.&lt;/p&gt;  &lt;p&gt;Two parts were missing from that post – the actual MGrammar and the runtime that processes the source code files. &lt;/p&gt;  &lt;p&gt;In this post I will go over the grammar I created for the framework; I will try to go over the complete grammar explaining the various steps, this is not intended to be a complete description of MGrammar (not that there’s a chance I could write one), but rather an overview by example; for more information on Oslo and ‘M’ visit the &lt;a href="http://msdn.microsoft.com/en-us/oslo/default.aspx" target="_blank"&gt;Oslo Dev Centre on MSDN&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It was important for me to create a solution that is completely usable, and indeed I have started to use this to generate the build scripts for my application, the price of which is that it might not be the best example code out there, but I hope you will find this useful.&lt;/p&gt;  &lt;p&gt;Below is the complete grammar, after which I walk though it step by step; it might be useful to have anther look at the example source code I included in my previous post to better understand what I’m trying to achieve with the syntax -&lt;/p&gt;  &lt;pre class="code"&gt;module Sabra.BizTalk.Deployment &lt;br /&gt;{ &lt;br /&gt;&lt;br /&gt;    language BTSDeploy &lt;br /&gt;    { &lt;br /&gt;        //main syntax is the entry point for the grammar - the first syntax to be parsed &lt;br /&gt;        syntax Main = app:AppDef &lt;br /&gt;                           &amp;quot;{&amp;quot; &lt;br /&gt;                           items:ApplicationItems &lt;br /&gt;                           &amp;quot;}&amp;quot; =&amp;gt; Application[app,valuesof(items)]; &lt;br /&gt;        //application definition at root of source code &lt;br /&gt;        syntax AppDef = applicationKW name:ApplicationName =&amp;gt; name; &lt;br /&gt;&lt;br /&gt;        //application items supports including all possible items multiple times in any order &lt;br /&gt;        syntax ApplicationItems = items:(Add | Build | ImportBinding | Comment)* =&amp;gt; {valuesof(items)}; &lt;br /&gt;&lt;br /&gt;        //now define the syntax for each item type - &lt;br /&gt;        //'Build' deinfes a solution or project to build during execution &lt;br /&gt;        //(due to limitations in our msbuild framework, runtime currently supports solutions only, but language should support both) &lt;br /&gt;        syntax Build = &amp;quot;build&amp;quot; path:Path&amp;quot;;&amp;quot; =&amp;gt; Build[path]; &lt;br /&gt;        //binding to import into application &lt;br /&gt;        syntax ImportBinding = importKW bindingKW path:Path&amp;quot;;&amp;quot; =&amp;gt; ImportBinding{Path = path}; &lt;br /&gt;&lt;br /&gt;        //syntax of add further specified different add 'options' &lt;br /&gt;        syntax Add = addKW add:(Add_Reference | Add_Binding | Add_Assembly | Add_BTS_Assembly) =&amp;gt; Add{valuesof(add)}; &lt;br /&gt;        //each add option is defined next &lt;br /&gt;        //binding to add as resource to application. must specify environment name &lt;br /&gt;        syntax Add_Binding = bindingKW path:Path env:MultiWordName&amp;quot;;&amp;quot; =&amp;gt; Binding[path,env]; &lt;br /&gt;        //defined a reference to another application, supports providing multiple applications in the same instruction &lt;br /&gt;        syntax Add_Reference = referenceKW ref1:ApplicationName refs:Add_AdditionalReferences*&amp;quot;;&amp;quot; =&amp;gt; Reference{ref1,valuesof(refs)}; &lt;br /&gt;        syntax Add_AdditionalReferences = &amp;quot;,&amp;quot; app:ApplicationName =&amp;gt; app; &lt;br /&gt;        //add assembly defines an assembly to be added as a resource to the application &lt;br /&gt;        syntax Add_Assembly = assemblyKW path:Path details:AssemblyDetails&amp;quot;;&amp;quot; =&amp;gt; Resource[path,Details{details}]; &lt;br /&gt;        //add biztalk assembly is similar to assembly, but allows specifiying any contained orchestrations &lt;br /&gt;        syntax Add_BTS_Assembly = &amp;quot;biztalk&amp;quot; assemblyKW path:Path orch:Orchestrations? details:AssemblyDetails&amp;quot;;&amp;quot; =&amp;gt; BizTalkAssembly[path,orch,Details{details}]; &lt;br /&gt;        syntax Orchestrations  = withKW orchestrationsKW &amp;quot;{&amp;quot; type1:ApplicationName types:AdditionalOrchestrations* &amp;quot;}&amp;quot; =&amp;gt; Orchestrations{type1,valuesof(types)}; &lt;br /&gt;        syntax AdditionalOrchestrations = &amp;quot;,&amp;quot; type:ApplicationName =&amp;gt; type; &lt;br /&gt;        //assembly details &lt;br /&gt;        syntax AssemblyDetails = ver:AssemblyVersion+ culture:Culture+ pkt:PublicKeyToken+=&amp;gt;{Version{valuesof(ver)},Culture{valuesof(culture)},PublicKeyToken{valuesof(pkt)}}; &lt;br /&gt;        token AssemblyVersion = versionKW &amp;quot;=&amp;quot; version:(AnyDigit*&amp;quot;.&amp;quot;AnyDigit*&amp;quot;.&amp;quot;AnyDigit*&amp;quot;.&amp;quot;AnyDigit*)=&amp;gt;version; &lt;br /&gt;        token Culture = cultureKW &amp;quot;=&amp;quot; culture:Word=&amp;gt;culture; &lt;br /&gt;        //TODO: token should be 16 chars exactly &lt;br /&gt;        token PublicKeyToken = publicKeyTokenKW &amp;quot;=&amp;quot;pkt:(AnyChar|AnyDigit)*=&amp;gt;pkt;   &lt;br /&gt;        //keywords &lt;br /&gt;        @{Classification[&amp;quot;Keyword&amp;quot;]} &lt;br /&gt;        token applicationKW = &amp;quot;Application&amp;quot;; &lt;br /&gt;        @{Classification[&amp;quot;Keyword&amp;quot;]} &lt;br /&gt;        token addKW = &amp;quot;add&amp;quot;; &lt;br /&gt;        @{Classification[&amp;quot;Keyword&amp;quot;]} &lt;br /&gt;        token bindingKW = &amp;quot;binding&amp;quot;; &lt;br /&gt;        @{Classification[&amp;quot;Keyword&amp;quot;]} &lt;br /&gt;        token referenceKW = &amp;quot;reference&amp;quot;; &lt;br /&gt;        @{Classification[&amp;quot;Keyword&amp;quot;]} &lt;br /&gt;        token importKW = &amp;quot;import&amp;quot;; &lt;br /&gt;        @{Classification[&amp;quot;Keyword&amp;quot;]} &lt;br /&gt;        token buildKW  = &amp;quot;build&amp;quot;; &lt;br /&gt;        @{Classification[&amp;quot;Keyword&amp;quot;]} &lt;br /&gt;        token assemblyKW = &amp;quot;assembly&amp;quot;; &lt;br /&gt;        @{Classification[&amp;quot;Keyword&amp;quot;]} &lt;br /&gt;        token biztalkKW = &amp;quot;biztalk&amp;quot;; &lt;br /&gt;        @{Classification[&amp;quot;Keyword&amp;quot;]} &lt;br /&gt;        token withKW = &amp;quot;with&amp;quot;; &lt;br /&gt;        @{Classification[&amp;quot;Keyword&amp;quot;]} &lt;br /&gt;        token orchestrationsKW = &amp;quot;orchestrations&amp;quot;; &lt;br /&gt;        @{Classification[&amp;quot;Keyword&amp;quot;]} &lt;br /&gt;        token versionKW = &amp;quot;version&amp;quot;;        &lt;br /&gt;        @{Classification[&amp;quot;Keyword&amp;quot;]} &lt;br /&gt;        token cultureKW = &amp;quot;culture&amp;quot;;        &lt;br /&gt;        @{Classification[&amp;quot;Keyword&amp;quot;]} &lt;br /&gt;        token publicKeyTokenKW = &amp;quot;publicKeyToken&amp;quot;;        &lt;br /&gt;        //definition of a comment, similar to c# syntax &lt;br /&gt;        @{Classification[&amp;quot;Comment&amp;quot;]} &lt;br /&gt;        token Comment = &amp;quot;//&amp;quot; CommentLineContent*; &lt;br /&gt;        token CommentLineContent &lt;br /&gt;            = ^( &lt;br /&gt;                 '\u000A' // New Line &lt;br /&gt;              |  '\u000D' // Carriage Return &lt;br /&gt;              |  '\u0085' // Next Line &lt;br /&gt;              |  '\u2028' // Line Separator &lt;br /&gt;              |  '\u2029' // Paragraph Separator &lt;br /&gt;            ); &lt;br /&gt;        //application name must start with a character and then include any character, digit or '.' &lt;br /&gt;        @{Classification[&amp;quot;String&amp;quot;]} &lt;br /&gt;        token ApplicationName = AnyChar+(AnyChar | AnyDigit | &amp;quot;.&amp;quot;)*; &lt;br /&gt;        //tokens use for definition of a file path &lt;br /&gt;        token Path = &amp;quot;\&amp;quot;&amp;quot;PathRoot?FileSystemName(&amp;quot;\\&amp;quot;FileSystemName)*&amp;quot;\&amp;quot;&amp;quot;; &lt;br /&gt;        token PathRoot = AnyChar&amp;quot;:\\&amp;quot;; &lt;br /&gt;        token FileSystemName = (AnyChar | AnyDigit | Space | &amp;quot;-&amp;quot; | &amp;quot;_&amp;quot; | &amp;quot;.&amp;quot;)+; &lt;br /&gt;&lt;br /&gt;        //common token definitions &lt;br /&gt;        token AnyChar = &amp;quot;A&amp;quot;..&amp;quot;Z&amp;quot; | &amp;quot;a&amp;quot;..&amp;quot;z&amp;quot;; &lt;br /&gt;        token AnyDigit = &amp;quot;0&amp;quot;..&amp;quot;9&amp;quot;; &lt;br /&gt;        token MultiWordName  = &amp;quot;\&amp;quot;&amp;quot;a:(Word | Space)&amp;quot;\&amp;quot;&amp;quot; =&amp;gt; a; &lt;br /&gt;        token Word = (AnyChar | AnyDigit | &amp;quot;-&amp;quot; | &amp;quot;_&amp;quot;)+; &lt;br /&gt;&lt;br /&gt;        //the interleave will ensure the language allows whitespace anywhere &lt;br /&gt;        interleave Whitespace = Tab | LF | CR | Space | Comment; &lt;br /&gt;        token LF = &amp;quot;\u000A&amp;quot;; &lt;br /&gt;        token CR = &amp;quot;\u000D&amp;quot;; &lt;br /&gt;        token Space = &amp;quot;\u0020&amp;quot;; &lt;br /&gt;        token Tab = &amp;quot;\u0009&amp;quot;; &lt;br /&gt;&lt;br /&gt;       } &lt;br /&gt;} &lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I’ve build the grammar top down and this is how I will walk through it - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;First (1) I define my module, in a namespace like manner; this is the logical container for my language; I then(4) declare my language and give it a name.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The main constructs in mgrammar are &lt;em&gt;syntax &lt;/em&gt;and &lt;em&gt;token; &lt;/em&gt;I often heard the guys at Redmond explain that when it comes to languages you can think of syntax as being the sentence and tokens as being the words; I think this is a very clear explanations; there are a few rules relating to them as you can imagine, important ones to remember at this point are that syntaxes can contain other syntaxes as well as tokens (and literals), tokens can only contain other tokens (and literals); also – interleave does not apply to tokens .&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The main syntax, and the entry point for any language is Main and you can see mine defined on line 7, and it looks like this - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;//main syntax is the entry point for the grammar - the first syntax to be parsed &lt;br /&gt;syntax Main = app:AppDef &lt;br /&gt;                   &amp;quot;{&amp;quot; &lt;br /&gt;                   items:ApplicationItems &lt;br /&gt;                   &amp;quot;}&amp;quot; =&amp;gt; Application[app,valuesof(items)]; &lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;‘//’ is used for comments, just like in c#, so the first line will be ignored.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;em&gt;syntax&lt;/em&gt; is one of the few keywords that exist in mgrammar, no explanation needed;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;em&gt;Main&lt;/em&gt; is the name of the syntax, which allows is to be referred to (used) by other syntaxes; in this case, as I’ve mentioned, ‘Main’ is also the entry point –the syntax the parser will start at; everything else should flow from here.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now for - &lt;em&gt;app:AppDef&lt;/em&gt;, but first – a note - in my mind there are two aspects to creating a language in mgrammar – there is the ‘parsing aspect’ – you define your language so that it describes the rules to parse your source code; and there is the ‘output aspect’ (or ‘production aspect’) – this is where you define the output of your language – in ‘M’ this is mgraph – so that it descries accurately the intent of any source code (and is easy-ish to work with at runtime)&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Two are inevitably very mixed in any real-world work with ‘M’ which can be confusing, and today I want to focus on the parsing aspect – firstly because it is the more important one in my view (there’s nothing to work with before you’ve declared a good syntax for your language), and secondly – because I suspect we’re going to see some changes to the production aspect in the near future.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Mainly production aspect ‘stuff’ is defined after the ‘=&amp;gt;’ operator as you can see in my syntax above, so for the time being just try to ignore that; there will be a bit more to ignore as you will see shortly.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;em&gt;AppDef&lt;/em&gt; is a name of a syntax declared somewhere else in the language ( line 13); it could also be defined in any imported languages, but I don’t have any, we will look at that in a second; &lt;em&gt;app:&lt;/em&gt; is an alias assigned to this syntax which allows for it to be referenced in the production on the right side of the arrow operator; again – for the time being feel free to ignore any aliases, they have no impact on the parsing aspect.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So – my syntax main basically says we’re expecting to have in our source code something that matches the &lt;em&gt;AppDef&lt;/em&gt; syntax, then an opening curly bracket then something that matches the &lt;em&gt;ApplicationItems&lt;/em&gt; syntax and then closing curly bracket. simple.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Of course next the parser would look at the definition of &lt;em&gt;AppDef&lt;/em&gt; and &lt;em&gt;ApplicationItems&lt;/em&gt;, and so will we.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;em&gt;AppDef &lt;/em&gt;is defined in line 13 as an &lt;em&gt;ApplicationKW &lt;/em&gt;followed by &lt;em&gt;ApplicationName&lt;/em&gt;; these are defined in lines 51 and 90 respectively; lets look at the &lt;em&gt;ApplicationKW &lt;/em&gt;definition- &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;@{Classification[&amp;quot;Keyword&amp;quot;]} &lt;br /&gt;token applicationKW = &amp;quot;Application&amp;quot;; &lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;em&gt;ApplicationKW&lt;/em&gt; itself is a token with a fixed literal 'Application’ – this is a very simple rule to follow, and in fact I could have simply included this literal in the syntax definition and not use this token at all (which is what I have done previously).&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The reason I have separated it out to its own token is related to the preceding line in the grammar - the classification attribute allows me to mark this token as a “keyword” for my language, this would tell intellipad (and, presumably, any other editor that would learn how to work with mgrammar), that this token is a keyword and should be displayed as such; in intellipad this means it would be bolded in the editor, as you can see in the image below of my language open in intellipad - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://lh5.ggpht.com/_7lqvqdOFqOU/SbuKy5HCzeI/AAAAAAAAAFc/YXIvBE9aibw/s1600-h/image%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_7lqvqdOFqOU/SbuK0VhxYPI/AAAAAAAAAFg/hjnRYUNfZLs/image_thumb%5B2%5D.png?imgmax=800" width="627" height="388" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Back to the main syntax’ components - &lt;em&gt;ApplicationName, &lt;/em&gt;defined in line 51 states that an application name is composed of &lt;em&gt;AnyChar&lt;/em&gt;&amp;#160; followed by any number of &lt;em&gt;AnyChar&lt;/em&gt;, &lt;em&gt;AnyDigit&lt;/em&gt; or the literal ‘.’ with &lt;em&gt;AnyChar&lt;/em&gt; and &lt;em&gt;AnyDigit&lt;/em&gt; defined in lines 98 and 99.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The ‘+’ sign indicates the syntax or token it follows must exist at least once; the ‘*’ sign indicates the syntax or token it follows can exist 0 or more times.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So – we have the definition of our application name, now lets look at what &lt;em&gt;ApplicationItems&lt;/em&gt; says - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;syntax ApplicationItems = items:(Add | Build | ImportBinding | Comment)* =&amp;gt; {valuesof(items)}; &lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This syntax tells the parser that an application can have any number of &lt;em&gt;Add, Build, ImportBinding or Comment &lt;/em&gt;&lt;strong&gt;in any order.&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Moving on we’ll look briefly at how ImportBinding looks like - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;syntax ImportBinding = importKW bindingKW path:Path&amp;quot;;&amp;quot; =&amp;gt; ImportBinding{Path = path}; &lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The importKW (which is the literal&amp;#160; ‘import’, look it up!) followed by the bindingKW (‘binding’) and the syntax for &lt;em&gt;Path.&lt;/em&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I could have combined both literals import and binding to a single token and mark that as a keyword, but there are two benefits to splitting them up- firstly, by having two tokens I can have as many whitespaces as I want between them, which I think is what developers generally expect, and, secondly – the 'binding’ keyword is re-used for the add binding syntax I’ll describe shortly.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I’ll skip the Path definition, you can follow it yourself if you wish to; so next we can look at another item in the application items list – &lt;em&gt;Add:&lt;/em&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;syntax Add = addKW add:(Add_Reference | Add_Binding | Add_Assembly | Add_BTS_Assembly) =&amp;gt; Add{valuesof(add)}; &lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The &lt;em&gt;Add&lt;/em&gt; syntax starts with the addKW (‘add’) followed by one of the syntaxes for adding a reference, adding a binding, adding an assembly or adding a BizTalk assembly, but it only allows one; the add keyword (and therefore the entire add syntax) must be repeated as a whole to add multiple items to the application, as is suggested by the &lt;em&gt;ApplicationItems &lt;/em&gt;syntax.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Lets look at a couple of these items; first – the syntax for add binding - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;syntax Add_Binding = bindingKW path:Path env:MultiWordName&amp;quot;;&amp;quot; =&amp;gt; Binding[path,env]; &lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Here you can see the binding keyword being reused, as does the Path syntax; I’m then allowing a multi-word-name (which is essentially a string contained in double quotes) as the environment name for the added binding.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Quite simple, right? that’s the thing I love about mgrammar. let’s look at one more syntax - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;syntax Add_BTS_Assembly = &amp;quot;biztalk&amp;quot; assemblyKW path:Path orch:Orchestrations? details:AssemblyDetails&amp;quot;;&amp;quot; =&amp;gt; BizTalkAssembly[path,orch,Details{details}]; &lt;br /&gt;syntax Orchestrations  = withKW orchestrationsKW &amp;quot;{&amp;quot; type1:ApplicationName types:AdditionalOrchestrations* &amp;quot;}&amp;quot; =&amp;gt; Orchestrations{type1,valuesof(types)}; &lt;br /&gt;syntax AdditionalOrchestrations = &amp;quot;,&amp;quot; type:ApplicationName =&amp;gt; type; &lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The &lt;em&gt;Add_BTS_Assembly syntax&lt;/em&gt; should be very clear, the only thing I haven’t mentioned so far is the ? sign which indicates 1 or 0 appearances of the syntax/token it follows, I use this to allow a BizTalk assembly to &lt;strong&gt;optionally&lt;/strong&gt; describe the orchestrations it contains so that, potentially, any instances of these could be terminated when undeploying the application.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The &lt;em&gt;Orchestrations &lt;/em&gt;syntax, if exists, requires at least one orchestration to be specified (I’m reusing the &lt;em&gt;ApplicationName &lt;/em&gt;token as the orchestration name) but allows additional orchestratiosn to be specified as well; I’ve used the same approach for the add reference syntax.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I hope this makes sense, and that it gives you a glimpse into a practical use of mgrammar, I am certainly excited about this stuff.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Soon I hope to post about the last missing piece of the puzzle – the runtime that uses the language definition to parse, and then execute, any source code provided; after that the whole thing is likely to find a spot on CodePlex, bare with me a little bit longer….&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-8760025743043399530?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/E-seGc5IMTBbZGeoGQ56TH5yhtQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/E-seGc5IMTBbZGeoGQ56TH5yhtQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/E-seGc5IMTBbZGeoGQ56TH5yhtQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/E-seGc5IMTBbZGeoGQ56TH5yhtQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=YXSWTOoCLLk:mhg3-mFhzVY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=YXSWTOoCLLk:mhg3-mFhzVY:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=YXSWTOoCLLk:mhg3-mFhzVY:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=YXSWTOoCLLk:mhg3-mFhzVY:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=YXSWTOoCLLk:mhg3-mFhzVY:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=YXSWTOoCLLk:mhg3-mFhzVY:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/YXSWTOoCLLk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/8760025743043399530/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=8760025743043399530" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/8760025743043399530" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/8760025743043399530" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/YXSWTOoCLLk/oslo-based-solution-for-deploying_14.html" title="Oslo based solution for deploying BizTalk applications – the grammar" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/03/oslo-based-solution-for-deploying_14.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-8483905169056092941</id><published>2009-03-08T16:49:00.001Z</published><updated>2009-03-08T16:49:02.490Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="Deployment" /><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk 2009" /><title type="text">MSBuild support in BizTalk 2009</title><content type="html">&lt;p&gt;In my &lt;a href="http://www.sabratech.co.uk/blogs/yossidahan/2008/12/notes-on-biztalk-2009.html" target="_blank"&gt;notes on BizTalk 2009&lt;/a&gt; post I have highlighted the fact that now, as part of the BizTalk installation, you can select the “Project Build Components” which allow you to build BizTalk projects without Visual Studio or BizTalk installed on the build machine.&lt;/p&gt;  &lt;p&gt;This is very cool feature of the product, but I have to admit that I have missed something quite important; luckily - &lt;a href="http://blogical.se/blogs/mikael/default.aspx" target="_blank"&gt;Mikael Hakansson&lt;/a&gt; hadn’t – the provided tasks do not support deployment of BizTalk projects, but only build (see Mikael’s article &lt;a href="http://blogical.se/blogs/mikael/archive/2009/02/11/biztalk-2009-build-amp-deploy-automation-with-team-foundation-server-2008-part-1.aspx" target="_blank"&gt;here&lt;/a&gt;).&lt;/p&gt;  &lt;p&gt;What this means is that, while you can use the tasks deployed through the installation to verify that your BizTalk projects build correctly (as part of continuous integration setup, for example), you have no way of verifying that they can be deployed or, more importantly, run any automated tests;&lt;/p&gt;  &lt;p&gt;The &lt;a href="http://sdctasks.codeplex.com/" target="_blank"&gt;SDC tasks&lt;/a&gt;, with their support for BizTalk deployment, can come in very handy here, and you can certainly use them to augment the built in build support with deployment capabilities, but they add more dependencies to the plate, which has to be planned for.&lt;/p&gt;  &lt;p&gt;Of course, attending the MVP summit in Redmond last week we had a great chance of raising this (and various other) subjects with the product group, and we certainly have not let that opportunity go missed, now we just need to wait and see if they “pick up the glove”.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-8483905169056092941?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/y03NDItJ2kagdMcebI-QLH3PZXw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/y03NDItJ2kagdMcebI-QLH3PZXw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/y03NDItJ2kagdMcebI-QLH3PZXw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/y03NDItJ2kagdMcebI-QLH3PZXw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=8pzpD-ma0to:LKcPkeiol2Q:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=8pzpD-ma0to:LKcPkeiol2Q:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=8pzpD-ma0to:LKcPkeiol2Q:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=8pzpD-ma0to:LKcPkeiol2Q:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=8pzpD-ma0to:LKcPkeiol2Q:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=8pzpD-ma0to:LKcPkeiol2Q:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/8pzpD-ma0to" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/8483905169056092941/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=8483905169056092941" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/8483905169056092941" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/8483905169056092941" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/8pzpD-ma0to/msbuild-support-in-biztalk-2009.html" title="MSBuild support in BizTalk 2009" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/03/msbuild-support-in-biztalk-2009.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-993680861790187340</id><published>2009-03-04T00:02:00.001Z</published><updated>2009-03-04T00:43:48.410Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="&quot;M&quot;" /><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk" /><category scheme="http://www.blogger.com/atom/ns#" term="Deployment" /><category scheme="http://www.blogger.com/atom/ns#" term="MGrammar" /><category scheme="http://www.blogger.com/atom/ns#" term="Oslo" /><title type="text">Oslo based solution for deploying BizTalk applications</title><content type="html">&lt;p&gt;Since PDC I’ve been working on and off on an “Oslo” based solution for deploying a BizTalk application; unfortunately I couldn’t get a good chunk of time to play with this, so it’s been dragging a bit, but I’m getting close, so here are some details - &lt;/p&gt;  &lt;p&gt;I’m a big advocate of automated builds; it’s a topic that probably deserves a post of its own, so I won’t get started on this here, but the idea is that one must have a way to be confident that, when its time to [re-]deploy the app, it will get deployed successfully time after time, without a hitch; &lt;/p&gt;  &lt;p&gt;From my experience, deploying a BizTalk application of a decent size is often not trivial, and often it does not go smoothly if done manually (things are being missed, done out of order, wrong versions being picked up, etc), which does not help to boost the confidence in the solution (or BizTalk as a whole) in the organisation; automating the process can save a lot of time (can be done unattended, while in a meeting, out for lunch or overnight), save a lot of head scratching, boost the confidence in the solution and set the ground for proper automated builds, auto testing etc.&lt;/p&gt;  &lt;p&gt;To that extent, I have previously built an MSBuild based framework for deploying BizTalk applications. &lt;/p&gt;  &lt;p&gt;While I’m sure it does not suit all purposes as it was developed to support those scenarios I had, I think it’s quite comprehensive and had served me well over the past couple of years.&lt;/p&gt;  &lt;p&gt;It allows one to provide an MSBuild-formatted file with some parameters and lists and, using the pre-created framework, would do things like remove the existing application (after terminating current instances and un-enlisting services), build the new solution(s), deploy assemblies to BizTalk, add/import binding files, start ports etc.&lt;/p&gt;  &lt;p&gt;This is working great for us, and we’ve been using it extensively for quite a while now, but there’s one major downside – it requires one to maintain those MSBuild scripts. &lt;/p&gt;  &lt;p&gt;Now -&amp;#160; MSBuild is cool, I do like it very much, but as it’s generic – it does not speak in BizTalk terms, and as it’s XML – it’s quite verbose, and I wanted an easier format for all of us to work with.&lt;/p&gt;  &lt;p&gt;So – inspired after seeing Oslo and even more driven after visiting PDC - I’ve decided to come up with an MGrammar based language for describing a BizTalk application to be deployed.&lt;/p&gt;  &lt;p&gt;So far I’ve come up with “version 1.0” of my grammar that allows to describe the major artifacts in a BizTalk application and a basic runtime to process source files written in this language, the language allows you to describe things like -&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;References to other applications &lt;/li&gt;    &lt;li&gt;Solutions and projects to build &lt;/li&gt;    &lt;li&gt;BizTalk assemblies to deploy &lt;/li&gt;    &lt;li&gt;Orchestrations contained in those (these can then be terminated before attempting to remove the application prior to deployment) &lt;/li&gt;    &lt;li&gt;.net assemblies to deploy &lt;/li&gt;    &lt;li&gt;Binding file to import &lt;/li&gt;    &lt;li&gt;Binding files to add (and the name of the environment to attach to those) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;As Oslo hasn’t RTM-ed yet, I can’t quite rely on it yet, and so I cannot use it in production in any shape or form, or can I?    &lt;br /&gt;I found a good middle ground for us which allows us to gain from the benefits I’m hoping to get by using my language, while not exposing ourselves too much to the risks of using early technology – &lt;/p&gt;  &lt;p&gt;At the moment the runtime I’ve built for this is used to generate the MSBuild scripts we’re already using out of the source files; in this way - if Oslo disappears tomorrow, or significantly changes (not that I think that’s going to be the case), we’re safe – we still have the MSBuild scripts as “checked-in artifacts” and so we have lost nothing.&lt;/p&gt;  &lt;p&gt;So – how does an instance of my language looks like? here’s an example: &lt;/p&gt;  &lt;pre class="csharpcode"&gt;Application MyApp&lt;br /&gt;{&lt;br /&gt;    &lt;span class="rem"&gt;//add references to other applications&lt;/span&gt;&lt;br /&gt;    add reference SomeOtherApp;&lt;br /&gt;    add reference AndAnother,andAThird;&lt;br /&gt;    &lt;br /&gt;    &lt;span class="rem"&gt;//build the solution&lt;/span&gt;&lt;br /&gt;    build &lt;span class="str"&gt;&amp;quot;SomeFolder\SomeOtherFolder\SomeSolution.sln&amp;quot;&lt;/span&gt;;&lt;br /&gt;    build &lt;span class="str"&gt;&amp;quot;SomeFolder\SomeOtherFolder\SomeProject.btproj&amp;quot;&lt;/span&gt;;&lt;br /&gt;    &lt;br /&gt;    &lt;span class="rem"&gt;//add required biztalk assemblies&lt;/span&gt;&lt;br /&gt;    add biztalk assembly &lt;span class="str"&gt;&amp;quot;SomeFolder\SomeOtherFolder\bin\deployment\Schemas.dll&amp;quot;&lt;/span&gt;&lt;br /&gt;        version=1.0.0.0 &lt;br /&gt;        culture=neutral &lt;br /&gt;        publicKeyToken=314bd7037656ea65;&lt;br /&gt;&lt;br /&gt;    add biztalk assembly &lt;span class="str"&gt;&amp;quot;SomeFolder\SomeOtherFolder\bin\deployment\Maps.dll&amp;quot;&lt;/span&gt;&lt;br /&gt;        version=1.0.0.0 &lt;br /&gt;        culture=neutral &lt;br /&gt;        publicKeyToken=314bd7037656ea65;&lt;br /&gt;&lt;br /&gt;    add biztalk assembly &lt;span class="str"&gt;&amp;quot;SomeFolder\SomeOtherFolder\bin\deployment\Orchestrations.dll&amp;quot;&lt;/span&gt; &lt;br /&gt;    with orchestrations&lt;br /&gt;        {&lt;br /&gt;            MyApp.SomeOrchestration,&lt;br /&gt;            MyApp.AnottherOrchestration,&lt;br /&gt;            MyApp.AndAnotherOrchestration&lt;br /&gt;        }        &lt;br /&gt;        version=1.0.0.0 &lt;br /&gt;        culture=neutral &lt;br /&gt;        publicKeyToken=314bd7037656ea65;&lt;br /&gt;    &lt;br /&gt;    &lt;span class="rem"&gt;//and .net helpers assembly&lt;/span&gt;&lt;br /&gt;    add assembly &lt;span class="str"&gt;&amp;quot;SomeFolder\SomeOtherFolder\bin\release\HRG.FareWatch.Hotel.Helpers.dll&amp;quot;&lt;/span&gt; &lt;br /&gt;        version=1.0.0.0 &lt;br /&gt;        culture=neutral &lt;br /&gt;        publicKeyToken=314bd7037656ea65;&lt;br /&gt;    &lt;span class="rem"&gt;//import dev bindings&lt;/span&gt;&lt;br /&gt;    import binding &lt;span class="str"&gt;&amp;quot;SomeFolder\SomeOtherFolder\Bindings.xml&amp;quot;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;span class="rem"&gt;//add various environment's bindings.&lt;/span&gt;&lt;br /&gt;    add binding &lt;span class="str"&gt;&amp;quot;SomeFolder\SomeOtherFolder\Bindings.Dev.xml&amp;quot;&lt;/span&gt; &lt;span class="str"&gt;&amp;quot;development&amp;quot;&lt;/span&gt;;&lt;br /&gt;    add binding &lt;span class="str"&gt;&amp;quot;SomeFolder\SomeOtherFolder\Bindings.Stage.xml&amp;quot;&lt;/span&gt; &lt;span class="str"&gt;&amp;quot;stage&amp;quot;&lt;/span&gt;;&lt;br /&gt;    add binding &lt;span class="str"&gt;&amp;quot;SomeFolder\SomeOtherFolder\Bindings.Prod.xml&amp;quot;&lt;/span&gt; &lt;span class="str"&gt;&amp;quot;production&amp;quot;&lt;/span&gt;;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;as I’ve said – I already have a runtime that generates the MSBuild scripts required to deploy these - the runtime outputs several files to the temp folder -&amp;#160; &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;  &lt;li&gt;The “framework” MSBuild script that contains all the targets I’m using &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;The Microsoft.Sdc.Tasks.BizTalk.dll and the Microsoft.Sdc.Tasks.dll which contains many useful custom tasks. &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;The relevant import file for the SDC tasks &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;The generated MSBuild file that contains all the various artifacts based on the source code &lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;That latter file, which is the equivalent of my source code, and what we had to maintain so far, looks like - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&amp;lt;?xml version=&lt;span class="str"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt; encoding=&lt;span class="str"&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;?&amp;gt;&lt;br /&gt;&amp;lt;Project xmlns=&lt;span class="str"&gt;&amp;quot;http://schemas.microsoft.com/developer/msbuild/2003&amp;quot;&lt;/span&gt; DefaultTargets=&lt;span class="str"&gt;&amp;quot;DeployAll&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;  &amp;lt;Import Project=&lt;span class="str"&gt;&amp;quot;Deploy.Framework&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;  &amp;lt;ItemGroup&amp;gt;&lt;br /&gt;    &amp;lt;MyApp Include=&lt;span class="str"&gt;&amp;quot;SomeOtherApp&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;    &amp;lt;MyApp Include=&lt;span class="str"&gt;&amp;quot;AndAnother&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;    &amp;lt;MyApp Include=&lt;span class="str"&gt;&amp;quot;andAThird&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;  &amp;lt;/ItemGroup&amp;gt;&lt;br /&gt;  &amp;lt;ItemGroup&amp;gt;&lt;br /&gt;    &amp;lt;Bindings Include=&lt;span class="str"&gt;&amp;quot;General&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;      &amp;lt;path&amp;gt;SomeFolder\SomeOtherFolder\Bindings.xml&amp;lt;/path&amp;gt;&lt;br /&gt;    &amp;lt;/Bindings&amp;gt;&lt;br /&gt;  &amp;lt;/ItemGroup&amp;gt;&lt;br /&gt;  &amp;lt;ItemGroup&amp;gt;&lt;br /&gt;    &amp;lt;EnvironmentBindings Include=&lt;span class="str"&gt;&amp;quot;General&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;      &amp;lt;path&amp;gt;&lt;span class="str"&gt;&amp;quot;SomeFolder\SomeOtherFolder\Bindings.Dev.xml&amp;quot;&lt;/span&gt;&amp;lt;/path&amp;gt;&lt;br /&gt;      &amp;lt;environment&amp;gt;development&amp;lt;/environment&amp;gt;&lt;br /&gt;    &amp;lt;/EnvironmentBindings&amp;gt;&lt;br /&gt;    &amp;lt;EnvironmentBindings Include=&lt;span class="str"&gt;&amp;quot;General&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;      &amp;lt;path&amp;gt;&lt;span class="str"&gt;&amp;quot;SomeFolder\SomeOtherFolder\Bindings.Stage.xml&amp;quot;&lt;/span&gt;&amp;lt;/path&amp;gt;&lt;br /&gt;      &amp;lt;environment&amp;gt;stage&amp;lt;/environment&amp;gt;&lt;br /&gt;    &amp;lt;/EnvironmentBindings&amp;gt;&lt;br /&gt;    &amp;lt;EnvironmentBindings Include=&lt;span class="str"&gt;&amp;quot;General&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;      &amp;lt;path&amp;gt;&lt;span class="str"&gt;&amp;quot;SomeFolder\SomeOtherFolder\Bindings.Prod.xml&amp;quot;&lt;/span&gt;&amp;lt;/path&amp;gt;&lt;br /&gt;      &amp;lt;environment&amp;gt;production&amp;lt;/environment&amp;gt;&lt;br /&gt;    &amp;lt;/EnvironmentBindings&amp;gt;&lt;br /&gt;  &amp;lt;/ItemGroup&amp;gt;&lt;br /&gt;  &amp;lt;ItemGroup&amp;gt;&lt;br /&gt;    &amp;lt;ExternNetAssembly Include=&lt;span class="str"&gt;&amp;quot;HRG.FareWatch.Hotel.Helpers&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;      &amp;lt;Version&amp;gt;1.0.0.0&amp;lt;/Version&amp;gt;&lt;br /&gt;      &amp;lt;Culture&amp;gt;neutral&amp;lt;/Culture&amp;gt;&lt;br /&gt;      &amp;lt;PublicKeyToken&amp;gt;314bd7037656ea65&amp;lt;/PublicKeyToken&amp;gt;&lt;br /&gt;      &amp;lt;ProcessorArchitecture&amp;gt;MSIL&amp;lt;/ProcessorArchitecture&amp;gt;&lt;br /&gt;      &amp;lt;path&amp;gt;SomeFolder\SomeOtherFolder\bin\release&amp;lt;/path&amp;gt;&lt;br /&gt;    &amp;lt;/ExternNetAssembly&amp;gt;&lt;br /&gt;  &amp;lt;/ItemGroup&amp;gt;&lt;br /&gt;  &amp;lt;ItemGroup&amp;gt;&lt;br /&gt;    &amp;lt;Solution Include=&lt;span class="str"&gt;&amp;quot;SomeSolution&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;      &amp;lt;path&amp;gt;SomeFolder\SomeOtherFolder&amp;lt;/path&amp;gt;&lt;br /&gt;    &amp;lt;/Solution&amp;gt;&lt;br /&gt;    &amp;lt;Solution Include=&lt;span class="str"&gt;&amp;quot;SomeProject&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;      &amp;lt;path&amp;gt;SomeFolder\SomeOtherFolder&amp;lt;/path&amp;gt;&lt;br /&gt;    &amp;lt;/Solution&amp;gt;&lt;br /&gt;  &amp;lt;/ItemGroup&amp;gt;&lt;br /&gt;  &amp;lt;ItemGroup&amp;gt;&lt;br /&gt;    &amp;lt;BTSProject Include=&lt;span class="str"&gt;&amp;quot;Schemas&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;      &amp;lt;Version&amp;gt;1.0.0.0&amp;lt;/Version&amp;gt;&lt;br /&gt;      &amp;lt;Culture&amp;gt;neutral&amp;lt;/Culture&amp;gt;&lt;br /&gt;      &amp;lt;PublicKeyToken&amp;gt;314bd7037656ea65&amp;lt;/PublicKeyToken&amp;gt;&lt;br /&gt;      &amp;lt;ProcessorArchitecture&amp;gt;MSIL&amp;lt;/ProcessorArchitecture&amp;gt;&lt;br /&gt;      &amp;lt;path&amp;gt;SomeFolder\SomeOtherFolder\bin\deployment&amp;lt;/path&amp;gt;&lt;br /&gt;    &amp;lt;/BTSProject&amp;gt;&lt;br /&gt;    &amp;lt;BTSProject Include=&lt;span class="str"&gt;&amp;quot;Maps&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;      &amp;lt;Version&amp;gt;1.0.0.0&amp;lt;/Version&amp;gt;&lt;br /&gt;      &amp;lt;Culture&amp;gt;neutral&amp;lt;/Culture&amp;gt;&lt;br /&gt;      &amp;lt;PublicKeyToken&amp;gt;314bd7037656ea65&amp;lt;/PublicKeyToken&amp;gt;&lt;br /&gt;      &amp;lt;ProcessorArchitecture&amp;gt;MSIL&amp;lt;/ProcessorArchitecture&amp;gt;&lt;br /&gt;      &amp;lt;path&amp;gt;SomeFolder\SomeOtherFolder\bin\deployment&amp;lt;/path&amp;gt;&lt;br /&gt;    &amp;lt;/BTSProject&amp;gt;&lt;br /&gt;    &amp;lt;BTSProject Include=&lt;span class="str"&gt;&amp;quot;Orchestrations&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;      &amp;lt;Version&amp;gt;1.0.0.0&amp;lt;/Version&amp;gt;&lt;br /&gt;      &amp;lt;Culture&amp;gt;neutral&amp;lt;/Culture&amp;gt;&lt;br /&gt;      &amp;lt;PublicKeyToken&amp;gt;314bd7037656ea65&amp;lt;/PublicKeyToken&amp;gt;&lt;br /&gt;      &amp;lt;ProcessorArchitecture&amp;gt;MSIL&amp;lt;/ProcessorArchitecture&amp;gt;&lt;br /&gt;      &amp;lt;path&amp;gt;SomeFolder\SomeOtherFolder\bin\deployment&amp;lt;/path&amp;gt;&lt;br /&gt;    &amp;lt;/BTSProject&amp;gt;&lt;br /&gt;  &amp;lt;/ItemGroup&amp;gt;&lt;br /&gt;  &amp;lt;PropertyGroup&amp;gt;&lt;br /&gt;    &amp;lt;BTApplicationName&amp;gt;MyApp&amp;lt;/BTApplicationName&amp;gt;&lt;br /&gt;    &amp;lt;!-- Set &lt;span class="kwrd"&gt;for&lt;/span&gt; a remote deployment --&amp;gt;&lt;br /&gt;    &amp;lt;!-- Deploying BizTalk Server name - leave blank &lt;span class="kwrd"&gt;if&lt;/span&gt; local--&amp;gt;&lt;br /&gt;    &amp;lt;!-- not currently supported by runtime--&amp;gt;&lt;br /&gt;    &amp;lt;BTServerName&amp;gt;&lt;br /&gt;    &amp;lt;/BTServerName&amp;gt;&lt;br /&gt;    &amp;lt;!-- Deploying BizTalk Server database - leave blank &lt;span class="kwrd"&gt;if&lt;/span&gt; BizTalkMsgBoxDb--&amp;gt;&lt;br /&gt;    &amp;lt;BTServerDatabase&amp;gt;&lt;br /&gt;    &amp;lt;/BTServerDatabase&amp;gt;&lt;br /&gt;    &amp;lt;!-- Deploying BizTalk Server SQL user name - leave blank &lt;span class="kwrd"&gt;if&lt;/span&gt; local--&amp;gt;&lt;br /&gt;    &amp;lt;BTServerUserName&amp;gt;&lt;br /&gt;    &amp;lt;/BTServerUserName&amp;gt;&lt;br /&gt;    &amp;lt;!-- Deploying BizTalk Server SQL password - leave blank &lt;span class="kwrd"&gt;if&lt;/span&gt; local--&amp;gt;&lt;br /&gt;    &amp;lt;BTServerPassword&amp;gt;&lt;br /&gt;    &amp;lt;/BTServerPassword&amp;gt;&lt;br /&gt;  &amp;lt;/PropertyGroup&amp;gt;&lt;br /&gt;&amp;lt;/Project&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Would you agree that the former source code is easier to maintain? &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;em&gt;note: one thing you would notice is that none of the paths contains a root; I assume that this would be used by different developers/IT pros which may have the code in a different path; however, as the assumption is that the code will come from source control, my framework script expects you to provide the root path to your source code and assumes the specified paths start there.&lt;/em&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;  &lt;br /&gt;So – what’s next? &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;From a coding perspective - I plan to add support in my runtime to perform the actual deployment; this is I would like it to do once Oslo is in production so I’ll add it as an option through a command line switch.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This option would tell the runtime to deploy the artifacts to a specified BizTalk server using BTSTask or the Object model instead of generated the MSBuild script.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I also want to make some modification to my language definition to make the MGraph produced cleaner (and better geared towards using the repository and Quadrant at a later stage) as well as, obviously, add support for more features, after which I plan to publish both my language and the runtime somewhere (here, codeplex, DevCente..we’ll see) &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I’ll post some more notes on all of these here in the near future hopefully…&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-993680861790187340?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/gET4vZiTldpFBEX6wW96Dvd1iKI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gET4vZiTldpFBEX6wW96Dvd1iKI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/gET4vZiTldpFBEX6wW96Dvd1iKI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gET4vZiTldpFBEX6wW96Dvd1iKI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=f-VzLzECQoo:-7HvoFZU6yw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=f-VzLzECQoo:-7HvoFZU6yw:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=f-VzLzECQoo:-7HvoFZU6yw:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=f-VzLzECQoo:-7HvoFZU6yw:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=f-VzLzECQoo:-7HvoFZU6yw:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=f-VzLzECQoo:-7HvoFZU6yw:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/f-VzLzECQoo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/993680861790187340/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=993680861790187340" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/993680861790187340" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/993680861790187340" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/f-VzLzECQoo/oslo-based-solution-for-deploying.html" title="Oslo based solution for deploying BizTalk applications" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">6</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/03/oslo-based-solution-for-deploying.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-2835528989936495880</id><published>2009-02-21T06:57:00.001Z</published><updated>2009-02-21T06:57:06.417Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="Serialization" /><category scheme="http://www.blogger.com/atom/ns#" term="XSD" /><category scheme="http://www.blogger.com/atom/ns#" term="Xml" /><title type="text">Serialisation, mixed content and string[]</title><content type="html">&lt;p&gt;When you generate a class out of a schema with an element configured to allow mixed content (child attributes and elements as well as text), you should expect the corresponding generated field type to be a string array; &lt;p&gt;So&amp;nbsp; - if you have a schema that looks like this  &lt;p&gt;&lt;span style="color: blue"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #a31515"&gt;xml &lt;/span&gt;&lt;span style="color: red"&gt;version&lt;/span&gt;&lt;span style="color: blue"&gt;="1.0" &lt;/span&gt;&lt;span style="color: red"&gt;encoding&lt;/span&gt;&lt;span style="color: blue"&gt;="utf-8"?&amp;gt;&lt;br&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:schema &lt;/span&gt;&lt;span style="color: red"&gt;targetNamespace&lt;/span&gt;&lt;span style="color: blue"&gt;="http://tempuri.org/XMLSchema.xsd" &lt;/span&gt;&lt;span style="color: red"&gt;elementFormDefault&lt;/span&gt;&lt;span style="color: blue"&gt;="qualified"&amp;nbsp; &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;="http://tempuri.org/XMLSchema.xsd"&amp;nbsp; &lt;/span&gt;&lt;span style="color: red"&gt;xmlns:mstns&lt;/span&gt;&lt;span style="color: blue"&gt;="http://tempuri.org/XMLSchema.xsd"&lt;br&gt; &lt;/span&gt;&lt;span style="color: red"&gt;xmlns:xs&lt;/span&gt;&lt;span style="color: blue"&gt;="http://www.w3.org/2001/XMLSchema"&amp;gt;&lt;br&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:element &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;="SomeElement"&amp;gt;&lt;br&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:complexType &lt;/span&gt;&lt;span style="color: red"&gt;mixed&lt;/span&gt;&lt;span style="color: blue"&gt;="true"&amp;gt;&lt;br&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:sequence&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:element &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;="Child1" &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;="xs:string"/&amp;gt;&lt;br&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:element &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;="Child2" &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;="xs:string"/&amp;gt;&lt;br&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:element &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;="Child3" &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;="xs:string"/&amp;gt;&lt;br&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:sequence&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:attribute &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;="SomeAttribute" &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;="xs:string"/&amp;gt;&lt;br&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:complexType&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:element&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;xs:schema&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;(not ‘SomeElement’ being a complex type allowing mixed content)&lt;/p&gt; &lt;p&gt;The fields in the generated class would look like  &lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;span style="color: blue"&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SomeElement {&lt;br /&gt; &lt;br /&gt; &lt;/span&gt;&lt;span style="color: blue"&gt;private string child1Field;&lt;br /&gt; &lt;br /&gt; private string child2Field;&lt;br /&gt; &lt;br /&gt; private string child3Field;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; private string[] textField;&lt;br /&gt;&lt;/strong&gt; &lt;br /&gt; private string someAttributeField;&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;font color="#000000"&gt;The reason is that an XML corresponding to the schema might look like this – &lt;/font&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;SomeElement &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;="http://tempuri.org/XMLSchema.xsd" &lt;/span&gt;&lt;span style="color: red"&gt;SomeAttribute&lt;/span&gt;&lt;span style="color: blue"&gt;="someAttributeValue"&amp;gt;&lt;br /&gt; Some free text&lt;br /&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Child1&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;Child1 text&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Child1&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt; Some more free text&lt;br /&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Child2&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;Child2 text&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Child2&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt; yet some more free text&lt;br /&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Child3&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;Child3 text&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Child3&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;SomeElement&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;font color="#000000"&gt;And so by using a string array to hold the text the deserialiser can keep string portion separately.&lt;/font&gt;&lt;br /&gt;&lt;p&gt;&lt;font color="#000000"&gt;Initially, I thought, this allows the structure to represent the original xml accurately, but this is not exactly the case – you would still not know for certain where each string portion existed, especially if in the source XML you get a few elements that don’t have text between them, which , I suspect, is why when I serialise the instance back to xml I actually get – &lt;/font&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #a31515"&gt;xml &lt;/span&gt;&lt;span style="color: red"&gt;version&lt;/span&gt;&lt;span style="color: blue"&gt;="1.0"?&amp;gt;&lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;SomeElement &lt;/span&gt;&lt;span style="color: red"&gt;xmlns:xsi&lt;/span&gt;&lt;span style="color: blue"&gt;="http://www.w3.org/2001/XMLSchema-instance" &lt;/span&gt;&lt;span style="color: red"&gt;xmlns:xsd&lt;/span&gt;&lt;span style="color: blue"&gt;="http://www.w3.org/2001/XMLSchema" &lt;/span&gt;&lt;span style="color: red"&gt;SomeAttribute&lt;/span&gt;&lt;span style="color: blue"&gt;="someAttributeValue" &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;="http://tempuri.org/XMLSchema.xsd"&amp;gt;&lt;br /&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Child1&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;Child1 text&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Child1&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Child2&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;Child2 text&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Child2&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Child3&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;Child3 text&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Child3&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt; Some free text&lt;br /&gt; &lt;br /&gt; Some more free text&lt;br /&gt; &lt;br /&gt; yet some more free text&lt;br /&gt; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;SomeElement&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;Now, I don’t particularly like this sort of xml, and shy away from mixed content; I don’t believe that xml snippets like my samples above are useful, specifically I don’t think that mixing elements and text is particularly nice.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;However, consider an element with an attribute and some text – the following is quite reasonable I think, and yet requires mixed content - &lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Phone &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;="mobile"&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;some text here&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Phone&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-2835528989936495880?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/5Us66qVNtPpf4Fh_AA-xg_pRx8A/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5Us66qVNtPpf4Fh_AA-xg_pRx8A/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/5Us66qVNtPpf4Fh_AA-xg_pRx8A/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5Us66qVNtPpf4Fh_AA-xg_pRx8A/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=w6v9eTkKQ78:xhZeDVHBhDk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=w6v9eTkKQ78:xhZeDVHBhDk:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=w6v9eTkKQ78:xhZeDVHBhDk:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=w6v9eTkKQ78:xhZeDVHBhDk:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=w6v9eTkKQ78:xhZeDVHBhDk:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=w6v9eTkKQ78:xhZeDVHBhDk:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/w6v9eTkKQ78" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/2835528989936495880/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=2835528989936495880" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/2835528989936495880" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/2835528989936495880" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/w6v9eTkKQ78/serialisation-mixed-content-and-string.html" title="Serialisation, mixed content and string[]" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/02/serialisation-mixed-content-and-string.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-1265534437018582155</id><published>2009-02-15T11:04:00.001Z</published><updated>2009-02-15T11:04:51.971Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="Federated Identity" /><category scheme="http://www.blogger.com/atom/ns#" term="Geneva" /><title type="text">Supporting both active and passive scenarios in my STS</title><content type="html">&lt;p&gt;In a comment on a previous &lt;a href="http://geekswithblogs.net/Connected/archive/2008/12/04/geneva-based-passive-sts-and-.net-2.0-web-applications.aspx#428095" target="_blank"&gt;blog post&lt;/a&gt; Travis Spencer asked&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Can you explain more about how you implemented an STS that supports both active and passive scenarios?&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So here’s how - &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p align="left"&gt;To start with – I’ve implemented my STS class with all the logic I needed; this was done as a class library with several classes – my STS implementation, my STS-Configuration class, an STS service factory, my custom WindowsUserNameSecurityTokenHandler implementation and all the classes I needed to support my custom configuration section.&lt;/p&gt;  &lt;p align="left"&gt;Then, in order to support an active scenario, I’ve created a WCF service and, through the SVC file, I’ve configured it to use my STS service factory class -&lt;/p&gt;  &lt;p align="left"&gt;&amp;#160;&lt;/p&gt;  &lt;p align="left"&gt;&amp;lt;%@ ServiceHost Language=&amp;quot;C#&amp;quot; Debug=&amp;quot;true&amp;quot; Service=&amp;quot;&amp;lt;My STS configuration class&amp;gt;&amp;quot;&amp;#160; factory=&amp;quot;&amp;lt;My STS Factory class&amp;gt;&amp;quot;%&amp;gt;&lt;/p&gt;  &lt;p align="left"&gt;&amp;#160;&lt;/p&gt;  &lt;p align="left"&gt;I’ve then configured the web.config of the wcf service to support my scenario – that included all the relevant binding configuration I needed,&amp;#160; the Geneva framework related configuration (microsoft.IdentityModel) as well as any custom configuration my STS uses.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The passive scenario can seem a little bit more confusing - &lt;/p&gt;  &lt;p&gt;Obviously I’ve started by creating an asp.net web application; this application basically&amp;#160; has two web pages (admittedly I’m simplifying things a little bit for clarity) – default.aspx and login.aspx&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Using standard asp.net forms authentication the web site is configured to redirect all unauthenticated users to the Login.aspx page, which in turns has a pretty standard login implementation using my custom username validator logic and the framework’s RedirectFromLoginPage function to set the local forms authentication cookie.&lt;/p&gt;  &lt;p&gt;All my web-based reliant parties redirect the user to the default.aspx page; forms-auth then redirects again to login.aspx for authentication and then, once authenticated, the user is redirected back to default.aspx; on this page I’ve simply put the FederatedPassiveTokenService control provided with the geneva framework configured to use my STS configuration class as the service; this takes care of calling the STS and posting the token back to the RP &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I hope that makes sense…do let me know if it does not!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-1265534437018582155?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/3U1j_rHROVAhoSWdGonBpfC59co/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3U1j_rHROVAhoSWdGonBpfC59co/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/3U1j_rHROVAhoSWdGonBpfC59co/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3U1j_rHROVAhoSWdGonBpfC59co/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=s66xSINyQM4:oTEtG_m4DNE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=s66xSINyQM4:oTEtG_m4DNE:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=s66xSINyQM4:oTEtG_m4DNE:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=s66xSINyQM4:oTEtG_m4DNE:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=s66xSINyQM4:oTEtG_m4DNE:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=s66xSINyQM4:oTEtG_m4DNE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/s66xSINyQM4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/1265534437018582155/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=1265534437018582155" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/1265534437018582155" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/1265534437018582155" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/s66xSINyQM4/supporting-both-active-and-passive.html" title="Supporting both active and passive scenarios in my STS" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/02/supporting-both-active-and-passive.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-4050427144647787033</id><published>2009-02-07T17:34:00.001Z</published><updated>2009-02-07T17:34:15.059Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="visual studio" /><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk" /><title type="text">VS crashes? check your colour depth setting!</title><content type="html">&lt;p&gt;Over the last few months we've been seeing quite a few Visual Studio crashes when working with the orchestration designer. &lt;/p&gt;  &lt;p&gt;The scenarios vary slightly between machines - some would crash on build, others simply when opening an orchestration in the designer; some would crash very frequently, some only sporadically; some would crash even when opening the solution immediately after a reboot, others would work fine for a while and then crash; the bottom line was that we were having lots of crashes, and we were losing on developer productivity and gaining tons of frustration.&lt;/p&gt;  &lt;p&gt;Because the problems did not happen in a very consistent manner, and because there were different manifestations we simply had no clue what might be the cause; we've talked to a few people and searched the web; we’ve followed almost every tip we've received (make sure no documents are open when you build, collapse all shapes in an orchestration before saving it, etc.); some seem to have helped a little bit, but the crashes kept happening.&lt;/p&gt;  &lt;p&gt;Sometimes Visual Studio would show an error on the screen – something like - &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://lh4.ggpht.com/_7lqvqdOFqOU/SY3GEvX0uiI/AAAAAAAAAEs/z_BX8m8O9iM/s1600-h/image4.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="207" alt="image" src="http://lh4.ggpht.com/_7lqvqdOFqOU/SY3GFVbh1MI/AAAAAAAAAEw/HJfHZc0o3ms/image_thumb2.png?imgmax=800" width="477" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;But in other times, it simply crashed without a warning.&lt;/p&gt;  &lt;p&gt;Eventually we’ve contacted Microsoft support, and analysing dumps we’ve created they have found the following error - &lt;/p&gt;  &lt;pre class="csharpcode"&gt;Exception type: System.InvalidOperationException&lt;br /&gt;Message: BufferedGraphicsContext cannot be disposed of because a buffer operation &lt;span class="kwrd"&gt;is&lt;/span&gt; currently &lt;span class="kwrd"&gt;in&lt;/span&gt; progress.&lt;br /&gt;StackTrace (generated):&lt;br /&gt;System_Drawing_ni!System.Drawing.BufferedGraphicsContext.Dispose(Boolean)&lt;br /&gt;System_Drawing_ni!System.Drawing.BufferedGraphicsContext.Dispose()&lt;br /&gt;System_Drawing_ni!System.Drawing.BufferedGraphicsContext.AllocBufferInTempManager(System.Drawing.Graphics, IntPtr, System.Drawing.Rectangle)&lt;br /&gt;System_Drawing_ni!System.Drawing.BufferedGraphicsContext.Allocate(IntPtr, System.Drawing.Rectangle)&lt;br /&gt;System_Windows_Forms_ni!System.Windows.Forms.Control.WmPaint(System.Windows.Forms.Message ByRef)&lt;br /&gt;System_Windows_Forms_ni!System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)&lt;br /&gt;System_Windows_Forms_ni!System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)&lt;br /&gt;System_Windows_Forms_ni!System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)&lt;br /&gt;System_Windows_Forms_ni!System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32, IntPtr, IntPtr)&lt;/pre&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;From this it was clear that the issue is related to GDI+ when VS redraws the orchestration and MS have confirmed they have seen this issue elsewhere (outside the BizTalk realm), but we were told that this problem was “aggravated by the fact that BizTalk creates very large device-independent bitmaps and uses the same colour depth than the desktop.”&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Unfortunately, according to Microsoft, there are many contributing factors to this issue, and it is virtually impossible to isolate the cause(s) in our case, but two recommendations were made - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;  &lt;li&gt;Use a video card with more memory &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;Lower colour depth setting from 32 bit to 16 bit in the display settings in windows &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;Split large orchestrations to smaller ones &lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;That last recommendation would have been our last resort – not only it would require a significant re-factor-re-test effort as our solution is quite&amp;#160; big, it would seriously decrease our already too long deployment time.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;We were quite happy to follow the first recommendation, but obviously trying the second one was pretty effortless we went with that first and what do you know – it worked!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Machines which have changed the colour depth setting to 16 bit stopped having those frequent crashes; &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;It must be said we’re still experiencing some crashes, so there are other issues as well, but these are more specific, and are another story altogether, one to be told once the end is known!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-4050427144647787033?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/vyj03b2Ne_4IPHgjJsTPMiFjO5M/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vyj03b2Ne_4IPHgjJsTPMiFjO5M/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/vyj03b2Ne_4IPHgjJsTPMiFjO5M/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vyj03b2Ne_4IPHgjJsTPMiFjO5M/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=BS8O8MsfiKU:tL04Xka_6rs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=BS8O8MsfiKU:tL04Xka_6rs:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=BS8O8MsfiKU:tL04Xka_6rs:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=BS8O8MsfiKU:tL04Xka_6rs:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=BS8O8MsfiKU:tL04Xka_6rs:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=BS8O8MsfiKU:tL04Xka_6rs:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/BS8O8MsfiKU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/4050427144647787033/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=4050427144647787033" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/4050427144647787033" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/4050427144647787033" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/BS8O8MsfiKU/vs-crashes-check-your-colour-depth.html" title="VS crashes? check your colour depth setting!" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/02/vs-crashes-check-your-colour-depth.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-8759857482896988070</id><published>2009-01-25T08:08:00.001Z</published><updated>2009-01-25T08:08:07.053Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="IIS" /><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><title type="text">Specifying the user for a service to run as</title><content type="html">&lt;p&gt;Mostly a reminder for myself, but hopefully useful to somebody else - &lt;/p&gt;  &lt;p&gt;Often it is important to specify a specific user for a service to run as; it appears the setup is completely different when using IIS 5.1 or 6 (and higher).&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;When using IIS 5.1 &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Set the anonymous user on the virtual directory to the user you want to run as.&lt;/li&gt;    &lt;li&gt;Disable any other authentication method on the vdir&lt;/li&gt;    &lt;li&gt;In the web.config turn impersonation &lt;strong&gt;ON &lt;/strong&gt;(&amp;lt;identity impersonate=&amp;quot;true&amp;quot; /&amp;gt; under System.web.)&lt;/li&gt;    &lt;li&gt;Under System.serviceModel add&amp;#160; &amp;lt;&lt;span style="color: #a11f12"&gt;serviceHostingEnvironment &lt;/span&gt;&lt;span style="color: red"&gt;aspNetCompatibilityEnabled&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot;/&amp;gt; &lt;/span&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/li&gt;   &lt;style type="text/css"&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;    &lt;li&gt;To the service class add&amp;#160; [&lt;span style="color: #4181c0"&gt;AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] &lt;/span&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;When using IIS 6.0&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;In the web.config turn impersonation &lt;strong&gt;OFF&lt;/strong&gt;(&amp;lt;identity impersonate=&amp;quot;false&amp;quot; /&amp;gt; under System.web.)&lt;/li&gt;    &lt;li&gt;Set the required identity in the app pool your virtual directory runs under.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;(which one do you prefer? ;-))&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-8759857482896988070?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rbKA3AyW-3BxCvmj_B60Lh19ReU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rbKA3AyW-3BxCvmj_B60Lh19ReU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rbKA3AyW-3BxCvmj_B60Lh19ReU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rbKA3AyW-3BxCvmj_B60Lh19ReU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=BorKk_8ytpw:uHwu-lzuaUs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=BorKk_8ytpw:uHwu-lzuaUs:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=BorKk_8ytpw:uHwu-lzuaUs:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=BorKk_8ytpw:uHwu-lzuaUs:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=BorKk_8ytpw:uHwu-lzuaUs:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=BorKk_8ytpw:uHwu-lzuaUs:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/BorKk_8ytpw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/8759857482896988070/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=8759857482896988070" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/8759857482896988070" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/8759857482896988070" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/BorKk_8ytpw/specifying-user-for-service-to-run-as.html" title="Specifying the user for a service to run as" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/01/specifying-user-for-service-to-run-as.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-16555583901917795</id><published>2009-01-13T09:46:00.001Z</published><updated>2009-01-13T09:46:26.876Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="Federated Identity" /><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk" /><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk 2009" /><title type="text">Publishing a service with federated identity from BizTalk Server [2009] – Part II</title><content type="html">&lt;p&gt;In my previous blog &lt;a href="http://www.sabratech.co.uk/blogs/yossidahan/2009/01/calling-service-with-federated-identity.html" target="_blank"&gt;post&lt;/a&gt; I’ve described how I consumed a service that uses ws2007FederationHttpBinding from BizTalk Server; my next task was to expose an orchestration as a WCF service that uses this binding.&lt;/p&gt;  &lt;p&gt;In that post I’ve described what I think is a bug in BizTalk R2/2009 which prevents me from setting the issuer configuration through the UI. &lt;/p&gt;  &lt;p&gt;When consuming such a service this configuration exists in the send port, and I’ve managed to get enough time to manually edit a BizTalk bindings file to import in order to set the required configuration I can’t set through the UI; I have tried to do the same for the receive location, but the binding file's format is different and my few attempts before my time ran out did not work. &lt;/p&gt;  &lt;p&gt;I have submitted this buy to Microsoft, and hopefully they’ll provide a fix/some information about a possible work around; I suspect my best bet is to use the explorer OM to configure the receive location, but I just can’t get the time to do it now, so – I’m afraid this post is mostly a place holder, and I really hope I’d be able to come and update it with some more details soon.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-16555583901917795?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/AoTpnxHBFKBenBolp8NSkdVYXKU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AoTpnxHBFKBenBolp8NSkdVYXKU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/AoTpnxHBFKBenBolp8NSkdVYXKU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AoTpnxHBFKBenBolp8NSkdVYXKU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=CXyrSaaipQk:srbJaMkFqTI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=CXyrSaaipQk:srbJaMkFqTI:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=CXyrSaaipQk:srbJaMkFqTI:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=CXyrSaaipQk:srbJaMkFqTI:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=CXyrSaaipQk:srbJaMkFqTI:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=CXyrSaaipQk:srbJaMkFqTI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/CXyrSaaipQk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/16555583901917795/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=16555583901917795" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/16555583901917795" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/16555583901917795" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/CXyrSaaipQk/publishing-service-with-federated.html" title="Publishing a service with federated identity from BizTalk Server [2009] – Part II" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/01/publishing-service-with-federated.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-8945397101989216365</id><published>2009-01-13T09:38:00.001Z</published><updated>2009-01-13T09:38:34.822Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="Federated Identity" /><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk" /><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk 2009" /><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><title type="text">Calling a service with federated identity from BizTalk Server [2009] – Part I</title><content type="html">&lt;p&gt;Finally I’ve reached the point where I’m ready to hook up BizTalk to my STS implementation to participate in a federated identity scenario. &lt;/p&gt;  &lt;p&gt;My goal is to confirm two scenarios - &lt;/p&gt;  &lt;p&gt;1. Being able to call from a BizTalk process a service that uses the ws2007FederationHttpBinding (and requires that the caller provide a token issued by a specific STS)&lt;/p&gt;  &lt;p&gt;2. Being able to expose a service in BizTalk that would use the ws2007FederationHttpBinding requiring the caller to provide such token.&lt;/p&gt;  &lt;p&gt;If you followed my previous posts you would probably know that I already have a fairly extensive federated identity scenario – I have a custom STS built using the Geneva Framework, a few web sites and a test WCF service all use the STS for their authentication (and, indirectly, authorisation), so it is just a case of hooking BizTalk to all of that, and to start with I decided to try and consume that test service from a BizTalk process. &lt;/p&gt;  &lt;p&gt;I’m using BizTalk 2009 Beta to keep things interesting, but I’m pretty sure it would all be exactly the same for R2.&lt;/p&gt;  &lt;p&gt;The beginning was easy – in my BizTalk project I’ve used the “Consume WCF Service” wizard from the “Add Generated Items” menu to generate all the artifacts needed to consume my service; the generation went very smoothly and soon enough I had an orchestration that could receive a dummy trigger message, create the service request, receive the service response and deliver it to a send port for me to check it out.&lt;/p&gt;  &lt;p&gt;I’ve deployed the project and then imported the binding file generated by the wizard to create the WCF send port. &lt;/p&gt;  &lt;p&gt;Checking the port configuration, though, I found a few issues - &lt;/p&gt;  &lt;p&gt;The port uses the WCF-Custom adapter, which was correctly configured with the service’s endpoint and the ws2007FederationHttpBinding; however – my STS endpoint is configured to use the ws2007HttpBinding and requires UserName credentials, but these settings were not copied over to the client configuration from the service's contract, the client configuration should have looked like - &lt;/p&gt;  &lt;p&gt;&amp;lt;security mode=&amp;quot;Message&amp;quot;&amp;gt;    &lt;br /&gt;&amp;#160; &amp;lt;message algorithmSuite=&amp;quot;Default&amp;quot; issuedKeyType=&amp;quot;SymmetricKey&amp;quot;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; issuedTokenType=&amp;quot;&lt;a href="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1&amp;quot;"&gt;http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1&amp;quot;&lt;/a&gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; negotiateServiceCredential=&amp;quot;true&amp;quot;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;issuer address=&amp;quot;[STS URL HERE]” binding=&amp;quot;ws2007HttpBinding&amp;quot; bindingConfiguration=&amp;quot;stsBinding&amp;quot;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;identity&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;dns value=&amp;quot;STS&amp;quot;/&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/identity&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/issuer&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;issuerMetadata address=&amp;quot;&lt;a href="http://localhost/HRGSTS/Active/HRGSTS/mex&amp;quot;"&gt;[STS MEX ENDPOINT HERE]&amp;quot;&lt;/a&gt; /&amp;gt;     &lt;br /&gt;&amp;#160; &amp;lt;/message&amp;gt;     &lt;br /&gt;&amp;lt;/security&amp;gt; &lt;/p&gt;  &lt;p&gt;(with corresponding Ws2007HttpBinding named stsBinding with all the relevant configuration), but the binding attribute and the bindingConfiguration attribute were missing.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;It is worth noting here that this problem is by no means BizTalk specific – exactly the same thing (missing configuration) happens when I add a reference to my service from a ny standard .net app. &lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Also worth noting that in my case, and I don’t know how representing this is, this resulted in WCF trying to open the CardSpace card selector when I tried running the process, resulting in an error - “The channel is configured to use interactive initializer 'System.ServiceModel.Security.InfocardInteractiveChannelInitializer', but the channel was Opened without calling DisplayInitializationUI.&amp;#160; Call DisplayInitializationUI before calling Open or other methods on this channel.”&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Easy enough to fix, I thought, as I opened the adapter’s configuration for the send port finding that indeed there are the equivalent fields in the UI (the image shows them AFTER I have typed in the values I needed) - &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_7lqvqdOFqOU/SWxhFdvfi3I/AAAAAAAAAEk/3W1MSYcJTuk/s1600-h/image11.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="393" alt="image" src="http://lh4.ggpht.com/_7lqvqdOFqOU/SWxhGbNuYMI/AAAAAAAAAEo/HiFLM9wF86A/image_thumb7.png?imgmax=800" width="466" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;However, after adding the missing two values and confirming the changes I kept getting the same error; it only took two minutes of head scratching to realise what was going on – opening the send port configuration again showed that the values I’ve carefully typed in have not been persisted, and are now gone again; this must be a bug, which I’ve since confirmed exists in BizTalk 2006 R2 as well;in fact – even the issuer address, which was previously there, was removed from the configuration when trying to apply my additions.&lt;/p&gt;  &lt;p&gt;Luckily importing these settings through a bindings file does work (as was evident from the fact that the issuers address did exist initially), and so I’ve edited my bindings file manually to include the missing settings (as well as the issuer identity setting which I later found out was missing for my scenario) and imported it using the admin console; checking the send port configuration I could now see my values for the “binding” and “bindingConfiguration” properties.&lt;/p&gt;  &lt;p&gt;This raised another question, though – how do I configure this binding? ws2007FederationHttpBinding is somewhat “special” in the sense that there’s effectively an endpoint inside an endpoint: &lt;/p&gt;  &lt;p&gt;Using this binding you have your service’s endpoint and it’s binding configuration; then the message security element of the ws2007FederationHttpBinding has the issuer element which is effectively the endpoint of the STS with the address, the binding and the binding configuration (there is no need for a contract attribute as the contract is known – it is the wsTrust contract); this means that I now need to have another set of binding configuration in my WCF configuration – for the STS – which in my case uses ws2007HttpBinding, but there isn’t a way to add another binding through the send port configuration dialog directly.&lt;/p&gt;  &lt;p&gt;Initially I tried to add the relevant configuration to the BizTalk configuration file (BTSNTSVC.exe.config), but it didn’t work – and I can’t quite explain why yet.; what did work, which is good enough for me for now, was to put that exact same configuration in the machine.config; no idea why, but it works. &lt;/p&gt;  &lt;p&gt;Another options, described in the &lt;a href="http://msdn.microsoft.com/en-us/library/bb226446.aspx" target="_blank"&gt;documentation&lt;/a&gt;&amp;#160; is to use the Import option or the ExplorerOM API.&lt;/p&gt;  &lt;p&gt;And so – once I’ve done that, when I ran my process it called the send port going to my service, but the WCF adpater contacted my custom STS first, retrieved a security token from it, and then called my test service passing this token, which meant the service was allowed to execute.&lt;/p&gt;  &lt;p&gt;I’m impressed!&lt;/p&gt;  &lt;p&gt;There is one, fairly big, inefficiency here now, though – BizTalk does not appear to be caching service proxies, which means it will not cache anywhere the issued token, which in turn means a call to the STS must precede every call to my protected service; not ideal.&lt;/p&gt;  &lt;p&gt;Luckily - one of the WCF samples provided by MS demonstrates how to create a behaviour that would cache such tokens locally; at some point (probably not right now, unfortunately) I will have to see how well this plugs into BizTalk (if at all), but I suspect it’ll work well; find that sample &lt;a href="http://msdn.microsoft.com/en-us/library/aa717045.aspx" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-8945397101989216365?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/posk6e3c7eC-qDgExqtC2geuB3M/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/posk6e3c7eC-qDgExqtC2geuB3M/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/posk6e3c7eC-qDgExqtC2geuB3M/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/posk6e3c7eC-qDgExqtC2geuB3M/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=P2JkXUF0E1Y:9dot9R3WpLA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=P2JkXUF0E1Y:9dot9R3WpLA:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=P2JkXUF0E1Y:9dot9R3WpLA:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=P2JkXUF0E1Y:9dot9R3WpLA:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=P2JkXUF0E1Y:9dot9R3WpLA:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=P2JkXUF0E1Y:9dot9R3WpLA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/P2JkXUF0E1Y" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/8945397101989216365/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=8945397101989216365" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/8945397101989216365" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/8945397101989216365" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/P2JkXUF0E1Y/calling-service-with-federated-identity.html" title="Calling a service with federated identity from BizTalk Server [2009] – Part I" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2009/01/calling-service-with-federated-identity.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-9123451986251301628</id><published>2008-12-29T10:35:00.001Z</published><updated>2008-12-29T10:35:25.072Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk" /><category scheme="http://www.blogger.com/atom/ns#" term="wish-list" /><title type="text">Wish list: optional parameters when using call/start orchestration</title><content type="html">&lt;p&gt;I wasn’t sure how bit problem this was, and in any case thought that optional parameters are a VB thing, but I’ve been proven wrong, and not only because optional parameters are soon to become a c# thing :-)&lt;/p&gt;  &lt;p&gt; When using call/start orchestration we increasingly, as our solution “matures”, find that we need to add optional parameters to our processes.. &lt;/p&gt;  &lt;p&gt; In c# I was trained that function overloading is the correct way to implement this, and although I can see the benefit of the slim optional parameters approach I do think that it is much clearer; we’re talking BizTalk though, and you can’t really overload a function, can you? :-)&lt;/p&gt;  &lt;p&gt; So we [can] do several things -&lt;/p&gt;  &lt;p&gt;When dealing with .net types we can simply break the interface, add the parameter, change all the calling processes to supply one, and – if they don’t actually need to supply a value for this new parameter make them pass one anyway (an empty string, or a 0, or even –1); not elegant to say the least, and quite time consuming which means upsetting both the architect and the project manager.&lt;/p&gt;  &lt;p&gt; Same approach works quite well when dealing with optional messages as well, only that now constructing that unnecessary extra parameter, in the same of a content-less message, is even harder (see my post on &lt;a href="http://www.sabratech.co.uk/blogs/yossidahan/2008/10/fun-with-message-creation-in-biztalk.html" target="_blank"&gt;creating messages from scratch&lt;/a&gt;).&lt;/p&gt;  &lt;p&gt; Another option, valid for .net types only, is to have a &amp;lt;something&amp;gt;Parameters class which would include all the parameters a process takes as properties; this would allow you to add as many properties as you need, without forcing callers to specify them; there are downsides of course – it is less readable and intuitive in my view, there’s a bit more hassle for the caller (create instance of parameters class, assign members) and now it’s harder to force those non-optional parameters (can be done via the parameter class’ constructor)&lt;/p&gt;  &lt;p&gt;But there’s not equivalent option for optional message parameters.&lt;/p&gt;  &lt;p&gt; Last, but not least, there’s the closest thing to overloading – you could always create a second process, with the extended set of parameters and have the original process forward the original call while providing this empty parameter, effectively saving the hassle from the original caller. &lt;/p&gt;  &lt;p&gt;This is really how a function overloading solution would look like only that a process is not a function; it has a lot more impact in term of compile time, configuration required, deployment so the overall maintenance cost of such an approach is quite enormous for any decent sized project. &lt;/p&gt;  &lt;p&gt; So – I can no longer ignore this problem and have to agree – allowing optional parameters with default values, for orchestration is quite important. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;2011? :-)&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-9123451986251301628?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/uATyXlGDYMqe4R_K3a_1CDi3hi0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/uATyXlGDYMqe4R_K3a_1CDi3hi0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/uATyXlGDYMqe4R_K3a_1CDi3hi0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/uATyXlGDYMqe4R_K3a_1CDi3hi0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=xmHgnzjgGA8:G-PnaH8vnbc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=xmHgnzjgGA8:G-PnaH8vnbc:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=xmHgnzjgGA8:G-PnaH8vnbc:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=xmHgnzjgGA8:G-PnaH8vnbc:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=xmHgnzjgGA8:G-PnaH8vnbc:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=xmHgnzjgGA8:G-PnaH8vnbc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/xmHgnzjgGA8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/9123451986251301628/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=9123451986251301628" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/9123451986251301628" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/9123451986251301628" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/xmHgnzjgGA8/wish-list-optional-parameters-when.html" title="Wish list: optional parameters when using call/start orchestration" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2008/12/wish-list-optional-parameters-when.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-743913225115894444</id><published>2008-12-16T14:27:00.001Z</published><updated>2008-12-16T14:27:48.059Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="Federated Identity" /><category scheme="http://www.blogger.com/atom/ns#" term="HTTP" /><category scheme="http://www.blogger.com/atom/ns#" term="Geneva" /><title type="text">Never thought Url would be case sensitive</title><content type="html">&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Working on my Geneva Framework based STS scenario I’ve stumbled into a very weird and annoying case where by if the user typed a Url in the wrong case (compared to the case of the V-Dir) the browser would enter a circular redirect between the STS and the RP. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I’ve started a forum thread, which you can find &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26" target="_blank"&gt;here&lt;/a&gt;, that got an answered by Peter Kron from MS through which I’ve learnt that the path portion of a cookie is case sensitive; you can find this in &lt;a href="http://www.ietf.org/rfc/rfc2965.txt" target="_blank"&gt;this&lt;/a&gt; RFC spec as well (read 3.3.3) - &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;…the old&amp;#160; and new Domain attribute values compare equal, using a case-insensitive string-compare; and, the old and new Path attribute values string-compare equal (case-sensitive). …&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I don’t know if that’s just me, but I find this really surprising as, as a web user, I was never “trained” to tread urls as case sensitive, but it appears that, according to the spec, any personalisation stored for a particular path might be lost if I enter the wrong url? &lt;/p&gt;  &lt;p&gt;In the STS scenario case this would mean potentially me having to login again, although I have already logged in on the STS.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Peter suggest to store the cookie against the domain, which is not case sensitive, and is good enough for me (for now?), but I don’t know if that’s realistic for all scenarios…..&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-743913225115894444?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Rv9RWFsRTXSrNtIcDXcH-6c0JnY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Rv9RWFsRTXSrNtIcDXcH-6c0JnY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Rv9RWFsRTXSrNtIcDXcH-6c0JnY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Rv9RWFsRTXSrNtIcDXcH-6c0JnY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=OqtV4EyJ9GU:iQbcWhC6Vac:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=OqtV4EyJ9GU:iQbcWhC6Vac:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=OqtV4EyJ9GU:iQbcWhC6Vac:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=OqtV4EyJ9GU:iQbcWhC6Vac:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=OqtV4EyJ9GU:iQbcWhC6Vac:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=OqtV4EyJ9GU:iQbcWhC6Vac:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/OqtV4EyJ9GU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/743913225115894444/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=743913225115894444" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/743913225115894444" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/743913225115894444" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/OqtV4EyJ9GU/never-thought-url-would-be-case.html" title="Never thought Url would be case sensitive" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2008/12/never-thought-url-would-be-case.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-3481022124514503748</id><published>2008-12-11T17:47:00.001Z</published><updated>2008-12-11T17:47:49.563Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk" /><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk 2009" /><title type="text">Notes on BizTalk 2009</title><content type="html">&lt;p&gt;earlier this week Microsoft &lt;a href="http://www.microsoft.com/presspass/press/2008/dec08/12-08BizTalkRFIDPR.mspx" target="_blank"&gt;announced&lt;/a&gt; the release of the beta version of BizTalk 2009. &lt;/p&gt;  &lt;p&gt;I’m sure detailed posts of various bits will follow soon, but for now I thought I’d list a few points I’ve picked up (in no particular order)- &lt;/p&gt;  &lt;p&gt;BizTalk projects are now “first class citizens” of Visual Studio [2008]; in practice it seems they are really “special” c# projects. &lt;/p&gt;  &lt;p&gt;This means quite a lot really, to start with, for the most part they look and feel like c# projects (in the beta build the icon for the project is even the c# icon), but this extends to the property pages, existence of assemblyinfo.cs and the project file structure (which is now pretty much standard msbuild file)&lt;/p&gt;  &lt;p&gt;It also means that you could add any c# type to a BizTalk project although in the current build you can’t add a new class using the menu, you are always redirected to the template selector which only shows BizTalk types, so –even if I pick the Add new class option &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_7lqvqdOFqOU/SUFSJb6gTgI/AAAAAAAAADk/KfMA7xogpZ0/s1600-h/image%5B4%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="549" alt="image" src="http://lh6.ggpht.com/_7lqvqdOFqOU/SUFSKMGEPBI/AAAAAAAAADo/a-dohL6Pgq4/image_thumb%5B1%5D.png?imgmax=800" width="424" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I get the following dialog - &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_7lqvqdOFqOU/SUFSKwrVKPI/AAAAAAAAADs/kNexslsHrF0/s1600-h/image%5B8%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="279" alt="image" src="http://lh4.ggpht.com/_7lqvqdOFqOU/SUFSLheEjVI/AAAAAAAAADw/qjSfC5fvZGU/image_thumb%5B3%5D.png?imgmax=800" width="466" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Not sure when this will be fixed, but the workaround is simply (yet annoying) – create the type elsewhere and use the “Add Existing Item” option.&lt;/p&gt;  &lt;p&gt;This will allow you, for example, to include any helper classes you use from your orchestration with the process itself.&lt;/p&gt;  &lt;p&gt;Another point to notice is that this is only true for C# types. you cannot add VB code files to a BizTalk project.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Also – as the project is now a standard msbuild project integration with TFS is tighter.&lt;/p&gt;  &lt;p&gt;interesting to see in the installation process the following entry - &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_7lqvqdOFqOU/SUFSMII-ojI/AAAAAAAAAD0/n1r7gwLU_aE/s1600-h/image3.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="341" alt="image" src="http://lh5.ggpht.com/_7lqvqdOFqOU/SUFSNA93jYI/AAAAAAAAAD4/0QbdeC9v_MA/image_thumb1.png?imgmax=800" width="519" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Basically installing this on a computer that has msbuild allows you to build BizTalk projects without having BizTalk or VisualStudio installed; using a build server for BizTalk is so much easier now!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The build process is completely incremental – each BizTalk artifact is a c# class, and so when building a project only those classes that have changed will be built, which should shorten the time it takes to build a BizTalk project.&lt;/p&gt;  &lt;p&gt;Another fantastic addition is more “HAT” features in the admin console, but as Randal already blogged about this one in details I’ll point you &lt;a href="http://biztalkmessages.vansplunteren.net/2008/12/10/biztalk-2009-and-health-and-activity-tracking-hat/" target="_blank"&gt;there&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Upgrading seems to be a breeze and both 2006 and 2006 R2 are supported. this can be done by opening any existing BizTalk project in VS 2009 and the migration wizard will pick it up and migrate it for you. as expected. &lt;/p&gt;  &lt;p&gt;you can open a solution with multiple projects and they will all be upgraded and you can use devenv /upgrade with both projects and solutions to do that from script?&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;BizTalk 2009 supports debugging maps – this is done by selecting the “Debug Map” from any BTM file context menu -&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_7lqvqdOFqOU/SUFSNuOT4jI/AAAAAAAAAD8/hM6uvp1G9fA/s1600-h/image%5B12%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="426" alt="image" src="http://lh5.ggpht.com/_7lqvqdOFqOU/SUFSOl25gjI/AAAAAAAAAEA/SbOvCVT-aBc/image_thumb%5B5%5D.png?imgmax=800" width="255" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This would use the test input instance and test output instance properties, and would basically open the XSL generated for this map and break at the root template &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_7lqvqdOFqOU/SUFSPLK45-I/AAAAAAAAAEE/523p43G38KQ/s1600-h/image%5B16%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="212" alt="image" src="http://lh5.ggpht.com/_7lqvqdOFqOU/SUFSQwcoEdI/AAAAAAAAAEI/SISuZIdKAuY/image_thumb%5B7%5D.png?imgmax=800" width="414" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Worth noting that currently this does not support maps with multiple inputs or ones using extension objects.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I’m sure there’s a lot more to discover, but I have a 4 day old baby at home – so back to those nappies for me I’m afraid.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-3481022124514503748?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/0YO09mTFid4ESKKrSFzkjPhqkHc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0YO09mTFid4ESKKrSFzkjPhqkHc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/0YO09mTFid4ESKKrSFzkjPhqkHc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0YO09mTFid4ESKKrSFzkjPhqkHc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=5L9tzMvBtSU:hkoXHsVXO4o:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=5L9tzMvBtSU:hkoXHsVXO4o:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=5L9tzMvBtSU:hkoXHsVXO4o:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=5L9tzMvBtSU:hkoXHsVXO4o:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=5L9tzMvBtSU:hkoXHsVXO4o:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=5L9tzMvBtSU:hkoXHsVXO4o:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/5L9tzMvBtSU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/3481022124514503748/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=3481022124514503748" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/3481022124514503748" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/3481022124514503748" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/5L9tzMvBtSU/notes-on-biztalk-2009.html" title="Notes on BizTalk 2009" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2008/12/notes-on-biztalk-2009.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-2664433873197048169</id><published>2008-12-04T09:25:00.001Z</published><updated>2008-12-04T09:25:10.567Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="Federated Identity" /><category scheme="http://www.blogger.com/atom/ns#" term="Geneva" /><title type="text">Geneva-based passive STS and .net 2.0 web applications</title><content type="html">&lt;p&gt;Over the last few weeks I’ve been working on implementing a Geneva Framework based STS that supports both active and passive scenarios. &lt;/p&gt;  &lt;p&gt;This is progressing very well and I already have a fairly solid PoC running for both scenarios. &lt;/p&gt;  &lt;p&gt;Generally, to make any web site participate in the federated identity “dance” all it takes is some configuration on the application’s web.config (separate post coming shortly), but up until today I have only done so for web applications developed as a .net 3.5 project.&lt;/p&gt;  &lt;p&gt;Today I have created a bog standard .net 2.0 web application project (on VS 2008, though, not that it should matter) and applied exactly the same configuration as I did on the other web sites. &lt;/p&gt;  &lt;p&gt;when I ran this, not so surprisingly, everything just worked. isn’t it great?!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Of course – considering that everything is implemented as HttpModules – this should not be very surprising, but still.&lt;/p&gt;  &lt;p&gt;It is important to remember, though, that .net 3.5, as well as the Geneva Framework, must be installed on the machine running the web site for this to work of course.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-2664433873197048169?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/SAhkykA6-RZsbjDGnME6jfmmdoU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SAhkykA6-RZsbjDGnME6jfmmdoU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/SAhkykA6-RZsbjDGnME6jfmmdoU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SAhkykA6-RZsbjDGnME6jfmmdoU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=0q53nw-DGb0:B6AhXW3apd4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=0q53nw-DGb0:B6AhXW3apd4:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=0q53nw-DGb0:B6AhXW3apd4:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=0q53nw-DGb0:B6AhXW3apd4:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=0q53nw-DGb0:B6AhXW3apd4:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=0q53nw-DGb0:B6AhXW3apd4:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/0q53nw-DGb0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/2664433873197048169/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=2664433873197048169" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/2664433873197048169" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/2664433873197048169" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/0q53nw-DGb0/geneva-based-passive-sts-and-net-20-web.html" title="Geneva-based passive STS and .net 2.0 web applications" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2008/12/geneva-based-passive-sts-and-net-20-web.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-7768484191556530363</id><published>2008-12-03T21:07:00.001Z</published><updated>2008-12-03T21:07:14.720Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk" /><category scheme="http://www.blogger.com/atom/ns#" term="schema" /><category scheme="http://www.blogger.com/atom/ns#" term="versioning" /><title type="text">What I hadn’t appreciated about schema versioning in BizTalk Server</title><content type="html">&lt;p&gt;Most people know that when processing a message through the XmlDisassembler, if not explicitly told which schema to use through configuration, the disassembler would try to resolve the correct schema based on the message’s root node and namespace. &lt;/p&gt;  &lt;p&gt;Most would also know, usually through the experience of getting it wrong so many times first, that if more than one assembly contains the same combination of root node and namespace for a schema, the receive pipeline, containing the disassembler, would fail with the error&amp;#160; “Cannot locate document specification because multiple schemas matched the message type “&amp;lt;your message type here&amp;gt;”.”&lt;/p&gt;  &lt;p&gt;What some miss (ehm, ehm) is that this is not true if the two schemas exist in two versions of the same assembly.&lt;/p&gt;  &lt;p&gt;So – if you have an assembly called MySchemas.dll, version 1.0.0.0, …. which contains schema SomeRootNode#SomeNamespace and you have MySchemas2.dll, Version…… which contains schema SomeRootNode#SomeNamespace (same one) – BizTalk would fail.&lt;/p&gt;  &lt;p&gt;If, however, you have the assembly MySchemas.dll, version 1.0.0.0, …. which contains schema SomeRootNode#SomeNamespace and then create MySchemas.dll, version 2.0.0.0, …. which contains schema SomeRootNode#SomeNamespace BizTalk would quite happily ignore the former and use the latest version available.&lt;/p&gt;  &lt;p&gt;Makes perfect sense, of course!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-7768484191556530363?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ht-FdgyuMgLeUIHdZI_T7kLkVHY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ht-FdgyuMgLeUIHdZI_T7kLkVHY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ht-FdgyuMgLeUIHdZI_T7kLkVHY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ht-FdgyuMgLeUIHdZI_T7kLkVHY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=avkt42zJ6Ws:aMEzQbAfqKo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=avkt42zJ6Ws:aMEzQbAfqKo:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=avkt42zJ6Ws:aMEzQbAfqKo:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=avkt42zJ6Ws:aMEzQbAfqKo:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=avkt42zJ6Ws:aMEzQbAfqKo:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=avkt42zJ6Ws:aMEzQbAfqKo:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/avkt42zJ6Ws" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/7768484191556530363/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=7768484191556530363" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/7768484191556530363" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/7768484191556530363" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/avkt42zJ6Ws/what-i-hadnt-appreciated-about-schema.html" title="What I hadn’t appreciated about schema versioning in BizTalk Server" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2008/12/what-i-hadnt-appreciated-about-schema.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-2494776244272113554</id><published>2008-11-29T23:17:00.001Z</published><updated>2008-11-29T23:17:28.638Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="BizTalk" /><category scheme="http://www.blogger.com/atom/ns#" term="SOAP" /><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><title type="text">Calling a service without adding a reference in BizTalk 2006 and BizTalk 2006 R2</title><content type="html">&lt;p&gt;We’ve been experimenting with calling ASMX web services from orchestrations without having to add a web reference (for the SOAP adapter) or use the generated items (for the R2 WCF adapter).&lt;/p&gt;  &lt;p&gt;The idea, in short, is to achieve increased decoupling between systems even in a web service scenario -&lt;/p&gt;  &lt;p&gt;Generally when you add a reference to a service in BizTalk 2006 or in R2 (although there are some clear differences between the implementation) the schemas for the request and response types are generated for you as well as an orchestration which defines message and port types using those schemas.&lt;/p&gt;  &lt;p&gt;When using the SOAP adapter the types generated are somewhat “special” and they encapsulate a little bit of black magic; luckily the WCF adapter which shipped with R2 is much better in the sense that there’s nothing special about any of these artifacts (which also explains why it is now “Add Generated Items” and not “Add Service Reference” – as this is all it’s doing).&lt;/p&gt;  &lt;p&gt;What this means is that if you follow the path that BizTalk leads you through you will get all these artifacts in the same assembly with your orchestration, which means you are now tightly coupled with the web service contract; not the end of the world, but if you want to stay true to the idea behind BizTalk - in which your processes can be masked from changes in the other applications you have to play pretend a little bit.&lt;/p&gt;  &lt;p&gt;We thought that if we had the web service schemas in a separate assembly, and our process only used it’s own representation of the data (which would, ideally, be less than the entire data provided by the, mostly generic, web service) we could then map between the two in the port rather than in the orchestration, which would mean that if the web service changes, all we will need to do (in theory, at least) is re-deploy the assembly with service’s schemas assembly the and the map.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;So – how I went about doing that with the WCF adapter - &lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Following best practice I had an assembly to hold all of “My” schemas – these are the ones describing entities in my domain. &lt;/p&gt;  &lt;p&gt;I then created an orchestration assembly to contain my orchestration, which references the schemas assembly; the orchestration assembly has no other dependencies.&lt;/p&gt;  &lt;p&gt;I then created a third assembly to include all the types for the service - I went through the “Add Generated Items” wizard to get all the artifacts, but I only really used the schemas (and not the message or port types); this assembly, like the schemas assembly, has no dependencies.&lt;/p&gt;  &lt;p&gt;I then progressed to create a fourth assembly to hold the mapping between my schemas and the service’s schemas; naturally this assembly references both projects, but, crucially, it is referenced by no-one.&lt;/p&gt;  &lt;p&gt;So – at the end of this we get the following - &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_7lqvqdOFqOU/STHNcvDwcHI/AAAAAAAAADU/8kVDIbD5HQo/s1600-h/image2.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="244" alt="image" src="http://lh3.ggpht.com/_7lqvqdOFqOU/STHNfVi8c6I/AAAAAAAAADY/yHdPNfEurJ8/image_thumb.png?imgmax=800" width="239" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I then imported the send port bindings generated by the wizard to create the send port; I could have quite happily created it from scratch as there’s nothing special in that port - with the exception of one point, discussed next - so this was really just to save me some time, and added the two maps I’ve created to map the process output format to the service request and the service response to the process input format.&lt;/p&gt;  &lt;p&gt;Goal achieved – the process knows nothing about the service – all is done externally to the process through port configuration.&lt;/p&gt;  &lt;p&gt;But did it work? Almost - running this scenario I received a soap fault from the service complaining about a misunderstood soap action; makes sense I thought – how would BizTalk know which service operation I wanted?&lt;/p&gt;  &lt;p&gt;Well, the WCF adapter has a very nice way to figure out the soap action to use (in my view) – as part of the port configuration there’s a bit of xml that provides mapping between an orchestration send port’s operation name and the required soap action; the setting looks something like this - &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_7lqvqdOFqOU/STHNgYXqK9I/AAAAAAAAADc/IQhlhs_KLrs/s1600-h/image7.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="440" alt="image" src="http://lh6.ggpht.com/_7lqvqdOFqOU/STHNhtCCN1I/AAAAAAAAADg/G5ymu2nFmoM/image_thumb3.png?imgmax=800" width="338" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;In the generated port type the operation name matches the operation name in the service description (“HelloWorld”, in my example), which, in turn, is mapped through this xml to the relevant soap action; as I did not use the generated types the operation name did not match – I simply left it as the default “Operation_1” (naturally…); that meant that when the request came the adapter failed to find a matching operation.&lt;/p&gt;  &lt;p&gt;Somewhat annoyingly, what the adapter does when it can’t resolve the name is to assume that the entire setting should be used as the soap action and so the entire xml was written to the header;&amp;#160; this behaviour is there to allow one to specify a fixed header to use, but I think the experience could be a bit better there – they could have had two different settings, or at least realise that if I’ve put a BtsActionMapping xml in there I do not intend for it to be used as the header itself(!), and so, if the relevant entry was not found the request should be suspended rather than going out incorrectly to the service; never-the-less the operation could not be resolved, of course, and the service returned a soap fault.&lt;/p&gt;  &lt;p&gt;Fixing the issue was easy and simply meant adding the correct entry in the xml and running the scenario again, this time it completed successfully.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;How does that differ using the SOAP adapter?&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Using the SOAP adapter the approach was naturally very similar; pretty much the same assemblies, pretty much the same artifacts; there are three key differences though -&lt;/p&gt;  &lt;p&gt;For starters the soap adapter requires a proxy; in most scenarios you’re using a web port type which provides the adapter with a proxy and so in most cases you don’t have to worry about this at all; I can imagine that some are probably not even aware but the send port, using the SOAP adapter, will have the web service proxy set in the “Web Service” tab of the adapter configuration to “Orchestration Web Port”. &lt;/p&gt;  &lt;p&gt;Alternatively you can provide a custom proxy class, which is a topic by itself (and you can check it out in Richard Seroter’s post on the topic &lt;a href="http://seroter.wordpress.com/2007/04/02/consuming-web-services-in-biztalk-without-web-reference/" target="_blank"&gt;here&lt;/a&gt;), but in most standard cases this is not required. &lt;/p&gt;  &lt;p&gt;As I’m not following the “standard” approach I had to create a custom proxy for my send port; I did this by using WSDL.exe and configuring the proxy class in the send port as described in Richard’s post.&lt;/p&gt;  &lt;p&gt;In my case, however, unlike Richard’s, I did not wish to pre-defined the method called in the send port; luckily – the configuration allows you to set it to “Specify Later”, which means the method name will be provided per request through the message context (using the SOAP.MethodName property).&lt;/p&gt;  &lt;p&gt;Taking the “Specify Later” approach means I don’t have to have a send port per method, which is good of course, but pay attention to my note regarding number of ports in the summary below.&lt;/p&gt;  &lt;p&gt;Now that I have the send port and proxy configuration sorted I needed to get the web service’s schemas; I could do that by using XSD.exe and add the output to my service types assembly.&lt;/p&gt;  &lt;p&gt;Last thing – when using the soap adapter you don’t generally need to have an XmlDisassembler in the pipeline; however – if you want BizTalk to be able to run a map it needs a “proper” message type in the context, not that awkward one the SOAP adapter puts, and so the XmlDisassembler becomes mandatory in this scenario. &lt;/p&gt;  &lt;p&gt;other than that everything else is pretty much the same.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;So – to summarise – &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Calling a service from a process, without the process knowing ANYTHING about the service implementation is very easy, the story is slightly better in the WCF adapter case in my view, but both seem to me quite reasonable.&lt;/p&gt;  &lt;p&gt;The only downside to this approach that I could think of so far, is that you are likely to end up with as many send ports as you have response output formats - &lt;/p&gt;  &lt;p&gt;As far as requests from the orchestrations to the web service are concerned BizTalk will quite happily pick up the right map from a list of configured maps based on the input; so - if process A has one output format and Process B has a different output format and they both share the same send port – BizTalk will pick up the relevant map to convert either outputs to the service’s request.&lt;/p&gt;  &lt;p&gt;On the way back, however, the incoming message (the service’s response) always looks the same, and so BizTalk will have no way of knowing which map to pick from the list.&lt;/p&gt;  &lt;p&gt;That means that multiple send ports will have to be created for such cases so that there’s only one map for the service’s response; a large number of those may have some impact on the overall performance of the server group as the number of subscriptions that need to be evaluated increases; what “large” means in this context and how big is the impact is not something I could say easily, so I’d suggest doing some benchmarking to find out in your environment if you are concerned.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-2494776244272113554?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/tfmMOzLsqbpso9hTQ2iBwjUIvZY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tfmMOzLsqbpso9hTQ2iBwjUIvZY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/tfmMOzLsqbpso9hTQ2iBwjUIvZY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tfmMOzLsqbpso9hTQ2iBwjUIvZY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=rj7am0YGZFc:VD2nzTXF5Lc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=rj7am0YGZFc:VD2nzTXF5Lc:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=rj7am0YGZFc:VD2nzTXF5Lc:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=rj7am0YGZFc:VD2nzTXF5Lc:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=rj7am0YGZFc:VD2nzTXF5Lc:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=rj7am0YGZFc:VD2nzTXF5Lc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/rj7am0YGZFc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/2494776244272113554/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=2494776244272113554" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/2494776244272113554" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/2494776244272113554" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/rj7am0YGZFc/calling-service-without-adding.html" title="Calling a service without adding a reference in BizTalk 2006 and BizTalk 2006 R2" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2008/11/calling-service-without-adding.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-7656544342331599794</id><published>2008-11-25T10:16:00.001Z</published><updated>2008-11-25T10:16:42.844Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="Federated Identity" /><category scheme="http://www.blogger.com/atom/ns#" term="Geneva" /><title type="text">Configuring the Geneva Framework based STS to work with custom UserNamePasswordValidator</title><content type="html">&lt;p&gt;It took me a little while (and quite a bit of help from others on this &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/ddd45b84-f0d4-48b2-9ce0-1042bea06193"&gt;thread&lt;/a&gt;) to get to a relatively simple implementation, so I thought I’d summarise the steps I’ve taken – &lt;/p&gt;  &lt;p&gt;At the risk of sounding the obvious I would definitely recommend making sure the overall STS scenario works well using windows authentication before changing it to support custom authentication.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Once that’s done change the STS’ bindings’ clientCredentialType to UserName and the establishSecurityContext to false.&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;ws2007HttpBinding&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;binding name=&amp;quot;UserNameAuthentication&amp;quot;&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;security mode=&amp;quot;Message&amp;quot;&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;message establishSecurityContext=&amp;quot;false&amp;quot; clientCredentialType=&amp;quot;UserName&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/security&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/binding&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/ws2007HttpBinding&amp;gt;&lt;/p&gt;  &lt;p&gt;The equivalent changes need to be made on the clinet’s binding going to the STS. these may not be obvious at first glance – on the client you will have the endpoint representing the RP and using ws2007FederationHttpBinding; inside this binding’s configuration you will find the issuer element, which is somewhat similar to an endpoint; this represents the STS’ endpoint and as such has a binding (ws2007HttpBinding) and a binding configuration; it is in that binding’s configuration that you need to change the credential type. setting it on the wrong bindings, as I did initially would send you back a couple of hours :-)&lt;/p&gt;  &lt;p&gt;Next, as we’re using username authentication for the STS, a service certificate must be used so that the credentials can be encrypted. This is done through configuration of a service behaviour on the STS service as such: &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;behaviors&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;serviceBehaviors&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;behavior name=&amp;quot;STSBehaviour&amp;quot;&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;serviceCredentials&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;serviceCertificate findValue=&amp;quot;STS&amp;quot; storeLocation=&amp;quot;LocalMachine&amp;quot; storeName=&amp;quot;My&amp;quot; x509FindType=&amp;quot;FindBySubjectName&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/serviceCredentials&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;serviceMetadata httpGetEnabled=&amp;quot;true&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;serviceDebug includeExceptionDetailInFaults=&amp;quot;true&amp;quot;/&amp;gt; &amp;lt;!—use for debug only --&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/behavior&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/serviceBehaviors&amp;gt;&lt;/p&gt;  &lt;p&gt;(don’t forget to wire the behaviour to the service...)&lt;/p&gt;  &lt;p&gt;As the test certificate I’m using are not valid, I needed to disable validation on the client side; I could not find a way to do this through configuration, as at the client there isn’t an endpoint as such for the STS service, just the issuer element in the ws2007FederationHttpBinding, so I’ve done this in the client code (this is a temporary measure for development only!) – &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; proxy.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; proxy.ClientCredentials.ServiceCertificate.Authentication.RevocationMode = X509RevocationMode.NoCheck;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The current version of the Geneva Framework, unlike Zermatt before it, does not support the userNameAuthentication element in the serviceCredetial service behaviour. (to be accurate you can kind of force it to do so, but that’s planned to be blocked in the near future, so for all intents and purposes you should not include this element, see more information in the thread mentioned above)&lt;/p&gt;  &lt;p&gt;In order to implement authentication a customer SecurityTokenHandler needs to be added; to do so created a class that inherits from WindowsUserNameSecurityTokenHandler and overridden the ValidateToken method; again – several samples of such implementation exist on the thread but the idea is to validate the username and password (made available through the SecurityToken parameter to the method) in whatever way you wish and then, ideally, add some claims to the ClaimsIdentityCollection output; this should generally include the identity, authentication method and authentication instant, but you can add whatever you wish.&lt;/p&gt;  &lt;p&gt;To wire the custom handler to the STS service a bit more configuration is required on the STS side - &lt;/p&gt;  &lt;p&gt;&amp;#160; &amp;lt;microsoft.identityModel&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;securityTokenHandlers&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;remove type=&amp;quot;Microsoft.IdentityModel.Tokens.WindowsUserNameSecurityTokenHandler, Microsoft.IdentityModel,Version=0.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add type=&amp;quot;MyUserNameSecurityTokenHandler, MyUserNameSecurityTokenHandlerAsembly&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/securityTokenHandlers&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160; &amp;lt;/microsoft.identityModel&amp;gt;&lt;/p&gt;  &lt;p&gt;This replaces the built-in WindowsUserNameSecurityTokenHandelr with my class that inherits from WindowsUserNameSecurityTokenHandler and adds custom implementation.&lt;/p&gt;  &lt;p&gt;Note: I needed to add the definition of this section as such – &lt;/p&gt;  &lt;p&gt;&amp;lt;section name=&amp;quot;microsoft.identityModel&amp;quot; type=&amp;quot;Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection, Microsoft.IdentityModel,Version=0.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;I hope that makes sense….&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-7656544342331599794?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/HIFxdK4bKybIg2af1rY8F1sMbjc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HIFxdK4bKybIg2af1rY8F1sMbjc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/HIFxdK4bKybIg2af1rY8F1sMbjc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HIFxdK4bKybIg2af1rY8F1sMbjc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=EsFWOgivW2E:iPDjPHpIqAE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=EsFWOgivW2E:iPDjPHpIqAE:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=EsFWOgivW2E:iPDjPHpIqAE:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=EsFWOgivW2E:iPDjPHpIqAE:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=EsFWOgivW2E:iPDjPHpIqAE:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=EsFWOgivW2E:iPDjPHpIqAE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/EsFWOgivW2E" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/7656544342331599794/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=7656544342331599794" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/7656544342331599794" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/7656544342331599794" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/EsFWOgivW2E/configuring-geneva-framework-based-sts.html" title="Configuring the Geneva Framework based STS to work with custom UserNamePasswordValidator" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2008/11/configuring-geneva-framework-based-sts.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-14758839.post-8971654086812199162</id><published>2008-11-06T09:58:00.001Z</published><updated>2008-11-06T09:58:21.529Z</updated><category scheme="http://www.blogger.com/atom/ns#" term="Federated Identity" /><category scheme="http://www.blogger.com/atom/ns#" term="Geneva" /><title type="text">From "Zermatt" to the "Geneva Framework" part II</title><content type="html">&lt;p&gt;A couple of days ago I've posted about the changes I've had to make to allow my custom STS to work with the updated Geneva framework. there's one more, quite crucial, change that I had to make, which I will try to describe next - &lt;/p&gt;  &lt;p&gt;If my understanding is correct (and unfortunately there's all the chances in the world that it is not, so if you know otherwise please do comment) the October Geneva SDK has tightened security a little bit around token validation.&lt;/p&gt;  &lt;p&gt;I believe that the previous version of SDK, the RP simply made sure that a token was included with the request, and that this token was signed by a party whose certificate exists on the server (and is accessible); the RP did not check which certificate was used to sign the token.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;As far as I can tell the Geneva Framework SDK now behaves differently - if you execute the same code and configuration you had before (baring necessary changes to allow the code to compile on the new version, but these are mostly name changes) you will get the following error from the RP: &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;quot;An unsecured or incorrectly secured fault was received from the other party. See    &lt;br /&gt;the inner FaultException for the fault code and detail.&amp;quot;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Basically the Client gets a token from the STS and attaches it to the request but the RP does not recognise the issuer of the token; in order to instruct the RP to accept tokens signed by a particular STS you need to provide it with a list of issuers you accetps, this can be done using the following configuration for example - &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;lt;microsoft.identityModel&amp;gt;    &lt;br /&gt;&amp;#160; &amp;lt;issuerNameRegistry type=&amp;quot;Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=0.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&amp;quot;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;trustedIssuers&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add name=&amp;quot;STS&amp;quot; thumbprint=&amp;quot;7a0671d475673c1ab131ca1c0c804e4fbd385140&amp;quot;/&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/trustedIssuers&amp;gt;     &lt;br /&gt;&amp;#160; &amp;lt;/issuerNameRegistry&amp;gt;     &lt;br /&gt;&amp;lt;/microsoft.identityModel&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This bit of configuration lists all the certificates that are acceptable as STS token signing.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;It is interesting to note that this model is completely extensible - you can define your own registry IssuerNameRegistry type that would look and behave differently if you have other means of listing those; the same can also be done via code, which is the example provided with the SDK - you define a custom IssuerNameRegistryClass - &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;namespace ClaimsAwareWebService    &lt;br /&gt;{     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public class TrustedIssuerNameRegistry : IssuerNameRegistry     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;summary&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ///&amp;#160; Returns the issuer Name from the security token.     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;/summary&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;param name=&amp;quot;securityToken&amp;quot;&amp;gt;The security token that contains the STS's certificates.&amp;lt;/param&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;returns&amp;gt;The name of the issuer who signed the security token.&amp;lt;/returns&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public override string GetIssuerName( SecurityToken securityToken )     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; X509SecurityToken x509Token = securityToken as X509SecurityToken;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if ( x509Token != null )     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //Note: This piece of code is for illustrative purposes only. Validating certificates based on     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //subject name is not a good practice.&amp;#160; This code should not be used as is in production.     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if ( String.Equals( x509Token.Certificate.SubjectName.Name, &amp;quot;CN=STS&amp;quot; ) )     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return x509Token.Certificate.SubjectName.Name;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; throw new SecurityTokenException( &amp;quot;Untrusted issuer.&amp;quot; );    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }     &lt;br /&gt;}&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;and then when configuring the host for the RP service you provide this as a parameter - &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;FederatedServiceCredentials.ConfigureServiceHost(host, new TrustedIssuerNameRegistry());&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;And while I'm on the subject - as this has sent me going in circles - it appears that the framework is not happy with claim-less tokens, so if you're dumb enough (as I was) and end up not adding any claims (I was adding them base on the requested claims in the incoming request, which, at some point, was empty in my configuration) you will get a&amp;#160; error, which, after setting the ServiceDebugBehavior would read &amp;quot;A SamlAssertion requires at least one statement.&amp;#160; Ensure that you have added at least one SamlStatement to the SamlAssertion you are creating.&amp;quot;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I can't decide about this one - does it not make sense to have a scenario in which you just want to get a signed token to indicate that an STS has authenticated the caller, but don't actually need any claims? not that it's a problem to find at least one claim to add (identity, authentication method are two easy examples), but speaking in principal I'm not yet convinced not having any specific claim should be an error.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14758839-8971654086812199162?l=www.sabratech.co.uk%2Fblogs%2Fyossidahan%2Fdefault.html'/&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/L-kODgZkg8oOnQODgzxJS0F6sfQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/L-kODgZkg8oOnQODgzxJS0F6sfQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/L-kODgZkg8oOnQODgzxJS0F6sfQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/L-kODgZkg8oOnQODgzxJS0F6sfQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=cTA-mkcwjw0:hLFGyDO3S1Q:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=cTA-mkcwjw0:hLFGyDO3S1Q:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=cTA-mkcwjw0:hLFGyDO3S1Q:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=cTA-mkcwjw0:hLFGyDO3S1Q:aKCwKftKxY0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?i=cTA-mkcwjw0:hLFGyDO3S1Q:aKCwKftKxY0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/YossiDahan?a=cTA-mkcwjw0:hLFGyDO3S1Q:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/YossiDahan?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/YossiDahan/~4/cTA-mkcwjw0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/8971654086812199162/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=14758839&amp;postID=8971654086812199162" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/8971654086812199162" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/14758839/posts/default/8971654086812199162" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/YossiDahan/~3/cTA-mkcwjw0/from-to-framework-part-ii.html" title="From &amp;quot;Zermatt&amp;quot; to the &amp;quot;Geneva Framework&amp;quot; part II" /><author><name>Yossi Dahan</name><uri>http://www.blogger.com/profile/00273796629458942657</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="07544759923814532277" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.sabratech.co.uk/blogs/yossidahan/2008/11/from-to-framework-part-ii.html</feedburner:origLink></entry></feed>
