<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.pluralsight.com/community/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Understand()</title><subtitle type="html" /><id>http://www.pluralsight.com/community/blogs/mvernal/atom.aspx</id><link rel="alternate" type="text/html" href="http://www.pluralsight.com/community/blogs/mvernal/default.aspx" /><link rel="self" type="application/atom+xml" href="http://www.pluralsight.com/community/blogs/mvernal/atom.aspx" /><generator uri="http://communityserver.org" version="4.0.30619.63">Community Server</generator><updated>2006-01-30T22:20:00Z</updated><entry><title>A Philosophical Argument for P != NP</title><link rel="alternate" type="text/html" href="/community/blogs/mvernal/archive/2006/10/31/41522.aspx" /><id>/community/blogs/mvernal/archive/2006/10/31/41522.aspx</id><published>2006-10-31T17:46:00Z</published><updated>2006-10-31T17:46:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;David Levin sent me a link to a &lt;/FONT&gt;&lt;A href="http://www.scottaaronson.com/blog/2006/09/reasons-to-believe.html"&gt;&lt;FONT face=Verdana size=2&gt;great blog post&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; that talked about the question of whether P == NP.&amp;nbsp; From the post:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;More often than I can remember, I've been asked some form of the following question: "If you computer scientists can't prove P=NP or P!=NP, then why aren't we justified in believing whichever one we want? And why is the 'consensus' that P!=NP anything more than a shared prejudice -- something you repeat to each other so your work won't seem irrelevant?"&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;The author then goes to offer 10 arguments for why it's overwhelmingly likely that P != NP.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;I found &lt;STRONG&gt;the Philosophy Argument &lt;/STRONG&gt;(#9) to be truly beautiful:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;If P=NP, then the world would be a profoundly different place than we usually assume it to be. There would be no special value in "creative leaps," no fundamental gap between solving a problem and recognizing the solution once it's found. Everyone who could appreciate a symphony would be Mozart; everyone who could follow a step-by-step argument would be Gauss; everyone who could recognize a good investment strategy would be Warren Buffett. It's possible to put the point in Darwinian terms: if this is the sort of universe we inhabited, why wouldn't we already have evolved to take advantage of it? (Indeed, this is an argument not only for P != NP, but for NP-complete problems &lt;/FONT&gt;&lt;/FONT&gt;&lt;A href="http://www.scottaaronson.com/papers/npcomplete.pdf"&gt;&lt;FONT face=Verdana color=#5588aa size=2&gt;not being efficiently solvable in the physical world&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;.)&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Verdana size=2&gt;It's beautiful for many reasons.&amp;nbsp; First, the analogy itself is beautiful.&amp;nbsp; Second, it's self-referential -- after reading it, I was struck by its elegance and surprised that I had never seen it in that way.&amp;nbsp; But, of course, that's the point -- it's very hard to formulate such an analogy, but it is&amp;nbsp;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;comparatively &lt;/SPAN&gt;easy to appreciate it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Verdana size=2&gt;Very nice indeed.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.pluralsight.com/community/aggbug.aspx?PostID=41522" width="1" height="1"&gt;</content><author><name>mike-vernal</name><uri>http://www.pluralsight.com/community/members/mike_2D00_vernal/default.aspx</uri></author><category term="Random" scheme="http://www.pluralsight.com/community/blogs/mvernal/archive/tags/Random/default.aspx" /></entry><entry><title>Facebook Redesign &amp;amp; New Job</title><link rel="alternate" type="text/html" href="/community/blogs/mvernal/archive/2006/09/06/37315.aspx" /><id>/community/blogs/mvernal/archive/2006/09/06/37315.aspx</id><published>2006-09-06T15:42:00Z</published><updated>2006-09-06T15:42:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Yesterday, the &lt;A href="http://facebook.com"&gt;Facebook&lt;/A&gt; launched a redesign of their site that included two new features -- News Feeds and Mini Feeds.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;In short, I thought the features were absolutely brilliant.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Ever since I graduated college (2002), I've basically had one overarching goal&amp;nbsp;around computers and technology -- figuring out ways to help people maintain and grow interpersonal relationships.&amp;nbsp; The impetus is fairly obvious -- at college, I was surrounded by some of the most amazing, kindest, and most brilliant folks in the world, and I wanted to make sure that I didn't lose that once I left.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Every so often at Microsoft, a group of folks are asked to come together as a group and pitch an idea to execs.&amp;nbsp; About three years ago (and again two years ago),&amp;nbsp;I gave basically the same pitch -- I had a friend in college (Al Cho) who was basically the nicest person I've ever met.&amp;nbsp; Once we graduated, I largely lost contact with him.&amp;nbsp; I'd get periodic snapshots of where he was (studying at Oxford, working at the U.N., etc.), but I'd lost a recurring touch.&amp;nbsp; I wanted an&amp;nbsp;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;app that helped me keep&amp;nbsp;track of all my friends in one place.&amp;nbsp; It would have blogging, photo sharing, friend-of-friend, events, mobile phone integration, maps integration (e.g., see all friends in&amp;nbsp;a certain area if you're traveling ...), etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;A href="http://friendster.com"&gt;Friendster&lt;/A&gt; had some of that a few years ago, but it was painfully slow, etc.&amp;nbsp; And then Friendster slowly atrophied.&amp;nbsp; I think people just stopped having a reason to come back once it lost its novelty.&amp;nbsp; But that's because Friendster missed the ball -- it's about your friends' lives, stupid.&amp;nbsp; It's about keeping in touch and seeing what's changing.&amp;nbsp; They didn't really optimize for that (they felt like they were primarily about search at first).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;About two months ago, I was chatting with Nick Murphy and I observed that the real killer feature for MySpace or Facebook would be a personal RSS feed that was a changelist for all your friends.&amp;nbsp; Ultimately, you could track what's going on with your friends in Safari, in Outlook, on your phone, etc.&amp;nbsp; It would be brilliant.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Then, this week, Facebook added essentially that feature.&amp;nbsp; IMHO, I mean, Facebook has got a lot of stuff going for them.&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;Elegant interface.&amp;nbsp; Photo sharing and tagging is really quite nice.&amp;nbsp; Blogging / notes is a little weak, but ok.&amp;nbsp; They have a developer platform (brilliant -- kudos Fetterman).&amp;nbsp; And now they have a feed that helps you keep track of your friends and what they're doing.&amp;nbsp; (They still need to make it RSS, though.)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;All-in-all, I think it's great.&amp;nbsp; Kudos.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;FONT&gt;&lt;FONT size=2&gt;(Of course, it's funny -- there also seems to be a huge backlash against the new site and the new features.&amp;nbsp; I was a little surprised.&amp;nbsp; Presumably if they just change the defaults to only publish certain things by default (new photos, new notes, new walls) and not other things (relationship status, etc.), people will be ok.)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;FONT&gt;&lt;FONT size=2&gt;On an unrelated note, I haven't blogged about Indigo (er, the Windows Communication Foundation) in a while.&amp;nbsp; That's due, in part, to the fact that I've moved from being a producer to being a consumer of WCF.&amp;nbsp; I've moved from being a PM on the WCF team to being a developer on the some of the backend infrastructure for &lt;A href="http://live.com"&gt;Windows Live&lt;/A&gt;.&amp;nbsp; My infrequent blog posts will probably slowly migrate from stuff like WS-Addressing to Amazon and Google.&amp;nbsp; We'll see.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.pluralsight.com/community/aggbug.aspx?PostID=37315" width="1" height="1"&gt;</content><author><name>mike-vernal</name><uri>http://www.pluralsight.com/community/members/mike_2D00_vernal/default.aspx</uri></author><category term="Random" scheme="http://www.pluralsight.com/community/blogs/mvernal/archive/tags/Random/default.aspx" /></entry><entry><title>Ed Helms Takes On Microsoft</title><link rel="alternate" type="text/html" href="/community/blogs/mvernal/archive/2006/06/29/29182.aspx" /><id>/community/blogs/mvernal/archive/2006/06/29/29182.aspx</id><published>2006-06-29T23:32:00Z</published><updated>2006-06-29T23:32:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Ed Helms (from the Daily Show) did a video for Microsoft College Recruiting.&amp;nbsp; It's fan-freaking-tastic.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;The "free soda" person is the awesome Julie Farago.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;A href="http://www.microsoft.com/College/default.mspx"&gt;&lt;FONT color=#800080&gt;http://www.microsoft.com/College/default.mspx&lt;/FONT&gt;&lt;/A&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;o:p&gt;Fantastic.&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.pluralsight.com/community/aggbug.aspx?PostID=29182" width="1" height="1"&gt;</content><author><name>mike-vernal</name><uri>http://www.pluralsight.com/community/members/mike_2D00_vernal/default.aspx</uri></author><category term="Random" scheme="http://www.pluralsight.com/community/blogs/mvernal/archive/tags/Random/default.aspx" /></entry><entry><title>John Battelle Interviews Gary Flake</title><link rel="alternate" type="text/html" href="/community/blogs/mvernal/archive/2006/04/29/22882.aspx" /><id>/community/blogs/mvernal/archive/2006/04/29/22882.aspx</id><published>2006-04-29T18:27:00Z</published><updated>2006-04-29T18:27:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;John Battelle has a good interview with Gary Flake, a&amp;nbsp;Technical Fellow&amp;nbsp;over in MSN: &lt;/FONT&gt;&lt;A href="http://battellemedia.com/archives/002471.php"&gt;&lt;FONT face=Verdana size=2&gt;http://battellemedia.com/archives/002471.php&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;It reminded me of a relatively recent conversation I had with some other folks that joined the company within the past 5 years.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Basically, a few of us were sitting around a table, swapping stories about how we came to the company.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Some folks talked about knowing that they wanted to come at Microsoft. They'd waited on line for Windows 95 and they'd knocked on Microsoft's doors come recruiting time.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;My experience was pretty different. I grew up as a dedicated Mac user (which still holds true today). I came from a college environment that was violently anti-Microsoft and pro-BSD and pro-Linux. When I was first contemplating coming to Microsoft in my senior year, I had a lot of angst about going to the "evil empire."&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;That said, the reason I came (and the reason I stay) is because of the people. I think Gary pretty much nailed it:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Let's talk about people as a preface to culture, because I want to get the "evil" thing out of the way. I know the reputation that MS has with some communities. I was hacking Linux in the early nineties, I have a four digit Slashdot userid, and I've personally written over 100,000 lines of open source code. I say all of this to qualify my opinion. &lt;STRONG&gt;Being new to MS, the biggest surprise for me was the people&lt;/STRONG&gt;. I knew they were smart. I knew they were driven. I knew they were competitive. But I had no idea they would also collectively tend towards kindness, openness, self-criticism, passion, righteousness, and even uncertainty. These are great people -- from the executive team down to the rank and file -- these are simply wonderful people in every way.&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Amen.&amp;nbsp; Another quote which rings true:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;FONT face=Verdana size=2&gt;Okay, now I know I am sounding like a corporate drone and I am well aware that for every example above, there are plenty of people in the valley that will bitch about my characterization. When you assume evil, then an ecosystem looks less than well-intentioned. When you assume goodness, then an ecosystem looks like benevolence. The truth is more complex and vastly more interesting. &lt;/FONT&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;I'm always a little amused when a random act of stupidity by some random Product Manager in some random product is taken as Microsoft corporate policy. As it turns out, if you go in looking for evil, it's usually pretty easy to find it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Anyway -- a good interview.&amp;nbsp;Kudos to Gary for his openness and honesty (both good and bad).&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.pluralsight.com/community/aggbug.aspx?PostID=22882" width="1" height="1"&gt;</content><author><name>mike-vernal</name><uri>http://www.pluralsight.com/community/members/mike_2D00_vernal/default.aspx</uri></author><category term="Random" scheme="http://www.pluralsight.com/community/blogs/mvernal/archive/tags/Random/default.aspx" /></entry><entry><title>Area Codes</title><link rel="alternate" type="text/html" href="/community/blogs/mvernal/archive/2006/04/22/22387.aspx" /><id>/community/blogs/mvernal/archive/2006/04/22/22387.aspx</id><published>2006-04-22T23:40:00Z</published><updated>2006-04-22T23:40:00Z</updated><content type="html">&lt;p&gt;At some point I heard an interesting piece of trivia about the initial assignment of area codes.  With rotary phones, the time it takes to dial a digit is actually a function of the digit itself (dialing a 2 takes twice as much time as dialing a 1, dialing a 0 takes 10 times as long as dialing a 1, etc.).&lt;/p&gt;

&lt;p&gt;Keeping this in mind, the people who initially laid out the area codes allocated them as a function of population or importance.&lt;/p&gt;

&lt;p&gt;Intrigued, I munged a web page to give me an ordering of all the area codes based on number of pulses (i.e., sum of digits counting 0 as 10).&lt;/p&gt;

&lt;p&gt;The top few are as follows:&lt;/p&gt;

&lt;pre&gt;
5 - 212 NY New York (New York City Manhattan area, overlays with 646 and 917)
6 - 213 CA California (Downtown Los Angeles area only)
6 - 231 MI Michigan (Traverse City, Ludington, Muskegon, Petoskey and northwestern Michigan)
6 - 312 IL Illinois (downtown central Chicago area)
6 - 321 FL Florida (Orlando, Cocoa Beach, St Cloud and central eastern Florida, overlays with 407)
7 - 214 TX Texas (Dallas area, overlays with 469 and 972)
7 - 313 MI Michigan (Dearborn, Detroit and inner Detroit suburbs)
7 - 412 PA Pennsylvania (Pittsburgh area, McKeesport, Braddock, Duquesne, overlays with 878)
8 - 215 PA Pennsylvania (Philadelphia area, overlays with 267 and 445)
8 - 224 IL Illinois (Waukegan, Des Plaines, northwest Chicago suburbs and northeastern Illinois, overlays with 847)
8 - 251 AL Alabama (Mobile, Jackson and southwestern Alabama)
8 - 314 MO Missouri (St Louis, Florissant, Crestwood, Affton and surrounding suburbs)
8 - 323 CA California (Florence and Los Angeles excluding downtown Los Angeles)
8 - 413 MA Massachusetts (Pittsfield, Springfield, Holyoke, Greenfield and western Massachusetts)
8 - 512 TX Texas (Austin, Lampasas, Bastrop, Milam and central Texas)
&lt;/pre&gt;

&lt;p&gt;The bottom few are:&lt;/p&gt;

&lt;pre&gt;
27 - 908 NJ New Jersey (Washington, Elizabeth, Warren, Plainfield and west central New Jersey)
27 - 980 NC North Carolina (Charlotte, Kingstown and south central North Carolina, overlays with 704)
28 - 909 CA California (San Bernardino, Ontario, Pomona, Chino, Arrowhead and Big Bear Lake areas)
&lt;/pre&gt;

&lt;p&gt;I'm guessing they came along later, but it is fun to think of Elizabeth, NJ as, basically, the least interesting place in the US.&lt;/p&gt;

&lt;p&gt;Random.  Anyway.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.pluralsight.com/community/aggbug.aspx?PostID=22387" width="1" height="1"&gt;</content><author><name>mike-vernal</name><uri>http://www.pluralsight.com/community/members/mike_2D00_vernal/default.aspx</uri></author><category term="Random" scheme="http://www.pluralsight.com/community/blogs/mvernal/archive/tags/Random/default.aspx" /></entry><entry><title>Kudos to Steve Maine &amp;amp; the Atlas Folks</title><link rel="alternate" type="text/html" href="/community/blogs/mvernal/archive/2006/03/21/20420.aspx" /><id>/community/blogs/mvernal/archive/2006/03/21/20420.aspx</id><published>2006-03-21T12:38:00Z</published><updated>2006-03-21T12:38:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Kudos to Steve, who just shipped some of the stuff he's been working on: &lt;/FONT&gt;&lt;A href="http://hyperthink.net/blog/2006/03/20/atlas++Indigo++Crazy++Delicious.aspx"&gt;&lt;FONT face=Verdana size=2&gt;http://hyperthink.net/blog/2006/03/20/atlas++Indigo++Crazy++Delicious.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;He's been working on WCF's REST and POX support, specifically the stuff we need to do to have a pretty seamless experience with Atlas.&amp;nbsp; It is, as Steve puts it, crazy delicous.&amp;nbsp; Cool stuff.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.pluralsight.com/community/aggbug.aspx?PostID=20420" width="1" height="1"&gt;</content><author><name>mike-vernal</name><uri>http://www.pluralsight.com/community/members/mike_2D00_vernal/default.aspx</uri></author><category term="WCF" scheme="http://www.pluralsight.com/community/blogs/mvernal/archive/tags/WCF/default.aspx" /></entry><entry><title>WS-Policy &amp;amp; WS-PolicyAttachment Are Published!</title><link rel="alternate" type="text/html" href="/community/blogs/mvernal/archive/2006/03/09/19885.aspx" /><id>/community/blogs/mvernal/archive/2006/03/09/19885.aspx</id><published>2006-03-09T16:53:00Z</published><updated>2006-03-09T16:53:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;We have just re-published WS-Policy and WS-PolicyAttachment (with co-authors IBM, BEA, SAP, Sonic Software, and VeriSign).&amp;nbsp; Congrats to Dan Roth, Jeff Schlimmer, Asir, and everyone else who was involved.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;It looks like the spec locations are:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class=MsoNormal&gt;&lt;B&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;WS-Policy&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;A title=http://specs.xmlsoap.org/ws/2004/09/policy/ href="http://specs.xmlsoap.org/ws/2004/09/policy/"&gt;Web Services Policy Framework (WS-Policy) version 1.2&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;WS-Policy defines a base set of constructs that can be used and extended by other Web services specifications to describe a broad range of service requirements, preferences, and capabilities.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;B&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;WS-PolicyAttachment&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;A title=http://specs.xmlsoap.org/ws/2004/09/policy/ href="http://specs.xmlsoap.org/ws/2004/09/policy/"&gt;Web Services Policy Attachment (WS-PolicyAttachment) version 1.2&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face="Courier New" size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;WS-PolicyAttachment specifies three specific attachment mechanisms for using policy expressions with existing XML Web service technologies. Specifically, we define how to associate policy expressions with WSDL type definitions and UDDI entities. We also define how to associate implementation-specific policy with all or part of a WSDL portType when exposed from a specific implementation.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.pluralsight.com/community/aggbug.aspx?PostID=19885" width="1" height="1"&gt;</content><author><name>mike-vernal</name><uri>http://www.pluralsight.com/community/members/mike_2D00_vernal/default.aspx</uri></author><category term="WCF" scheme="http://www.pluralsight.com/community/blogs/mvernal/archive/tags/WCF/default.aspx" /></entry><entry><title>WS-Addressing Interop is Achieved!</title><link rel="alternate" type="text/html" href="/community/blogs/mvernal/archive/2006/03/09/19884.aspx" /><id>/community/blogs/mvernal/archive/2006/03/09/19884.aspx</id><published>2006-03-09T16:44:00Z</published><updated>2006-03-09T16:44:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;I'm a couple of days late, but still thought I'd share.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;WS-Addressing is currently in the process of becoming a&amp;nbsp;W3C Recommendation.&amp;nbsp; There are a bunch of steps in that process (think School House Rocks, &amp;#8220;I'm just&amp;nbsp;a bill ...&amp;#8221;).&amp;nbsp; One of those steps is the &amp;#8220;Candidate Recommendation&amp;#8221; step.&amp;nbsp; That's where the &lt;A href="http://www.w3.org/TR/2005/CR-ws-addr-core-20050817/"&gt;Core&lt;/A&gt; and &lt;A href="http://www.w3.org/TR/2005/CR-ws-addr-soap-20050817/"&gt;Soap&lt;/A&gt; specs are today.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;In order to get to the next step (&amp;#8221;Proposed Recommendation&amp;#8221;), one of the requirements that the working group put in place was that we achieved a certain level of practical interop between vendors.&amp;nbsp; Specifically, the Working Group wanted there to be at least four different implementations that interoperated on all of the required features of WS-Addressing and at least two different implementations that interoperated on all of the optional features of WS-Addressing.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Towards that goal, a sub-group of the working group spun-up to start tackle interop testing.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;After 3 months of work, we achieved our goal two days ago: &lt;A href="http://www.w3.org/2002/ws/addr/testsuite/report/"&gt;http://www.w3.org/2002/ws/addr/testsuite/report/&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Specifically, the Microsoft, IBM, Sun, WS02, and JBoss implementations demonstrated full interop on the required features.&amp;nbsp; The Microsoft, WS02, and JBoss implementations demonstrated full interop on the optional features.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Now on to PR!&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.pluralsight.com/community/aggbug.aspx?PostID=19884" width="1" height="1"&gt;</content><author><name>mike-vernal</name><uri>http://www.pluralsight.com/community/members/mike_2D00_vernal/default.aspx</uri></author><category term="WCF" scheme="http://www.pluralsight.com/community/blogs/mvernal/archive/tags/WCF/default.aspx" /></entry><entry><title>Serializing (Binding, Address) Pairs in WCF</title><link rel="alternate" type="text/html" href="/community/blogs/mvernal/archive/2006/03/06/19814.aspx" /><id>/community/blogs/mvernal/archive/2006/03/06/19814.aspx</id><published>2006-03-07T04:02:00Z</published><updated>2006-03-07T04:02:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;One of the great ways to procrastinate from finishing a presentation is to blog.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Another way to procrastinate is to find a better blog editor.&amp;nbsp; ;)&amp;nbsp; I'm having issues w/ code snippets in this UI.&amp;nbsp; But I'll save that procrastination venture for another time.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;One of the core virtues (imho) of WCF is its strong emphasis on the decoupling between contracts, bindings, and addresses.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;As I'm sure you know already, contracts define the &amp;#8220;what&amp;#8220; of your service (from both the client and service perspective).&amp;nbsp; They are develop-time, compiled-in assumptions&amp;nbsp;about your app.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Bindings represent the way that you interact with a particular contract.&amp;nbsp; This allows you to, say, expose&amp;nbsp;the same application contract over multiple different bindings for the wide array of clients with whom you may have to interact.&amp;nbsp; Typically, your contract exposes some set of constraints on the binding (and you can optionally add more constraints with the [DeliveryRequirements] attribute).&amp;nbsp; Our goal in designing those constraints were to make them tight enough to ensure correctness while permissive enough to allow a strong degree of polymorphism amongst bindings.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Lastly, addresses represent the location of your service.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Typically, if you are writing a fairly robust client / service app, you want to minimize the couplings between the client and service.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;In terms of endpoints, the pessimal set of couplings you could probably get would be by hard-coding the contract, binding, and address to your service in both your client and service application.&amp;nbsp; This means that if the service moves, you would have to re-compile both&amp;nbsp;the client an the service&amp;nbsp;to make&amp;nbsp;everything work again.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;A small&amp;nbsp;improvement over that model would be to separate both the&amp;nbsp;service's address and the client's view of that address into a run-time specifiable value.&amp;nbsp; Most apps either do this themselves or rely upon some built-in support in their app framework.&amp;nbsp; For instance, in WCF, if you want to change your service location, you can do that by updating both your client and service's config.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;For WCF specifically, an improvement over that model would be to separate both the service's binding and address, as well as the client's view of that information,&amp;nbsp;into a run-time specifiable value.&amp;nbsp; In fact, our config system is engineered to make this easy and our guidance is pretty prescriptive about this being a Good Thing(tm).&amp;nbsp; As such, if you wanted to change the binding and address where a WCF was located, you could do that by only updating the client and service config (no recompiles necessary).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;In both cases, though, you still need to update both the client and the service for what is essentially a service change; this is a little non-ideal.&amp;nbsp; Ideally, you'd like the client to automatically adapt to the service changes.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;One way that people typically do this is by having the address of the service be found through some sort of discovery mechanism (either directory-based or &amp;#8220;peer-to-peer&amp;#8220;-ish).&amp;nbsp; In those cases, the client asks for a service based on some quality (e.g., &amp;#8220;give me a service that implements the contract foo at a binding bar&amp;#8220;).&amp;nbsp; Via whatever&amp;nbsp;discovery mechanism is defined, the client discovers an address for that service and then proceeds to interact with the service.&amp;nbsp; In this way, a service could update its address and the client would pick up that update &amp;#8220;for free.&amp;#8220;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;In WCF, of course, you'd really want to go one step further.&amp;nbsp; Ideally, the only coupling between your client and your service is the contract (as contract-compatibility&amp;nbsp;is a fundamental assumption that is compiled into your app).&amp;nbsp; The binding and address can be discovered at runtime.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;We have some built-in support to the product for this scenario using the MetadataResolver and MetadataTransferClient scenarios.&amp;nbsp; The MetadataResolver class can be used to programmatically retrieve the metadata for a service and surface it as a set of ServiceEndpoints.&amp;nbsp; If you combine this with a discovery approach for metadata addresses, you can essentially achieve the aforementioned decoupling.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Another approach to solving this problem, however, is to make a (Binding, Address) pair itself serializable.&amp;nbsp; This means that you can pass it around itself.&amp;nbsp; For some samples that I've been writing, I've found the ability to do this quite useful.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Here's the code; warning, this is compiled against the very latest bits on my machine, so it may be slightly ahead of the latest CTP.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;[&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;DataContract&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;class&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;SerializableEndpoint&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServiceEndpoint&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; endpoint;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face="Courier New" size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; priority;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; SerializableEndpoint(&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ServiceEndpoint&lt;/FONT&gt;&lt;FONT size=2&gt; endpoint, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; priority)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.endpoint = SanitizeContractInEndpoint(endpoint);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.priority = priority;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;EndpointAddress&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; Address&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.endpoint.Address; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Binding&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; Binding&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.endpoint.Binding; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; ContractName&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.endpoint.Contract.Name; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; ContractNamespace&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.endpoint.Contract.Namespace; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; Name&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.endpoint.Name; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;DataMember&lt;/FONT&gt;&lt;FONT size=2&gt;(IsRequired = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;)]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; Priority&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.priority; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; internal&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;set&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.priority = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;value&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;DataMember&lt;/FONT&gt;&lt;FONT size=2&gt;(IsRequired = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;)]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;MetadataSet&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; Metadata&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WsdlExporter&lt;/FONT&gt;&lt;FONT size=2&gt; exporter = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;WsdlExporter&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exporter.ExportEndpoint(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.endpoint);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IEnumerable&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;MetadataSection&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&amp;gt; sections = exporter.GetGeneratedMetadata();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;MetadataSet&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;(sections);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WsdlImporter&lt;/FONT&gt;&lt;FONT size=2&gt; importer = &lt;/FONT&gt;&lt;FONT size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT size=2&gt;WsdlImporter&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT size=2&gt;value&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.MetadataSections);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#008080 size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;ServiceEndpointCollection&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; endpoints = importer.ImportAllEndpoints();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;if&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; (endpoints.Count != 1)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT size=2&gt;ArgumentException&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT size=2&gt;"MetadataBundle must contain exactly one endpoint."&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.endpoint = SanitizeContractInEndpoint(endpoints[0]);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT size=2&gt;ServiceEndpoint&lt;/FONT&gt;&lt;FONT size=2&gt; SanitizeContractInEndpoint(&lt;/FONT&gt;&lt;FONT size=2&gt;ServiceEndpoint&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; endpoint)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServiceEndpoint&lt;/FONT&gt;&lt;FONT size=2&gt; newEndpoint = &lt;/FONT&gt;&lt;FONT size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT size=2&gt;ServiceEndpoint&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT size=2&gt;ContractDescription&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;(endpoint.Contract.Name, endpoint.Contract.Namespace));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newEndpoint.Address = endpoint.Address;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newEndpoint.Binding = endpoint.Binding;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newEndpoint.Name = endpoint.Name;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; newEndpoint;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;I include the contract's name and namespace because I hope that's sufficient to correlate the contract with your local one.&amp;nbsp; I've found it&amp;nbsp;useful if I, say, get back a set of these (Binding, Address) pairs and want to see if any of them are usable with my contract.&amp;nbsp; I use priority as a way of weighting multiple matching (Binding, Address) pairs.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;The serialization mechanism is a little non-ideal, but we are investigating better ways to make a binding itself serializable.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;Interestingly,&amp;nbsp;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;ieSpellCheck thinks that WsdlExporter is incorrectly spelled.&amp;nbsp; It thinks&amp;nbsp;&amp;#8220;sexpot&amp;#8221;&amp;nbsp;is a better spelling.&amp;nbsp; I find this amusing, especially&amp;nbsp; knowing that AlexDeJ named the class.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;With that, back to the presentation.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;(Nit: Another issue with the blog editor is the lack of &amp;#8220;preview;&amp;#8221; sorry to those folks that saw the first draft before I re-read it.)&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.pluralsight.com/community/aggbug.aspx?PostID=19814" width="1" height="1"&gt;</content><author><name>mike-vernal</name><uri>http://www.pluralsight.com/community/members/mike_2D00_vernal/default.aspx</uri></author><category term="WCF" scheme="http://www.pluralsight.com/community/blogs/mvernal/archive/tags/WCF/default.aspx" /></entry><entry><title>Fancy Addressing in WCF</title><link rel="alternate" type="text/html" href="/community/blogs/mvernal/archive/2006/02/01/18523.aspx" /><id>/community/blogs/mvernal/archive/2006/02/01/18523.aspx</id><published>2006-02-01T21:08:00Z</published><updated>2006-02-01T21:08:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;One of the core specs that WCF implements is &lt;/FONT&gt;&lt;A href="http://www.w3.org/TR/2005/CR-ws-addr-core-20050817/"&gt;&lt;FONT size=2&gt;WS-Addressing&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;At the highest level, WS-Addressing essentially defines three things.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;First,&amp;nbsp;WS-Addressing defines a core address construct called Endpoint Reference.&amp;nbsp; An Endpoint Reference provides a mechanism for identifying a Web service endpoint.&amp;nbsp; In the WCF object model, we call this thing an EndpointAddress.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Second,&amp;nbsp;WS-Addressing defines a set of Message Addressing Headers.&amp;nbsp; These headers -- To, ReplyTo, FaultTo, MessageID, RelatesTo, etc. -- are useful for defining (a) where an initial&amp;nbsp;message is going, (b) how to send messages in reaction to that initial message and (c) how to tell that those reactionary messages are related to the initial message.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Third (though it's not usually called out separately), WS-Addressing defines an Action header.&amp;nbsp; This essentially defines the intent of the Message.&amp;nbsp; Typically, if you want to figure out how to process a Message, you use the action as your key.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;We tend to think of the Message Addressing Headers primarily as plumbing.&amp;nbsp; For instance, if you want to correlate a request message with a response message over TCP or UDP, you need&amp;nbsp;the ReplyTo, MessageID, and RelatesTo mechanisms.&amp;nbsp; If you want to figure out to what endpoint you should dispatch a message, you look at the To.&amp;nbsp; Etc.&amp;nbsp; Our runtime adds and inspects these headers to do things like request-reply correlation.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Sometimes, though, people end up wanting to do fancy things with addressing at the application layer.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;For instance, one pattern is to send a one-way message to a lot of folks (e.g., using UDP multicast) and provide them with a mechanism for sending back one-way reply messages.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;To do this in WCF, you just need to use OperationContext.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;For instance, suppose I had the following two contracts:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;FONT face="Courier New"&gt;[&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;ServiceContract&lt;FONT color=#000000&gt;]&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;interface&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;QueryContract&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;OperationContract&lt;/FONT&gt;&lt;FONT size=2&gt;(IsOneWay = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;)]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&lt;/FONT&gt;&lt;FONT size=2&gt; Query(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; query);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;[&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;ServiceContract&lt;/FONT&gt;&lt;FONT size=2&gt;]&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;interface&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;QueryCallbackContract&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;OperationContract&lt;/FONT&gt;&lt;FONT size=2&gt;(IsOneWay = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;)]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&lt;/FONT&gt;&lt;FONT size=2&gt; Response(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; response);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Verdana&gt;The first contract (QueryContract) represents the one-way message that I want to send out.&amp;nbsp; The second contract (QueryCallbackContract) represents the one-way message I expect in return.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Verdana&gt;Now, suppose you want to correlate a Query message with a Response message.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Verdana&gt;To do that, you'd first create up the appropriate channel / channel factory:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;CustomBinding&lt;/FONT&gt;&lt;FONT size=2&gt; binding = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;CustomBinding&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;TextMessageEncodingBindingElement&lt;/FONT&gt;&lt;FONT size=2&gt;(), &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;HttpTransportBindingElement&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;());&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;ChannelFactory&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;QueryContract&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; factory = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChannelFactory&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;QueryContract&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt;(binding, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;EndpointAddress&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"http://destination/"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#008080 size=2&gt;QueryContract&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; channel = factory.CreateChannel();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;Next, you would wrap your call to Query() in an OperationContextScope.&amp;nbsp; This essentially populates an OperationContext.Current.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;Inside your using block, you could add the address of your local endpoint to the ReplyTo header as well as add a correlation ID:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;OperationContextScope&lt;/FONT&gt;&lt;FONT size=2&gt;((&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;IContextChannel&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;)channel))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OperationContext&lt;/FONT&gt;&lt;FONT size=2&gt;.Current.OutgoingMessageHeaders.ReplyTo = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;EndpointAddress&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"http://callback/"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OperationContext&lt;/FONT&gt;&lt;FONT size=2&gt;.Current.OutgoingMessageHeaders.MessageId = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;UniqueId&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; channel.Query(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#800000 size=2&gt;"foo"&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;FONT face=Verdana&gt;After this, you would typically store off the Message ID you created, along with information about the request, in some thread-safe dictionary.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;FONT face=Verdana&gt;On the service-side, you might implement Query() as follows:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;class&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;QueryService&lt;/FONT&gt;&lt;FONT size=2&gt; : &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;QueryContract&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; Query(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; query)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EndpointAddress&lt;/FONT&gt;&lt;FONT size=2&gt; replyTo = &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;OperationContext&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.Current.IncomingMessageHeaders.ReplyTo;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UniqueId&lt;/FONT&gt;&lt;FONT size=2&gt; messageId = &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;OperationContext&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.Current.IncomingMessageHeaders.MessageId;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomBinding&lt;/FONT&gt;&lt;FONT size=2&gt; binding = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;CustomBinding&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;TextMessageEncodingBindingElement&lt;/FONT&gt;&lt;FONT size=2&gt;(), &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;HttpTransportBindingElement&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;());&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ChannelFactory&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;QueryCallbackContract&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; factory = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChannelFactory&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;QueryCallbackContract&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&amp;gt;(binding, replyTo);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; QueryCallbackContract&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; channel = factory.CreateChannel();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;OperationContextScope&lt;/FONT&gt;&lt;FONT size=2&gt;((&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;IContextChannel&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;)channel))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OperationContext&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.Current.OutgoingMessageHeaders.RelatesTo = messageId;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; channel.Response(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#800000 size=2&gt;"bar"&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Verdana&gt;First, you would fish out the addressing headers that you set (ReplyTo, MessageId).&amp;nbsp; Next, you would create a channel back to that ReplyTo.&amp;nbsp; Next, you would create a new OperationContextScope and use that around the new channel, set the RelatesTo header to match the MessageId, and then send the response message.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Verdana&gt;(Note, you'd probably want to be slightly fancier than creating a new binding / channel factory for each operation.)&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Verdana&gt;Lastly, back on the client-side, you would probably fish out the RelatesTo, go back to that dictionary you set on the initial request, and complete the outstanding operation.&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face=Verdana&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;class&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;QueryCallbackService&lt;/FONT&gt;&lt;FONT size=2&gt; : &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;QueryCallbackContract&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; Response(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; response)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UniqueId&lt;/FONT&gt;&lt;FONT size=2&gt; relatesTo = &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;OperationContext&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;.Current.IncomingMessageHeaders.RelatesTo;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // use relateTo to correlate to initial request&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Verdana&gt;It should be noted that in a real application, you might want to be more sophisticated about deciding whether or not to trust the incoming ReplyTo before creating a channel to it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Verdana&gt;So there you go.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Verdana&gt;Interestingly, I just realized that utilizing the ReplyTo header has a nice property over utilizing a custom header as you can use EndpointAddress directly (and we will pick up the right addressing version for free).&amp;nbsp; If you were to define a MessageHeader via CreateMessageHeader(...), you would have to pick a serializable type of EndpointAddress (either EndpointAddressAugust2004 or EndpointAddress10) or write a custom sub-class of MessageHeader that grabbed the ambient Message Version and used that when reading / writing the EndpointAddress.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Verdana&gt;But I digress.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;EM&gt;Edit (2006.03.21): Fixed Typo -- Changed QueryContract --&amp;gt; QueryCallbackContract.&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.pluralsight.com/community/aggbug.aspx?PostID=18523" width="1" height="1"&gt;</content><author><name>mike-vernal</name><uri>http://www.pluralsight.com/community/members/mike_2D00_vernal/default.aspx</uri></author><category term="WCF" scheme="http://www.pluralsight.com/community/blogs/mvernal/archive/tags/WCF/default.aspx" /></entry><entry><title>Greetings</title><link rel="alternate" type="text/html" href="/community/blogs/mvernal/archive/2006/01/30/18476.aspx" /><id>/community/blogs/mvernal/archive/2006/01/30/18476.aspx</id><published>2006-01-31T06:20:00Z</published><updated>2006-01-31T06:20:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Greetings from Building 42!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;(Yes, the Windows Communication Foundation (as well as the .NET Framework and the CLR) are built in Building 42.)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;After years of resisting, I've finally decided to sit down and do the blog-about-WCF thing.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;My name is Mike, and I'm a Program Manager on the WCF team.&amp;nbsp; I work on the design and implementation of the Service Model, including the core programming metaphors (Services, Endpoints, Contracts,&amp;nbsp;Behaviors, Bindings, Addresses) and the core runtime pieces (Dispatcher, Channels, etc.).&amp;nbsp; I also work closely with the way we map to and from WSDL and XSD.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;I plan to use this space to basically rant, but every so often I may make fun of Don or Doug.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;My first rant, though, is reserved for the fine poster people at Microsoft.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;One of the plagues that, I guess, infects any large corporation is the need for lots and lots of informative posters.&amp;nbsp; Update Your Benefits!&amp;nbsp; Cheer Your Local Localization Team!&amp;nbsp; Etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;One of my new favorites is the poster entitled &amp;#8220;Super Meetings.&amp;#8220;&amp;nbsp; To be frank, the poster basically stands alone:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;
&lt;CENTER&gt;&lt;A href="http://www.pluralsight.com/mvernal/SuperMeetings.jpg"&gt;&lt;IMG src="http://www.pluralsight.com/mvernal/SuperMeetings.jpg" width=640 border="0"&gt;&lt;/A&gt;&lt;/CENTER&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;To quote classic Simpsons: &amp;#8220;Unless your being ironic, turn that off now!&amp;#8221;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;-mike&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.pluralsight.com/community/aggbug.aspx?PostID=18476" width="1" height="1"&gt;</content><author><name>mike-vernal</name><uri>http://www.pluralsight.com/community/members/mike_2D00_vernal/default.aspx</uri></author><category term="Random" scheme="http://www.pluralsight.com/community/blogs/mvernal/archive/tags/Random/default.aspx" /></entry></feed>