Author: Richard Seroter

  • Article Series on BizTalk and WCF: Part I, Operation Patterns

    UPDATE: I have since moved these articles to my own blog and they can be found here.

    A couple months back I wrote a short post explaining some simple BizTalk Server 2006 R2 + Windows Communication Foundation scenarios.  Afterwards, I was approached by the folks at TopXML.com to write a series of articles that provided depth on BizTalk + WCF integration.

    So, I’ve begun a multi-part series of articles that explain many of the core aspects of how BizTalk and WCF play together.

    My first article explains the various operation patterns when BizTalk consumes a WCF service.  In this article, I touch upon dealing with complex vs. simple types, one way vs. two way operations, (custom) fault contracts, and using the WCF-WSHttp and WCF-WSCustom BizTalk adapters.

    The next piece I’m publishing showcases the various WCF security configurations supported by BizTalk Server 2006 R2.  Then, I’ll demonstrate BizTalk integration with MTOM and Transactional WCF services.  Finally, I’ll finish the series with articles describing how to publish WCF services OUT of BizTalk.  Should be fun and I hope folks learn as much reading these as I did writing them.

    In the meantime, if you have questions/comments/corrections on this first article, please leave a comment here.

    Series Summary
    BizTalk and WCF: Part I, Operation Patterns Get the source code!
    BizTalk and WCF: Part II, Security Patterns
    BizTalk and WCF: Part III, Transaction Patterns
    BizTalk and WCF: Part IV, Attachment Patterns
    BizTalk and WCF: Part V, Publishing Operations Patterns Get the source code!
    BizTalk and WCF: Part VI, Publishing Advanced Service Patterns
    BizTalk and WCF: Part VII, About the BizTalk Adapter Pack Get the source code!
    BizTalk and WCF: Part VIII, BizTalk Adapter Pack Service Model Patterns
    BizTalk and WCF: Part IX, BizTalk Adapter Pack BizTalk Patterns

    Technorati Tags: ,

  • MVP Shenanigans

    I’m apparently being subjected to some new MVP hazing.  I received my “welcome” kit in the mail … but it was for some MOM MVP!  Then poor Tim received my kit in the mail.  This was after my online profile got mixed up for a few days.  I’m worried that the next MVP box I receive from Microsoft will be full of human hair or a frozen kidney.  Stay tuned.

  • BizTalk Deployment Poster Now Available

    If you’re setting up a BizTalk environment, or considering growing your existing configuration, take a peek at the just-released BizTalk Scale-Out Options poster from Microsoft (hat tip: Eric).

    Not sure I’d revisit this poster that often (compared to the BizTalk Capabilities poster or the Runtime Architecture poster which are both hanging in my office), but, it’s definitely worth reviewing once.

    While I’m linking to stuff today, check out the latest from my buddy Victor who just wrote an epic post on cleansing data with DataFlux.  Neat stuff.

     

    Technorati Tags:

  • Applying Role-Based Security to BizTalk Feeds From RSSBus

    I recently showed how one could use RSSBus to generate RSS feeds for BizTalk service metrics on an application-by-application basis.  The last mile, for me, was getting security applied to a given feed.  I only have a single file that generates all the feeds, but, I still need to apply role-based security restraints on the data.

    This was a fun exercise.  First, I had to switch my RSSBus installation to use Windows authentication, vs. the Forms authentication that the default installation uses.  Next I removed the “anonymous access” capabilities from the IIS web site virtual directory.  I need those steps done first because I plan on checking to see if the calling user is in the Active Directory group associated with a given BizTalk application.

    Now the interesting part.  RSSBus allows you to generate custom “formatters” for presenting data in the feed.  In my case, I have a formatter which does a security check.  Their great technical folks provided me a skeleton formatter (and way too much personal assistance!) which I’ve embellished a bit.

    First off, I have a class which implements the RSSBus formatter interface.

    public class checksecurity : nsoftware.RSSBus.RSBFormatter
    

    Next I need to implement the required operation, “Format” which is where I’ll check the security credentials of the caller.

    public string Format(string[] value, string[] param)
    {
       string appname = "not_defined";
       string username = "anonymous";
       bool hasAccess = false;
    	
       //check inbound params for null
       if (value != null && value[0] != null)
       {
         appname = value[0];
         //grab username of RSS caller
         username = HttpContext.Current.User.Identity.Name;
         if (HttpContext.Current != null)
         {
            //check cache
    	if (HttpContext.Current.Cache["BizTalkAppMapping"] == null)
            {
              //inflate object from XML config file
              BizTalkAppMappingManager appMapping = LoadBizTalkMappings();
    
              //read role associated with input BizTalk app name
              string mappedRole = appMapping.BizTalkMapping[appname];
    
              //check access for this user
              hasAccess = HttpContext.Current.User.IsInRole(mappedRole);
    
              //pop object into cache with file dependency
              System.Web.Caching.CacheDependency fileDep = 
                   new System.Web.Caching.CacheDependency
                       (@"BizTalkApplicationMapping.xml");
              HttpContext.Current.Cache.Insert
                       ("BizTalkAppMapping", appMapping, fileDep);
             }
            else
             {
              //read object and allowable role from cache
              string mappedRole = 
                   ((BizTalkAppMappingManager)
                        HttpContext.Current.Cache["BizTalkAppMapping"])
                           .BizTalkMapping[appname];
    
             //check access for this user
             hasAccess = HttpContext.Current.User.IsInRole(mappedRole);
              }
         }
      }
      if (hasAccess == false) 
            throw new RSBException("access_violation", "Access denied.");
                
      //no need to return any value
      return "";
    }
    

    A few things to note in the code above.  I call a function named “LoadBizTalkMappings” which reads an XML file from disk (BizTalkApplicationMapping.xml), serializes it into an object, and returns that object.  That XML file contains name/value pairs of BizTalk application names and Active Directory domain groups.  Notice that I use the “IsInRole” operation on the Principal object to discover if this user can view this particular feed.  Finally, see that I’m using web caching with a file dependency.  After the first load, my mapping object is read from cache instead of pulled from disk. When new applications come on board, or a AD group account changes, simply changing my XML configuration file will invalidate my cache and force a reload on the next RSS request.  Neato.

    That’s all well and good, but how do I use this thing?  First, in my RSSBus web directory, I created an “App_Code” directory and put my class files (formatter and BizTalkApplicationMappingManager) in there.  Then they get dynamically compiled upon web request.  The next step is tricky.  I originally had my formatter called within my RSSBus file where my input parameters were set.  However, I discovered that due to my RSS caching setup, once the feed was cached, the security check was bypassed!  So, instead, I put my formatter request in the RSSBus cache statement itself.  Now I’m assured that it’ll run each time.

    So what do I have now?  I have RSS urls such as http://server/rssbus/BizTalkOperations.rsb?app=Application1 which will only return results for “Application1” if the caller is in the AD group defined in my XML configuration file.  Even though I have caching turned on, the RSSBus engine checks my security formatter prior to returning the cached RSS feed.  Cool.

    Is this the most practical application in the world?  Nah.  But, RSS can play an interesting role inside enterprises when tracking operational performance and this was a fun way to demonstrate that.  And now, I have a secure way of allowing business personnel to see the levels of activity through the BizTalk systems they own.  That’s not a bad thing.

    Technorati Tags: ,

  • [Help] XML Serialization Result is Different in Separate Environments

    Here’s one for you.  I have two Windows Server 2003 environments, and in one environment, a .NET object correctly serializes to XML, and in the next environment it does not.

    Let’s set this up.  First, I have an existing schema like below where my datetime/number types are both nillable, and have a minOccurs of 0.  So, they could exist and be null, or not exist entirely.

    Next, I generate a typed object for this schema using xsd.exe.  The generated class contains my schema nodes, of course, but xsd.exe also inserts these boolean “[fieldname] + Specified” variables.  Now these field accessors have the XmlIgnoreAttribute, so they don’t get included in the XML document, but rather can be used to check if a field exists.  If the value is false, the the XML serializer doesn’t include the corresponding field in the output.

    So far so good.  I’ve built a really simple application that takes an XML string and loads it into my .NET object via the XmlSerializer Framework object.  On my development machine, executing this step results in a MessageBox window that shows the object properties after the Xml deserialization occurred.

    As you can see, all the values in my original XML document converted fine, and, the “specified” fields are both set to true because the corresponding fields have values.  If I take this little application, and run it on our common development environment, I get the exact same result (I’ve also tested this on some co-worker’s machines).  However, if I run this application in our TEST environment (same OS, same .NET framework version as previously tested environments), I get the following result:

    What, what, what??  I still have values present for the integer (“Age”) and datetime (“BirthDate”) but the “specified” fields are now false.  What’s the ramification?  Turning this object back into XML in this TEST environment results in this …

    Yowza.  Now those fields don’t get serialized back into the XML document.  Not good.  As for solutions, the quickest one is to remove the auto-generated “specified” fields from the .NET object which results in everything serializing and deserializing just fine.  However, I don’t like mucking with auto-generated code because you have to remember what changes you’ve made for all future releases.

    Thoughts as to what could cause this?  A .NET hotfix, something environmental? I’ve included my little test application here, so feel free to download and execute the quick test on your machine and post the results in the comments.

    Technorati Tags:

  • Year in Review, MVP Status Awarded

    I was going to use this, my 100th post on WordPress, and first of 2008, to highlight my favorite posts from last year.  But upon my return from vacation yesterday, I discovered that I had been granted an MVP award for my efforts in 2007, so, I also want to throw a quick thanks to the Microsoft folks.  Achieving an MVP was one of my silent goals for the year, so I’m jazzed that my contributions were considered useful enough to warrant this.

    I had lots of fun learning new BizTalk things in 2007, and these were a few of the ones that I enjoyed writing the most …

    This year you’ll see fewer BizTalk-related posts as I continue my descent into broad systems architecture, but, I’ll try and keep you all entertained nonetheless.

    Technorati Tags: , ,

  • Building an RSSBus Feed for BizTalk Server

    A few months back, I demonstrated how to build a SQL query against the BizTalk databases which returned application-level activity metrics.   Now that the RSSBus Server has moved further along in its release cycle, I went ahead and built a more full-featured RSS feed out of BizTalk.

    Within the RSSBus infrastructure, one can build an “.rsb” file, which can be syndicated as RSS.

    So what’s contained in this “.rsb” file that makes my RSS feed so exciting?  Let’s look.  First off, I can specify input parameters to my feed, which are received via the URI itself.  Notice that you can also specify a default value, and, a restricted list of values.  In my case below, I’m only accepting activity metrics for one, two, seven and fourteen days back.

    <rsb:info 
    title="BizTalk Operations" description="BizTalk Operations Feed">
      <input name="app" default="App1" 
    desc="This is the name of the BizTalk application to query">
      <input name="interval" default="1" 
    desc="The number of historical days to show" values="1,2,7,14">
      <input name="servicefilter" default="" 
    desc="Keyword filter of results">
      <input name="typefilter" default="all" 
    desc="Show all service types/just messaging/just orchestration" 
    required="false">
     </rsb:info>

    What I’m trying to do here is have a single “feed” file, which can actually serve RSS data for a wide variety of applications and scenarios.  Instead of having to create a new RSS feed for each newly deployed BizTalk “application”, I can simply generate a new URI and not deploy a single new object.

    Now arguably the only way this solution will work is if we aren’t actually hitting the BizTalk databases each time a person refreshes their RSS feed.  I don’t want that additional load on our production system.  So, what are my caching options?  As it turns out (thanks to the spectacularly helpful RSSBus techs who helped me out), the caching capabilities are quite robust.  Here’s my caching declaration in my “.rsb” file ..

    <rsb:cache duration="120" 
    file="cache\\cache_[_input.app | tofilename]_
    [_input.interval | tofilename]_[_input.servicefilter | tofilename]_
    [_input.typefilter | tofilename].xml" />

    The first time this feed is hit (or when the cache duration has been exceeded), a cache file is created and named according to the URI parameters.  So if I hit this feed for application “ABC” and a “7 day” duration, filtered by all services with “SOAP” in the name, and only wanted “messaging” services, my cache file on disk would be named “cache_ABC_7_SOAP_messaging.xml”.  If someone else makes the same RSS request within the cache duration interval, then RSSBus will return the cached data (stored in the file) instead of actually querying my BizTalk databases again.  As you would expect, I have many cache files on my system at any one time to reflect the many RSS query permutations.

    Then, within my “.rsb” file, I use the RSSBus “sqlCall” connector and format all the results.  The “<rsb:match>” keyword is in place to suppress resulting values that don’t contain the input “service filter” value.   I then use the “<rsb:select>” and “<rsb:case>” keywords to do a switch statement based on the “type filter” value.  This allows me to show only orchestration services, messaging (send/receive) services, or both.

    So what’s the result?  To demonstrate the RSSBus server to some colleagues, I utilized our newly deployed MOSS 2007 infrastructure to add RSS data to my personal site.  After putting together the RSS query URI just the way I want it, I take that URI and apply it to the RSS webpart on my site.

    I chose to show both the feed AND description since I put the BizTalk activity count in the item description.  After saving my web part changes, I can now see my RSS data from our “development” server.


    Now I can provide URLs to the business owners of our various BizTalk applications and they can see regular performance metrics for their system.  RSSBus provides a pretty unique platform for building and maintaining RSS feeds from a wide variety of sources.  Providing operational metrics from enterprise systems may be one way that my company actually uses RSS to further business objectives.

    My last step is to add security to a given feed query, and the RSSBus folks are helping me through that right now.  I’d like to be able to restrict viewership of a given feed based on Active Directory group membership.  I’ll report back on the results.

    Technorati Tags: ,

  • Oracle ODBC Driver Problems After Database Upgrade

    Given that my posts on BizTalk + Oracle integration are consistently my most popular, I thought I’d add another one to the mix.

    The first BizTalk application that my company deployed required BizTalk to poll an Oracle 8i database.   When BizTalk was first installed here, we followed the documented instructions and installed the Oracle 9.2 client, and specifically, the Oracle 9.2.0.54 version of the ODBC driver.  For the most part, everything has been smooth sailing.

    Recently, we took that application down for to fix a bug in the Oracle view, and while that work was being done, the underlying Oracle database was upgraded from 8i to 9i.   No big deal, right?  Well, after the bug had been fixed in the Oracle view, and we turned the application back on in our “test” environment, we noticed some very bizarre behavior.

    After some initial investigation, I saw that the value (of type varchar2) being pulled from the Oracle database appeared to be truncated!  Only seven characters (out of eight) were being pulled, and, every other value came in empty.  Yowza. 

    So where to begin troubleshooting this?  The first place we looked was the database itself.  Had anything changed?  Oracle 9i has significantly more Unicode support, so we checked to see if data was improperly converted from 7-bit ASCII to Unicode.  The data appeared to be intact and unmolested. 

    Given that no changes had occurred on the BizTalk application itself, it seemed unlikely that BizTalk was the culprit.  We checked a few basic things such as the “maxLength” value (identical in both BizTalk schema and Oracle view), and also confirmed that the BizTalk binding configuration had not changed.

    So, next we looked at the connection to Oracle itself.  Was the ODBC connection the troublemaker here?  I decided to open Visual Studio.NET, and using the Server Explorer, create a connection to my Oracle database by reusing the existing Oracle ODBC DSN.  Sure enough, when I viewed the Oracle view in question, I saw truncated (and missing) values!  I knew positively that the underlying data was right, so the connection was the piece that was distorting my data.

    I confirmed this by going to a different environment (with the Oracle 10g client installed) and using Visual Studio.NET to browse the Oracle database table.  Using the 10g client, the data appeared correctly.

    So, in our development environment, our administrators tried downgrading our Oracle ODBC driver to 9.2.0.0.0.  When we did that, the data also appeared correctly.  However, I wasn’t comfortable downgrading, and suggested moving one Oracle ODBC version past the Microsoft-recommended 9.2.0.54.  We installed the 9.2.0.65 version of the ODBC driver, and once again, everything looked perfect.  After that, one of the DBAs suggested skipping 9.2.0.65 (due to a few noteworthy bugs) and jump to 9.2.0.8 (with the latest DST patch).

    So what the heck caused this?  I still don’t have a great answer.  The only change to this system was the database upgrade, but the DBAs were fairly confident that existing connections should not have been affected.  The set of tubes known as the internet turned up very few results.  There was some information on Oracle ODBC and Unicode, and some other gripes with the 9.2.0.54 driver, but nothing that  explained why the ODBC connection to the database mangled my result set.

    Moral of the story?  When troubleshooting these sorts of scenarios, check off each area that could have caused the problem, and use multiple environments (with different configurations) to isolate the problem.  Then when all else fails, upgrade Oracle drivers!

    Technorati Tags: ,

  • Changing Roles

    It’s been just about a year since I left Microsoft to take my current job, and after some success in my initial role, I’m switching teams and responsibilities.

    I was brought into this company to help establish our BizTalk practice.  After participating in 10 projects, teaching 8 classes (to 110+ colleagues), creating a few tools and frameworks, and writing up some best practices and checklists, it was time for new challenges.

    So, I’ve moved into our Solutions Architecture team as a Solutions Architect.  My job now is to execute architecture reviews, help define and guide architectural principles, design and model new systems, research and introduce new technologies, and more.   While I’ll remain the “BizTalk guy” here for a while, that’s no longer my central technology each and every day.

    Blog-wise, expect to continue seeing various tidbits and demonstrations of BizTalk concepts (because it’s still fun for me), but I’ll probably start peppering in other architectural topics that are on my mind.

    Technorati Tags: , ,

  • Microsoft Architecture Journal Reader Tool

    Yesterday I was checking out the MSDN Architecture Center and noticed a reader application for the Architecture Journal.

    This interface makes the Journal easy to read, and demonstrates a few nice UI concepts.

    This tool is auto-updating, so it should automatically pull down the latest versions of the Journal.  You can add interesting articles to a “reading list” for later reference.   For each particular article, you have the option of saving it to the desktop, emailing it, or copying the summary to the Windows clipboard.

    Another nice feature is the ability to add notes to each article.  Once a note is added to a particular passage or section, that area is highlighted with a different color.  I was hoping that my notes would show up in the search results, but alas, I’d have to remember where I had added notes vs. finding them later via broad search.

    I find this more interesting as a UI design then for actually reading the Journal.  There probably aren’t enough issues to justify reading list and search functionality (I’d like to see this tool for MSDN Magazine!), but, it does offer a few interesting ideas about an internet-updated thick client.

    Technorati Tags: ,