Thursday, September 6, 2012

BizTalk Scripting Functiods with Same Name Methods


So a coworker had this happen to him today, and I thought it was interesting enough to share.

Create a BizTalk map with two different C# scripting functoids, both with the same method name and input parameters, like this:

System.String GetMe(System.String input)
{
return System.String.Format("Test 1: {0}", input);
}

System.String GetMe(System.String input)
{
return System.String.Format("Test 2: {0}", input);
}

Now link them to and from some placeholder xml schemas. I won't bother detailing the boiler-plate code for that here, if you know BizTalk I'm assuming you can link two schemas using a map.

You won't get an error, but the map won't function as expected: VS/BizTalk never catches the fact that there is an invalid overloaded method in the code attached to the map. What will happen is BizTalk will execute the first valid method it finds (in this case, 'Test 1' will probably appear in both outputs).

Hopefully this will help some figure out the cause of their strange map behavior!

No comments:

Post a Comment