BizTalk: Mapping: Script functoid: Type of the Input and output parameters

Rule of thumb:
In the "Script Functoids – Inline C#" use only string types as the input and output parameters.
How it works:
If the C# method in the Script Functoids – Inline C#  has non-string parameter, it will be converted to the string on the "border" of this functoid!
Take in mind that the "real" type for Xml elements is "string", no matter how it was defined in the Schema. Xml only mimics the other types.
The Xml holds the values serialized to string and vice versa.
In our case the string "1" is desiarilazed to int 1.
Example:
          Script Functoids – Inline C#:   string MyMethod (int param1) { … }
Xml element: <Element1>55</Element1> ==>
The result will be like this: int param1 = (int)"1";  MyMethod(param1);
In this place can be problems!
If we had <Element1>55</Element1>, we have no problems.
But we can have also:
 <Element1>ABC</Element1>
 
or <Element1></Element1>
 
or <Element1/>
 or node = null (that means there is not this node in the Xml document instance at all.
Those cases give us an exception:
"Exception: Error encountered while executing the transform MyProject.MyMap.
Error:Transformation failed..: System.Xml.Xsl.XsltException: Function
'ScriptNS0:MyMethod()' has failed. —> System.ArgumentException : Cannot
widen from target type to primitive type."
We don't need this result. The exceptions in the map are unwelcome!
Rule of thumb:
Use ONLY string types for input parameters in the "Script Functoids – Inline C#".
If we HAVE TO work with non-string types, move the type-conversion INSIDE the method. It prevents these exceptions. We could handle the type errors.
string MyMethod (string param1)
{
string returnValue = "0";
 if (param1 ==  null || param1 == "") return returnValue;
 try
{ // if we need to work with param1 as int!
 int param1_int;
 param1_int = Convert.ToInt32(param1);
}
catch(InvalidCastException ex) // to process the cases with "nonInt" param1:
{…}

Understanding persistence points

I found this post from Richard Seroter’s blog on persistence points interesting. The post deals with the basics in persistence points and how to tweak them to get a resumed orchestration to resume at an expected step. Not understanding persistence point and not thinking about them when planing and building an orchestration might cause some strange […]

Bought myself an O2 Atom Exec

I finally bought myself an O2 Atom Exec (mobile phone), that I've been waiting long to lay my hands on.

Guess I will be busy, the next couple of days checking out all the features and gazing at it :).

Check out the review here:

http://www.mydigitallife.info/2006/08/12/o2-xda-atom-exec-reviews/

 

 

Regards
Benny Mathew
Seamless Integration Solutions
BizTalk Consulting, Development, Training
http://www.seamless.in

Controlling persistence points to your advantage.

Here is an interesting post on Richard Seroter's blog on persistence points.
If you plan to have a business process integration that could be interrupted and resumed due to external factors, then knowing about persistance points is very useful and important for the correct functioning of your BizTalk application.

 

Check it out here

http://seroter.wordpress.com/2007/01/02/orchestration-handling-of-suspended-messages/

 

 

Regards
Benny Mathew
Seamless Integration Solutions
BizTalk Consulting, Development, Training
http://www.seamless.in

Commerce Server 2007: B2B E-Commerce is Easy!

Now that I've got your attention, let me qualify this somewhat by stating that developing a B2B (business-to-business) e-commerce web application is both easier and less costly than developing a B2C (business-to-consumer) web application. This is especially true when your application platform is SQL Server 2005, BizTalk Server 2006 and Commerce Server 2007!

Take for example the hardware and software requirements. In a B2C scenario, you need to size your hardware for a much larger potential peak load. Remember Amazon.com's first holiday season? You just never know for sure how many "consumers" will hit your site at the same time. Most (if not all) businesses that sell to other businesses already know who their customers are and the numbers range from a few hundred to a few thousand. Purchasing servers to support a few hundred concurrent users (peek load) is much easier and less expensive. Since most businesses will accept orders in a variety of formats (snail-mail, telephone, fax, email and over the web), true 24 x 7 x 365 site availability (and the redundant hardware / software it requires) may not be absolutely necessary, at least not at first. This doesn't mean that you shouldn't buy the best hardware you can afford. It means that generally, this hardware doesn't have to cost tens of thousands of dollars.

The software costs go right along with the hardware costs. Most medium size businesses can get started in B2B e-commerce by purchasing the "Standard Editions" of SQL Server 2005 (retail: $5,999 per processor), BizTalk Server 2006 (retail: $8,499 per processor) and Commerce Server 2007 (retail: $6,999 per processor), although I always recommend looking closely at Microsoft's volume license agreements to save some money. Developer licenses of all three products are also very inexpensive, so the barrier to get started is very low.

Development costs are also very reasonable and most medium size businesses with a few knowledgeable .NET developers can put together a B2B web application in a few months. We did our entire e-commerce project with two developers in only four months and we neither of us worked exclusively on the project. It really doesn't take a rocket scientist (I humbly apologize to my friends at NASA) to learn to use SQL Server, BizTalk Server and Commerce Server. All three products are designed to work together seamlessly to provide a robust application development platform (see, I really wasn't asleep during the keynote at TechEd) and all the developer needs to do is write the code that brings everything together!

Over the next several months, I'll be presenting a new series of posts aimed specifically at how to write a B2B e-commerce application using SQL Server 2005, BizTalk Server 2006 and Commerce Server 2007. I'll start at the beginning (planning your architecture) and then move through the development process step by step. I'll be presenting code samples within each post (which can also be downloaded as a zip file) so that you can try things out for yourself. I'll be linking to many blogs from the BizTalk and Commerce Server communities as well as to some excellent MSFT white papers recently released.

As always, ping me via this blog with your questions and comments. I'll try my best to get back to you with answers as quickly as possible.

Technorati Tags: SQL Server, BizTalk Server, Commerce Server

Share this post: Email it! | bookmark it! | digg it! | reddit!| kick it!

VSTS Guru recognised – Anthony Borton gets his MVP!

A great buddy of mine gives blood, sweat and (I’m sure) tears to helping the community
getting stuck into in VSTS.

Anthony has run breakfasts in Brisbane and
Sydney, seminars, labs etc…all in his own time and for the love of it.

It’s great to see such an expert who is passionate and has now been rewarded from
Microsoft by being awarded a MVP

Anthony works with Breeze Training
to offer a comprehensive VSTS Workshop. He
constantly is refining/updating the workshop to reflect the latest updates and additions
capable within a VSTS based solution. (I’m sure he sleeps at some point)



Well done AB!!!! Keep up the good work.