Archive for July, 2008

InfoPath Rules Grouping Behavior (And New BizTalk Posters)

A buddy at work is designing an InfoPath form and was befuddled by some awkward behavior in the way InfoPath executes its rule conditions.

So let’s say that you want to execute the following comparison:  “If the sum of the order is greater than $500, and, the customer is from either CA or FL, then set a 10% discount rate.”  In essence you have a “A & (B | C)” situation.  So my pal had a rule that fired which checked these conditions.  On the first pass, his rule conditions looked like this:

Makes sense, BUT, where does InfoPath put the parentheses?  Not where we first thought.  The way this rule is written, InfoPath executes it as “(A & B) | C“.  That is, if I just enter “FL” into my textbox, the rule passes because as long as the state equals “FL”, the first condition doesn’t matter.   The “and’s” take precedence over the “or’s”. 

So, how do I get the conditions to line up as I really want?  You actually have to break apart the condition to look like “(A & B) | (A & C)” such as:

This way, the two fields on both sides of the “and’s” are grouped together and split by the “or.”

You also max out on the number of rule conditions at 5, so if you have a rule with a large set of conditions, you’ll need to split it up into multiple rules.  I still like InfoPath, but man, I’ve been getting punched in the face by little quirks for the past few weeks.

As a complete non-sequitur, I noticed that the BizTalk team just released yet another poster (this one on the BizTalk Adapter Pack and LOB SDK).  Besides expecting 14 different blogs on the MSDN site to do nothing but cut and paste the announcement,  this also means that I shouldn’t make fun of the team’s poster-producing prowess ever again.   I’m still holding out hope for the “Women of BizTalk Server” poster.  Fingers crossed.

Technorati Tags: , BizTalk

Checklist for Reviewing Services for SOA Compatibility

I’ve got SOA on the brain lately.  I’m in the process of writing a book on building service-oriented solutions using BizTalk Server 2006 R3 (due out right around the product release), and, trying to organize a service review board at my company.  Good times.

So what’s a “service review board”?  It’s a chance to look at services that have been deployed within our development environment and chat with the developer/architect about various design and deployment considerations.  In reality, it’s a way to move from “just a bunch of web services” (JBOWS) to an architecture that truly supports our stated service-oriented principles.  Now, clearly there are services that are meant to solve a specific purpose, and may not be appropriate for “enterprise” scale.  But, I would argue that the goal of any service is to be designed with principles of reuse in mind, even if service reuse never happens.

Who should attend such a review board besides the service developer?  I’d suggest the following representatives:

  • Infrastructure.  Make sure that all deployment considerations have been taken into account such as a host server (dev/test/prod), required platforms and the like.
  • Enterprise architecture.  Look at the service and compare that to other enterprise projects to see if there is overlap with existing services, or, the possibility to reuse the new service in an upcoming project.
  • Data architecture.  Confirm best practices for the data being sent as part of service requests or responses.   Also, consider the data security and data privacy.
  • Solution architecture.  Review software patterns used and ensure that the service has the appropriate security considerations and repository registration.

With that in mind, what questions do we want to ask to verify whether this service is enterprise-ready?

Infrastructure
Question Answer
What is the technology platform that this service is built upon (e.g. Java, .NET)?  
Do you have host servers identified for all deployment environments?  
Are there any SLAs defined for this service as a result of non-functional requirements?  
Have the appropriate service repository metadata elements been identified for this service?  
Has this service been sufficiently load tested?  
Security
Question Answer
Has a security policy been identified?  
Does this service use either transport-level security or message-based security, and if so, does it match corporate standards?  
Have the appropriate directory accounts/groups been created and assigned?  
Data
Question Answer
What type of data is received by the service: document, event or function parameter?  
Are the input/output types complex or simple types?  
Were standard, cross-platform data types used?  
Does this service use an enterprise shared entity as its input or output?  
If the answer above is “no”, should the input/output parameter be considered for a new shared entity definition?  
Is the input message self-contained?  
Software Architecture
Question Answer
Is this a data service, event service, or functional service?  
Does it support both synchronous and asynchronous invocation?  
Is the service an encapsulated, stand-alone entity?  
Are service dependencies dynamically loaded or configurable?  
Has the service been tested for cross-platform invocation?  
Does this service use an transactions?  
Can the service accept a flowed transaction?  
Has a lifecycle versioning strategy been defined?  
Is the interface SOAP, REST or POX based?  
Do common functions like exception handling and logging use enterprise aspects?  
Is the service contract coarse grained or fine grained?  
Is the WSDL too complicated (e.g. numerous imports) to be consumed by BizTalk Server?  
How are exceptions handled and thrown?  
Does the service maintain any state?  
Do the service namespace and operations have valid and understandable identifiers?  

The goal of this is not to torture service developers, but rather to consider enterprise implications of new services being developed.  Did I miss anything, or include something that doesn’t matter to you?  I’d  love your thoughts on this.

Technorati Tags:

Microsoft "Zermatt" Developer Identity Framework

The concept of “Identity Management” is not my strongest suit, so I’ve been spending more time this year reading up on the topic and trying to gain additional perspective.  Noticed yesterday on Vittorio’s blog that he announced the beta release of a new Identity Framework code named “Zermatt” targeted towards developers.   Ignoring the fact that the code name sounds like either a robot villain or a rejected Muppet, this is actually a pretty interesting release.  It’s basically a set of .NET framework objects that you use to implement claims-based identity models in your applications, thus avoiding tight coupling to custom user stores or particular directories.

Check out the great whitepaper for more information and examples of how it works.  I’ve read it once, but need to re-read it about 6 more times.

Technorati Tags:

Sending Flat File Payload in a SOAP Message

So we have a project were pieces of data are sent to an external party.  This party exposes a “service” to accept the data.  However, the “service” takes in a few pieces of metadata, and then accepts a comma-delimited string of values as the actual payload.  Ugh.  Ignoring the questionable design, how would I take what was originally XML content, turn it into a delimited structure, and then jam it into the outbound SOAP message?  Let’s see how we’d do that in BizTalk Server.  What I’ll show here is how to call the flat file assembler pipeline from an orchestration, and use a custom component to yank out the flat file content and put it into an XML element.

First, I need some schemas.  I’ll start with the XML schema representing my company’s data.  This example schema is fairly simple and holds some basic employee information. 

Next, I have to create the flat file schema that puts the data in the delimited format required by the vendor.  I started with a instance file, and used the Flat File Wizard to generate the XSD schema.

Now I need the schema representing the message that I’m sending to the vendor.  It has a timestamp value, and then a string which holds the comma-delimited payload.

After the schemas are created, I need a map.  Specifically, I created a map from my company’s XML format to the delimited format.

A custom pipeline is needed to convert a message to a flat file output, so I built a send pipeline that utilizes the flat file assembler component.

Great.  Now, before I build the orchestration, I need a helper component which can extract the candy center from my flat file message.  So, I have a C# class library project with a class called FlatFileExtractor.  This object has a single static operation called ExtractText.   This project references the Microsoft.XLANGs.BaseTypes.dll found in the BizTalk installation directory.  The code of the operation looks like this …

[Serializable] public class FlatFileExtrator { public static string ExtractText(XLANGMessage inputMsg) { string result; //pull out message payload as stream StreamReader sr = new StreamReader( (Stream)inputMsg[0].RetrieveAs(typeof(Stream))); //load stream contents into string result = sr.ReadToEnd(); return result; } }

So, if I pass in a message object from my orchestration, it should return me the guts of that message as a string.

Now I can create my orchestration.  First off, I need to receive and transform the initial XML message.  Let’s get it into the flat file schema format.

Next I get into the whole “call pipeline from orchestration” magic.  Within an atomic scope, I declare a variable of type Microsoft.XLANGs.Pipeline. SendPipelineInputMessages (make sure you reference the Microsoft.XLANGs.Pipeline.dll first).  Within that scope, I have a “message construct” shape where I’m constructing a new message of the flat file schema type. 

Within the assignment shape, I have the following code …

//instantiate message as null WorkforceFFResult_Out = null; //add map result message to input array SendInputMsgs.Add(WorkforceFF_Output); //call pipeline Microsoft.XLANGs.Pipeline.XLANGPipelineManager. ExecuteSendPipeline(typeof(Demo.Snd_Workforce_FF), SendInputMsgs, WorkforceFFResult_Out);

After this executes, the “WorkforceFFResult_Out” message is holding the contents of the raw delimited flat file that went through the pipeline processing.

You can probably guess what’s next.  Now I have to create the vendor-specific message.  First, I use a map to simply build up the message instance.  Then, I set the distinguished “payload” value using my helper class.

The “assignment” looks like this …

VendorTransfer_Output.Payload = Demo.Helper.FlatFileExtrator.ExtractText( WorkforceFFResult_Out);

Finally, I send the message out.  What does the resulting message look like?  Something like this …

So, hopefully you don’t run across this exact situation ever, but, if you do need to convert a message to a flat file and extract the text for additional processing, this pattern may help you out.

Technorati Tags:


Disclaimer

Entries and comments here do not necessarily reflect the opinions, attitudes, and statements of my employer, my friends, or anyone associated with me.

Syndication

Publications

Order my new book SOA Patterns with BizTalk Server 2009 (Amazon.com, Packt Publishing)

Contact Me

Categories

Twitter Feed

Blog Stats

  • 222,744