Make hidden properties accessible in SSIS Packages.

This is about a problem my colleagues and I researched several days until a solution was found.

The Problem:
For a big customer we are creating several solutions with large data transfers.
Despite the fact we are using Microsoft BizTalk Server as the main platform for our solutions we prefer SSIS (SQL Server Integration Services) for processing large data in projects (for obvious reasons).
This big customer has a bunch of SAP environments as well as some SAP Business Information Warehouse systems.
So we planned to extract “some data” from one of the SAP BW with a SSIS package using the Microsoft Connector for SAP BI which works pretty fine in general.
But there is one big pain with this component. Depending on the mode you choose, different properties appear which have to be set.
In my case it was the “SAP BW Source” Dataflow Component.
SAP_BW_Source_DataFlow

If you choose the mode “E – Extract” in design time you have to set the following values:
OHS destination and RequestID.

For the “OHS destination” you normally have a fixed value, but for the RequestID you will receive a value on runtime. So I can not hard-code the value in there.
The regular way to solve this in SSIS packages is to define an expression which sets the value on runtime depending on a variable.
But in this case Microsoft denied that. You can not set the value.

That makes the Microsoft Connector for SAP BI pretty unusable for me.

The Solution:
After some days of extensive search I figured out the following. There is a simple solution (which is def. not supported by Microsoft!) which enables you to make a “hidden” property available for expressions. You just have to open your package (which is an XML internally) as a text file (either in Visual Studio or any other text editor) and add/change the following value.
Navigate to the property you want to make “visible” (just search for it) in my case it is “RequestID” and add or change the attribute “expressionType” on the element to “Notify”.

SSIS_Property_ExpressionType 

 

 

Save the modified package and re-open it in the Visual Studio Package Designer.
Now go ahead and choose “Parameterize” from the context menu of the Data Flow task where the SAP BW Source Component resides in.
DataFlowTask

Choose the the newly visible property from the list on top and assign a new or already existing variable.

ParametrizeDataFlow

 

Press OK and you’re done!

That’s it. Normally your attribute changes are kept even if you do some other changes on the package. In case it got lost, just do it again.

Please feel free to leave a comment below about your ideas, thoughts, critics.

BizTalk Xslt and the nested looping problem with relational data.

Some days ago I had to implement a data transfer for a customer working this way:

A source system (e.g. SAP) provides provides invoices in a relational data fashioned style that looks like that:

InvoicesXml_Screen2
So I got two lists of entities. First all invoices (namely the invoice head) below the <Invoices> node and second all invoice positions for all invoices under the <InvoicePositions> node.

But in the target I had to deliver the data in that way:

InvoicesXml_Screen4

They want the invoice positions sub ordered below the invoice.

Initial Solution:
To achieve this I build up very quickly a BizTalk map with a custom xslt transformation. A very clean xslt which was working fine. Good.

But the problem…
with this solution was that I just did some small data tests initially. When starting tests with large real data transports my process got so damn slow that it became a “showstopper” at all.

What happened?
With larger sets of data the transformation got slower and slower because the iterations increased by every record dramatically. So if you are a software developer and loop two arrays to become all elements from the first array mapped to the second one you may very well know the problem. The invoices in the source side appear in a average ratio of 1:3 (Invoice : Positions). So for example you have 100 invoices and 300 invoice positions than your xsl processor has to perform 100 x 300 (30.000) rounds to loop all positions for all invoices. Well that sounds still “affordable”.
But lets go ahead increase the number of invoices a bit. Say 1000 invoices. Means: 1000 x 3000 (3.000.000) rounds to go.
In my case the maximum of set of data (full initial data transfer) was 325.000 x 895.000. Which means 290.875.000.000 rounds for mapping data. The transformation (map) run for a bit more than 4 days on my BizTalk server with a CPU usage of nearly 100%. => Total overkill

After some days of reflection I came up with the following…

Solution:
First of all I have to say that this solution is pragmatic and working safe and well but in my personal opinion it is not a very clean and straight xsl alike solution.
To solve my performance issues I created embedded custom code in the xslt template.
In my custom code I created the possibility to create in-memory lookup tables (dictionaries) which are of course pretty faster.
With the new template the transformation performed in nearly under 20 seconds!

Here is a sample of this xslt. Feel free to adopt or copy it.

Could not embed GitHub Gist 10ffeafcb98991eb66b6: Not Found

Any comments about this appreciated.

Review NRW Conf. 2013

Auch dieses Jahr möchte ich es nicht versäumen ein kurzes Review niederzuschreiben als Reflektion der Ereignisse auf der diesjährigen Community Konferenz NRWConf in Wuppertal.

Bevor ich zu meiner Bewertung komme möchte ich vorab noch einmal explizit den beiden Organisatoren der Konferenz Kostja (Konstantin Klein) und Lenny (Daniel Fisher) danken für Ihre Mühen diese grandiose Konferenz auf die Beine zu stellen und zu organisieren.

Und nun zu meinen Detailwertungen in den einzelnen Bereichen:

Anreise

Die Anreise fand wie die Jahre zuvor auch per Zug (ICE) statt und war mit knapp etwas über 5 Stunden von München aus eine “angenehme” Reise.
Mein Fazit: 9 von 10 Punkten

Ankunft & Hotel

Ankunft pünktlich und wie auch im Jahr zuvor im Arcade Hotel in der Innenstadt sehr zentral und unweit des Hbf. Das Hotel ist mit 3 Sternen m.A. unterbewertet. Sauber, freundlich, ruhig, super Frühstück.
Mein Fazit: 8 von 10 Punkten

Pre Conf. Evening & Speaker Dinner

Am Vorabend der Konferenz war auch in diesem Jahr für mich als Sprecher das Speaker Dinner eingeplant. Das auszeichnete Essen in gediegener Atmosphäre lies einen sehr bald alle “Reisestrapazen” vergessen. Nette Unterhaltungen rundeten den gelungenen Auftakt ab.
Mein Fazit: 9 von 10 Punkten

The Conference Day

Die Konferenz fing wie immer pünktlich und ohne großes “Brimborium” an und die ersten Tracks waren im nu am Laufen.
Die Verteilung der Tracks und das Lineup der Themen und Sprecher war dieses Jahr nahezu perfekt. Ich persönlich hatte (fast) keine Planungskonflikte von Sessions im selben Slot. Dickes Lob an das Orga-Team! Die Qualität der Vorträge die ich selbst besucht habe war ausnahmslos sehr gut und ich bin froh so viel Anregung erfahren zu haben.
Mein eigener Vortrag war nach einem verspäteten Start (Session vorher war leider um knapp 15 Min. überzogen) dann doch gut besucht mit sehr interessierten Teilnehmern.
Die angeregten Diskussionen und das super Feedback von vielen auch am Schluss waren eine Bestätigung für mich doch den “richtigen” Nerv getroffen zu haben mit meinem Thema: “Get in touch with Microsoft BizTalk Server”
Mein Fazit: 9 von 10 Punkten

Finales Abendessen

Wie auch die Jahre zuvor fand der Ausklang mit vielen Sprechern und Teilnehmern im Cafe Island statt. Ein Location die sich einfach bewährt hat durch ihr grandioses Ambiente, das ausserordentlich gute Essen und die kühlen Getränke.
Mein Fazit: 10 von 10 Punkten

Overall Fazit
Auch diese NRW Conf. 2013 war jede Sekunde und jeden Euro wert!
Sie ist und bleibt das Konferenz Highlight unter den Community Konferenzen.
Nächstes Jahr steht das 10-jährige Bestehen der Konferenz an und ich freue mich schon heute drauf nächstes Jahr wieder dabei sein zu können.

BizTalk and the DTD validation (pain) of messages.

Some days ago I implemented web harvesting functionality for a customer working this way:

A business analysts places a request (trigger) file with some meta data on a network folder and BizTalk catches it up, performs a http post (HTTP Adapter) containing the meta data from the request file.
Easily achieved with the great RawString class from Microsoft.
The result of the post is a html which I caught up with a multi-part message with one body part of type XmlDocument.
Using RawString as type for the result body part as well would only work in case you have a pipeline which sets the message type to RawString in the message context.
Otherwise you receive some error like “Type “” of message is unknown…”

But using XmlDocument isn’t that nice at all too. When you try to access the XmlDocument in the orchestration it is “just in time” parsed and the XmlReader will perform a DTD validation because of the html root element. So it tries to download the DTD from “http://www.w3.org/1999/xhtml” and maybe fails because there is a firewall blocking this.
A web request timeout error message will appear in the log.

So you have the option to strip off the html root element in a custom pipeline (which I didn’t want to do) or you can extend the nice RawString class by a further constructor accepting a XLANGMessage as parameter. The code looks like this:

public RawString(XLANGMessage message, int bodyPartIndex)
{
    if (message == null)
        throw new ArgumentNullException("message");

    using (var stream = (Stream)message[bodyPartIndex].RetrieveAs(typeof(Stream)))
    {
        using (var sr = new StreamReader(stream, true))
        {
            internalRepresentation = sr.ReadToEnd();
        }
    }
}

You can use it in this way in order to get your html from the result message. Afterwards you can easily access the html as string directly or maybe send it to a file.

BizTalk_dtd_validation_pain_screen_1

BizTalk_dtd_validation_pain_screen_2

BizTalk_dtd_validation_pain_screen_3

 If that helps feel free to leave a comment below….

BizTalk and the UTC time problems…

Recently I stumbled upon a problem hat has definitely touched me so many times in the last years before, that I decided to write this little blog post about it.

Problem:
You extract a value of type xs:date from a BizTalk message and use it for further processing e.g. calling a web service, query a database or something else.
But the date changed. In my case I got a request message with a valuation date of “2013-09-01”.
After extracting the date from the message in an orchestration shape and assigning it to a variable of type System.DateTime I recognized that the value seem to be changed.
I see the value “2013-08-31”. 

Reason:
Of course it did not. Just the “representation” changed.
BizTalk internally works with UTC. So what appears is the UTC representation of the date-time value.
In my case (GMT+1) the date time value appears as “2013-08-31 23:00:00”

Solution:
Just perform the .ToLocalTime() function on the date you extracted from the message. And than you are fine. (normally)

ToLocalTime_Screen2

 

Furthermore I deeply recommend the blog post “DateTime considerations for BizTalk” by Michael Stephenson.

 

 

Sprecher auf der NRW Conf 2013

Die NRW Conf ist zu Recht auch dieses Jahr wieder das Konferenz-Highlight für mich.
Toll dort wieder als Sprecher eingeladen zu sein, mit fantastischen Leuten aus der Community zu sprechen und das eine oder andere “Nerd-Talk” Bier zu schlürfen.

Das Thema  meines Vortrags dieses Jahr:

“Get in touch with Microsoft BizTalk Server”

Vom Microsoft BizTalk Server haben die meisten schon gehört, aber was er genau macht und kann wissen doch die wenigsten. Dieser Talk “macht Schluss damit” und gibt einen kompletten Einblick in Microsoft BizTalk Server in nur 1 Stunde (ohne jegliches Vorwissen!). Das Produkt kann in einer Demo “hautnah” erlebt werden und es werden gängige Szenarien aus der Praxis gezeigt und erläutert.

See you there!

NRWConf 2013

 

 

Bilder von meiner Session:

JustCom2013_322-2 JustCom2013_325-2

Sprecher auf dem .NET Day Franken 2013

Nachdem mein Haupt als neues Titelbild die Webseite des .NET Day Franken schmückt war ich um so mehr stolz zum dritten mal in Folge dort als Sprecher eingeladen zu sein.
Dieses Jahr vom Community Orga Team in etwas veränderter Aufstellung aber rein vom Erfolg her alles beim Alten. Das Wetter war wie immer blendend so das die Pausen im Innenhof eine immer willkommene Abwechslung boten. Die Verpflegung war, wie auch die  Jahr schon zuvor, im NH Hotel für eine Community Konferenz mal wieder das absolute Ultimo. Die Location hat sich in den Jahren einfach bewährt und ich hoffe das bleibt auch die nächsten Jahre so.

Das Thema meines Vortrags in diesem Jahr war: „PLINQ Extreme“ – Paralleles LINQ voll auskosten

Die Slides zur Session findet ihr hier. Bilder gibt es natürlich auch zu sehen. Videos von den Vorträgen sind in Arbeit!

Vielen Dank auch nochmal an das Orga Team für diesen tollen Event.

Sprecher auf der NRW Conf 2012

Die NRW Conf ist eigtl. immer “DAS” Konferenz-Highlight für mich jedes Jahr, um so schöner dieses Jahr als Sprecher dort zu sein. Ich freue mich schon über einen regen Community Austausch mit vielen Leuten und auf ein paar lockere Nerd-Talks bei einem Bier mit dem einen oder anderen 😉

Das Thema  meines Vortrags:

“Einführung in die Kryptographie – Praktisches für den .NET Entwickleralltag”

“Die Kryptographie spielt in vielen Bereichen der modernen Softwareentwicklung eine wichtige Rolle. Da es dort meist um sensible und sicherheitskritische Themen geht, ist es umso wichtiger als Softwareentwickler die Techniken und Hintergründe zu kennen die eingesetzt werden. In diesem Talk werden “alltägliche” kryptographische Szenarien und Problemstellungen näher beleuchtet und der Referent geht darauf ein wie diese Problemstellungen mit heutigen Techniken gelöst und mögliche Stolperfallen umgangen werden können. Dies alles erfolgt anhand von praktischen Code-Beispielen und bereits bestehenden Frameworks und Libraries.

See you there!

 

.NET Day Franken 2012

Sprecher auf dem .NET Day Franken 2012

Ich freue mich sehr als Sprecher für den .NET Day Franken 2012 ausgewählt worden zu sein.
Der .NET Day Franken 2011 war schon ein Highlight für mich wie man hier nachlesen kann und umso mehr freue ich mich dieses Jahr wieder dort zu sein.

Mein Thema dieses Jahr ist “TPL Deep Dive”. Ich werde zeigen wie die Task Parallel Library im Alltag eingesetzt werden kann anhand vieler Beispiele.

Ich freue mich schon auf viele interessante Vorträge, Gespräche und Zusammentreffen mit anderen Entwicklern.

See you there!