Follow-up on Enabling BizTalk Unit Testing for Schemas and Maps

This is a follow up to my post yesterday.  I was setting up some automated unit tests for BizTalk 2009 in Release mode.  I received the following errors. 

CIDemo.Schemas.InputSchema does not contain a definition for ‘ValidateInstance’ and no extension method ‘ValidateInstance’ accepting a first argument of type ‘CIDemo.Schemas.InputSchema’ could be found (are you missing a using directive or an assembly reference?)

CIDemo.Maps.Input_To_Output does not contain a definition for ‘TestMap’ and no extension method ‘TestMap’ accepting a first argument of type ‘CIDemo.Maps.Input_To_Output’ could be found (are you missing a using directive or an assembly reference?)

CIDemo.Maps.Input_To_Output does not contain a definition for ‘ValidateOutput’ and no extension method ‘ValidateOutput’ accepting a first argument of type ‘CIDemo.Maps.Input_To_Output’ could be found (are you missing a using directive or an assembly reference?)

This is because the value under Unit Testing: Enable Unit Testing are Configuration Specific as seen below.  The default is False.  So moving to Release mode reset the values.

I also noticed the Application Name is Configuration specific as well. 

Just something to keep in mind when changing configurations in BizTalk 2009.

BizTalk 2009 Book and ESB Guidance

Some of you might be familiar with George Dunphy’s “Pro BizTalk 2006” book that was released a couple of years ago through APress. Well, he’s getting set to release a new one for BizTalk 2009 and I was very excited when he asked if I would be a contributing author. I’ve been given the task of writing a chapter about the ESB Guidance 2.0 for BizTalk 2009. There are a number of very smart and experienced guys contributing to the book, so if you’re looking for a good BizTalk 2009 book, I’d recommend this one… (and of course I’m not biased 😉 )

http://www.amazon.com/Pro-BizTalk-2009-George-Dunphy/dp/1430219815/ref=sr_1_1?ie=UTF8&s=books&qid=1239727570&sr=8-1

Cheers and keep on BizTalking

Demos from DevWeek 2009 (WF Context, WF 4 Activities, and WCF 4 features)

Demos from DevWeek 2009 (WF Context, WF 4 Activities, and WCF 4 features)

A little delayed, to be sure, but here are the demos from my three talks at Dev Week this year.  Thanks for all who attended.  I’ll be giving an updated version of the custom activities talk at DevDays2009 in the Netherlands at the end of May, hopefully with newer bits! 

 

  • Context Management in WF services (including REST service with URI context)
  • WF 4 Custom Activities
  • Declarative Services in .NET 4
    • Declarative service with message correlation
    • Routing Service sample

ValidateInstance Not Found When Setting Up BizTalk 2009 Unit Tests

Today I was setting up Unit Tests for BizTalk 2009 Schema and Maps.  I was using the BizTalk Server 2009 help guide example as a reference. 

I ran into the following error message:

<Class Name> does not contain a definition for ‘ValidateInstance’ and no extension method ‘ValidateInstance’ accepting a first argument of type <Class Name> could be found (are you missing a using directive or an assembly reference?

This looked like this inside Visual Studios 2008:

 

This was caused by the referenced Schema project not being marked to Enable Unit Testing.  This setting can be found under the Product Properties.

Just simply change this to true, rebuild the Schema and Maps Projects, and the Unit Test methods should now be able to find the ValidateInstance or other missing methods method.

When Unit Testing BizTalk 2009 Map projects, the ValidateOutput method may not be found.  While I did not have problems with creating mapping unit test the solution would be the same.

Enjoy.

Promoting reoccurring elements – Part II

Hi all

I had a post about promoting
reoccurring elements
in BizTalk. As we all know, this isn’t possible. BUT actually
well 🙂

Basically, you promote properties for three reasons:

  1. You need it to route based on the value
  2. You need it for correlation (which is basically just a specialization of routing)
  3. You need to either read or set the value inside an orchestration (Don’t do that! Use
    distinguished fields instead)

So, dealing with number 1, routing, I started thinking back at BizTalk 2002, which
was my first BizTalk experience (I’l bet ALL BizTalk developers/architects think of
BizTalk 2000/2002 every now and then no? 🙂 ). I seemed to recall that you could
do something fancy with routing back then, so I fired up an old BizTalk 2002 on windows
2000 Professional to test it. It turns out, that on a channel you can enter a filter
which is an XPath expression. The text field is editable, so you can change the XPath
expression all you want – it will complain if you try to leave it with an invalid
XPath expression (syntactically – not semantically).

Given this XML:

<MyRoot>

  <myReoccuringRecord Myfield="42" /> 

  <myReoccuringRecord Myfield="2" />

  <MySecondRecord MySecondField="jan" /> 

  <MyThirdRecord>

    <MyThirdField>1</MyThirdField> 

  </MyThirdRecord>

</MyRoot>

I can have a channel with this filter:

  • /*[local-name()=’MyRoot’ and namespace-uri()=”]/*[local-name()=’myReoccuringRecord’
    and namespace-uri()=”][position()=1 and @Myfield = 42]

Basically, documents will only go through this channel, if the value of the “Myfield”
attribute of the first “myReoccuringRecord” element has the value 42.

So, it isn’t promoting as such – BizTalk 2002 doesn’t have this concept, but it
allows us to route based on the value of a specific occurrence  of a reoccurring
element
.

On a side note; If you leave the filter like this:

  • /*[local-name()=’MyRoot’ and namespace-uri()=”]/*[local-name()=’myReoccuringRecord’
    and namespace-uri()=”][@Myfield = 42]

it will accept the incoming document no matter what the position of the “myReoccuringReord”
is. Can’t make up my mind if this is a good thing or not 🙂

Now, as we all know (?), manually editing the XSD in BizTalk 2006 solution to make
sure the XPath evaluation will only return a single XmlNode doesn’t work. You either
get a compile time error:

  • The promoted property field or one of its parents has Max Occurs greater than 1. Only
    nodes that are guaranteed to be unique can be promoted as property fields.

or you get a runtime error:

  • There was a failure executing the receive pipeline: "Microsoft.BizTalk.DefaultPipelines.XMLReceive,
    Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Source: "XML disassembler" Receive Port: "ReceivePort3" URI: "C:\Projects\Blog
    Entries\PrommotingReoccurringElementsEditXSD\Instances\In\*.xml" Reason: Unexpected
    XPath format:

Anyway not that many BizTalk 2000/2002 installations till in production, I assume,
so this post is merely for informational purposes. It’s just funny discovering functionality
that is doable in earlier versions of BizTalk and not in the latest versions.



eliasen

Wishes for the next version of BizTalk

Hi all

Well, the time has once again come for a “If I had all the money in the world to pay
to the BizTalk development team and I could decide what to put into the next version
of BizTalk, this would be it”-list 🙂 There are a couple of items that I have stolen
from http://blog.eliasen.dk/2007/10/06/BizTalkVNextWishlist.aspx.

  1. Orchestration debugging should be easier. I really hate that I have to deploy my orchestration,
    throw a message through it just to get an instance in HAT that I an set breakpoints
    on and then have to throw another message trough the orchestration to debug it.
  2. No more pipelines. Why no let the developer have an inline pipeline designer in a
    receive location and a send port? this way I don’t have to build custom pipelines
    – I can just chose pipeline components right on the receive locations and send ports.
  3. For development purposes, it would be really nice to be able to right click a receive
    location that is disabled and choose "Execute". If for instance I have a
    SQL adapter receive location that is supposed to poll every minute, then I don’t want
    to have to quickly disable the receive location once it has been fired. I want to
    keep it disabled, so data wont go through my system when I am not ready, and then
    just execute it whenever I am ready.
  4. Restart Host Instances only once. Right now, if I deploy my solution from VS.NET,
    and this solution has 10 projects that are all set to "Restart Host Instances"
    on deployment, then the host instances will get restarted 10 times. Would be nice
    if VS.NET could figure this out and only do it once.
  5. Specify the node that is body, when using enveloping and not just the parent. It makes
    great sense, that I can specify a node and all child elements are then submitted as
    separate messages from the receive pipeline. This is how we can receive orders, invoices,
    etc. in the same XML. BUT, if I receive XML where I only need the Orders, then I would
    like to point at the Orders element so that is all I get. Right now I have to use
    standard enveloping, and implement logic to just delete the invoices, etc. Not really
    nice, I think.
  6. Better modeling tools for business processes. The last Gartners quadrant I saw on
    BMPS didn’t have Microsoft mentioned at all. Would be great with some formal cooperation
    with IDScheers Aris product or the like. Something like simulating your business process
    with different values in rules would be just great
  7. Promoting via XPath. Please let me specify the XPath for some element that I want
    promoted in the disassembler components. If I know of an XPath that guarantees that
    only one value is in the result set og evaluating that XPath, then let me use it instead
    of forcing me to not promote anything that can occur multiple times. I am aware that
    with the current limitation, BizTalk is helping developers to not make mistakes, but
    hy not give us the opportunity and then suspend the message if the developer was wrong
    and multiple elements are in the resulting node list after evaluating the XPath expression?
  8. It would be nice if we could expose a web service without having to require a parameter.
    If I want to expose an orchestration that builds an inventory XML hat customers can
    request, I really don’t need a parameter to do that. Some workaround would be nice.



eliasen

Speaking on Windows Azure at VSLive! Las Vegas in June

Speaking on Windows Azure at VSLive! Las Vegas in June

Just a quick note to let everyone know that I’ll be speaking at VSLive! Las Vegas on June 10-11 on Windows Azure and Dublin.  Join me at the Venetian where I’ll be doing a general overview session on cloud computing and Windows Azure on 6/10 in the morning, followed by a breakout session on the Windows Application Server extensions code-named “Dublin”. Then on Thurs 6/11 I’ll be doing a full-day workshop on programming the Azure Services Platform including Windows Azure, .NET Services, SQL Services and Live Services. Here’s my breakdown for the show:

  • Windows Azure: A New Era of Cloud Computing, 8:30 a.m.-9:45 a.m., Wednesday, June 10
  • Codename “Dublin”: Windows Application Server, 10:00 a.m.-11:15 a.m., Wednesday, June 10
  • Workshop: A Day of Windows Azure, 9:00 a.m.-6:00 p.m.,Thursday, June 11

SPECIAL PRICING: Any blog reader who registers using this code (S9V19) will receive the all-access Passport Package for just $1,295, a savings of $400.00 off the standard price of $1,695.  Just click here to get started.

You can follow this VSLive on Twitter at http://twitter.com/VSLive.