Things hard and not so hard.... RSS 2.0
# Tuesday, January 23, 2007

While working on a BTS 2006 solution - I decided to use the SQL Adapter to call a stored Proc to update data.

While the SQL Adapter wizard is OK, there's no real reason to use it. I usually delete everything it creates, apart from the Schema for namespace samples. The Namespaces you specify through the wizard is there mainly for the SQL Adapter to figure out where the bits are for it to process, and where return results should be inserted into......

In alot of solutions I build, I usually have a single generic SQL Update Orchestration, not an Orch, Schema + Port for each type of SQL action required.

The trick to all this is how the SQL Adapter handles the messages sent to it. More details is found in the SQLXML documentation.

The paper back version:

Let's say I have two tables and a Stored Proc that I want to use within the SAME DB (if I want to talk to different DB's then we'd need to create a separate message for the different DB's to update due to the fact that the physical SQL Port (whether it be 'dynamic' or physical) e.g. SQL://ServerName/DB.......

Table A: PacMan Players
Fields -
Name, email

Table B: PacMan Scores
Fields - email, score

Stored Proc: UpdateScores
Params:
email, score, gametime

If these three were in the same DB here's the message(s) that you'd need to send to the SQL Adapter (could even be via CBR and not ALWAYS an Orch).

e.g. a sample message for stored procs.
<sqlRequest xmlns='http://micksdemos.sql'>
     <Updates>
            <UpdateScores email='jackiechan@j.com' score='54' gametime='1200' />
            <AnotherStoredProc p1='2' p2='aaa' p3='....' />
      </Updates>
      <Results>
                     <!-- **** Set to be ANY element here, with 'skip' processing set via the schema **** -->
      </Results>
</sqlResults>

e.g. a sample message for tables (further details on this message structure can be obtained from SQLXML Documents)
<sqlRequest xmlns='http://micksdemos.sql'>   
      <sync>
             <after>
                  <PacManScores email='jackiechan@j.com' score='22000' />
                  <PacManPlayers Name='mick' email='mick@b.com'  />
                  ...
             </after>
      </sync>
</sqlResults>

Now the interesting thing upon the results being returned for the called Stored Procs
We sent down batches of 400 updates to be performed via the stored proc method, and the results were supprising!!!!

We got a message back via one of the several Two-Way SQL Ports defined (each talking to a different database, being activated via CBR)

The return results was a Multi-part message with 400 parts!!!!!! In this case I was waiting for the return message within an Orchestration and then carrying on (mainly for BAM purposes to capture timings, average call times etc)

Do you know how hard it was to find an appropriate message type?????? If I made a multi-part message type with 5 parts it's not 400. If I made one with 400 parts (each part was a type of ANY) then I'm sure we'd have a batch in the future with 401 updates...boom! blows up.

So my challenge was to find the appropriate message type for this return message.....needless to say "I'm still looking"
I tried
(1) XLANGMessage - not serializable and bts wont compile in the IDE. This is the most logical cause then I could just go through the parts grabbing each result message.
(2) XLANGPart - long shot, individual part of a message, but also if a Message if declared as ANY type then this is the .NET Message Type that represents it behind the scenes.
(3) ANY - Compiled and run, error when the results message is returned, as the ANY type is still dealing with a single part message
(4) XMLDocument - yeah right! Sort of the one that you cover your eyes, run the test and peep through your fingers looking at the screen to see if it worked....or more like *hoped' it worked :)

Solution: Create a simple Custom Pipeline Component to Consolidate the Return parts
The Orchestration is fine to go on continuing processing.
The thing that stumped me is that I send in a Batch within a Single XML Document, why dont I get that as a response??

I could imagine when sending a single update this problem never occurs. (and it hasnt in the past)

Here's the custom pipeline component - this one's in VB.NET as per the client's coding standards on this.
(I use the VirtualStream found in the SDK)
- this is not production ready code. Further stress testing needed.

Here's a snippet showing the execute method (BTSHelper.VirtualStream - is the VirtualStream class from the BTS 2006 SDK)

#Region "IComponent Members"
Public Function Execute(ByVal pContext As IPipelineContext, ByVal pInMsg As IBaseMessage) As _
IBaseMessage Implements IComponent.Execute

Try
                   Dim msgReturn As IBaseMessage = InternalMyExecute(pContext, pInMsg)
                   Return (msgReturn)
Catch ex As Exception
                   Throw ex
End Try         

End Function

Private Function InternalMyExecute(ByVal pc As IPipelineContext, ByVal inMsg As IBaseMessage) As IBaseMessage
         Dim outMsg As IBaseMessage = Nothing
         Dim outPt As IBaseMessagePart = Nothing
         Dim outStream As BTSHelper.VirtualStream = Nothing
         Dim sw As StreamWriter = Nothing
         Try
               If (inMsg.PartCount > 1) Then 'combine all the parts into one - painful return results from SQL.
                          outMsg = pc.GetMessageFactory().CreateMessage()
                          outMsg.Context = inMsg.Context
                          outPt = pc.GetMessageFactory().CreateMessagePart()
                          outStream = New BTSHelper.VirtualStream()
                          sw = New StreamWriter(outStream)
                          sw.Write("<{0}>", _documentRootElement)
                          For i As Integer = 0 To inMsg.PartCount - 1
                                        Dim sptName As String = String.Empty
                                        Dim s As String = GetMessagePartAsString(inMsg.GetPartByIndex(i, sptName))
                                        sw.Write(s)
                          Next
                          sw.Write("</{0}>", _documentRootElement)
                          sw.Flush()
                          ' we DONT want to close the stream i.e. sw.close()
                          outStream.Seek(0, SeekOrigin.Begin)
                          outPt.Data = outStream
                          outMsg.AddPart("Body", outPt, True)
                          Return (outMsg)
                  Else 'single part
                         Return (inMsg)
                  End If
          Catch ex As Exception
                  inMsg.SetErrorInfo(ex) ' the inMessage is the one that gets reported on in BizTalk within the pipeline
                  EventLog.WriteEntry(_EVENTLOG_SOURCE, "SQL Combiner Exception Internal Execute- "          
                          + ControlChars.CrLf + ControlChars.CrLf + ex.Message, EventLogEntryType.Error)
                  Throw ex
          Finally

          End Try
End Function

Private Function GetMessagePartAsString(ByVal pt As IBaseMessagePart) As String
                 Dim xdoc As XmlDocument = Nothing
           Try
                       xdoc.Load(pt.GetOriginalDataStream())
                       Return (xdoc.DocumentElement.OuterXml)
           Catch ex As Exception
                       Throw ex
           Finally
                       xdoc = Nothing
                       GC.Collect()
           End Try
End Function

Public Sub CopyStream(ByVal src As Stream, ByVal dst As Stream)
            Try
                  If (src.CanSeek) Then
                            src.Seek(0, SeekOrigin.Begin)
                  End If
                  Dim DATA_BLOCK As Integer = 4096
                  Dim bytesRead As Integer = 0
                  Dim buff(DATA_BLOCK - 1) As Byte

                  bytesRead = src.Read(buff, 0, DATA_BLOCK)
                  While (bytesRead > 0)
                           dst.Write(buff, 0, bytesRead)
                           bytesRead = src.Read(buff, 0, DATA_BLOCK)
                  End While
            Catch ex As Exception
                  Throw ex
            End Try
End Sub

Private Sub CopyMessageParts(ByVal sourceMessage As IBaseMessage, ByVal destinationMessage As IBaseMessage, ByVal newBodyPart As IBaseMessagePart)

                 Dim bodyPartName As String = sourceMessage.BodyPartName

                 For i As Integer = 0 To sourceMessage.PartCount - 1
                              Dim partName As String = Nothing
                              Dim messagePart As IBaseMessagePart = sourceMessage.GetPartByIndex(i, partName)
                              If (partName <> bodyPartName) Then
                                            destinationMessage.AddPart(partName, messagePart, False)
                              Else
                                            destinationMessage.AddPart(bodyPartName, newBodyPart, True)
                              End If
                 Next
End Sub
#End Region

Grab the code from below - This sample is aimed to be something to look and discover from rather than be a 'ready made installable package'

SqlCombiner.zip (9.63 KB)
Tuesday, January 23, 2007 11:57:07 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [2] -
.NET Developer | BizTalk | Tips

If you think of this as a proxy server for RDP Clients then that works. It can also sit behind an ISA 2006 server.

You need the latest RDP 6.0 client.

Download it from Microsoft here. Read the KB article here (which includes links to versions for OSes other than 32-bit XP, as well). smile_teeth

Tuesday, January 23, 2007 10:42:41 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0] -
Other | Tips
# Monday, January 22, 2007

I recently came across this great article that covers:

  • Microsoft's internal BizTalk 04 - 06 upgrade
  • discusses biztalk 32-bit vs 64-bit performance gains

Grab it here - http://www.microsoft.com/technet/itshowcase/content/biztlk06upgtwp.mspx
(dont forget to grab the 'technical whitepaper' download on the RHS)

Here's a snippet from the document

-----------------------
Each of the 32-bit servers that ran BizTalk Server 2004 had a total processing power of 19,661 MIPS. Generally, the e*BIS group did not experience any performance or reliability issues with its BizTalk Server 2004 configuration. The 32-bit servers provided a robust and reliable platform upon which to run BizTalk Server 2004. One of the limitations that the group thought might affect its BizTalk Server environment is that in a 32-bit environment, a single process cannot consume more than 1.5 gigabytes (GB) of RAM. This limitation could cause problems in the future, as BizTalk Server hosts consume and process an increasing number of transactions within the same CPU cycle. This limitation does not exist in a 64-bit computing environment. Therefore, the group expected to achieve better throughput and better performance by running BizTalk Server 2006 on a 64-bit server. Because of the support for 64-bit computing that is included with BizTalk Server 2006, the group determined that it could not only consolidate all of its business feeds into a single BizTalk Server 2006 environment but also greatly reduce the overall number of servers in that environment.

------------------------

Monday, January 22, 2007 9:39:42 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0] -
BizTalk | Insights | Office | Tips
# Tuesday, January 16, 2007

After upgrading a BTS 2006 B1 R2 vpc image to Win2003 R2 all was not good.

Services were not starting and erroring all over the place (worked fine before Win2003 R2) and they seemed to be centered around SQL.

So I thought I'd 're-apply' SQL 2005 SP1....and this fixed some of the problems....others still remained.

I was getting "Event ID 7000: Sql Server Integration Services did not start or respond to a control message in a timely fashion"

(I was also getting this with Analysis Services)

After much research here's the circumstances that cause the problem:

(1) machine running sql is not directly connect to the internet (data centers etc.) SSIS wants to go out to the internet to check the status of a certificate or two (crl.microsoft.com...) when it starts up.

(2) SQL 2005 SP1 applied.

Solution: There are alternatives but my good buddy AB came up trumps with Some SQL Hotfixes to apply 

(at the bottom of his article)

I'm on the road at the moment and when looking at the post SP1 SQL Hotfixes - the first one of a SQL Server 'hotfix' of 25MB scared my and my GPRS phone off :)

Thanks AB.

Direct link to HOTFIX HERE

Tuesday, January 16, 2007 3:17:04 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0] -
BizTalk
# Thursday, January 11, 2007

I've been doing those 'getting round to it' things over the break and I had an interesting couple of questions with this exam.
I'm in the (never ending) process of updating my qualification to MCSD.NET 2.0...TS

The exam http://www.microsoft.com/learning/exams/70-553.mspx was pretty hard - 4 hours, 3 sections of around 30 questions each. Testing Web, Winforms and 'all other'.

A got a great question which went something like....
You drop an ASP.NET 2.0 Membership Control on to a web page....

The only problem with this question is - that there is NO ASP.NET 2.0 Membership control within normal ASP.NET 2.0. (not sure on 3.0)
There are however Membership Providers but no Membership Controls.

I did a quick search and bingo! Here's the control which I think was being referenced in the question
ASP.NET 2.0 Membership Control

Talk about upping the ante on exams :-)

Off to do some more.... :)

 

Thursday, January 11, 2007 2:05:41 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [3] -
Training
# Monday, January 08, 2007

Lee Graber (the man behind all things SQL and LOTS of other areas within Biztalk) has posted some great tips around the BTS Message box - interacting with and what's 'changeable'.

Check it out - thanks Lee (one for the bookmarks folks)

Monday, January 08, 2007 3:51:12 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0] -
BizTalk | Insights
# Saturday, January 06, 2007

I thought I'd share this festive season laugh being Christmas and all.

For the home I bought a set of Solar Powered Christmas Lights. I returned home with my purchase and instantly got huge points with all and sundry (so I might, just might be in the positives now)

I hung them up around the yard and discovered.....
the problem about these lights......think about it....solar powered lights (usually come on at night).

Let me just say that there's not one Christmas photo with these lights ON......so much for the points...easy come...easy go :-)
Saturday, January 06, 2007 11:05:38 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0] -
Other
# Friday, January 05, 2007

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.
Friday, January 05, 2007 10:46:28 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0] -
Other | Training
# Thursday, January 04, 2007

It's going around and a bit like a 'who dunnit' (sort of). In short - someone 'tags' you and you then have to reveal 5 things about yourself you normally wouldn't.

VSTS Guru Anthony Borton did me the honours and now I'm tagged. (thanks!)

So here goes:
1. I won $300 dollars when I was 15 on a radio competition for the longest toe(5.5cms) in Wollongong (where I grew up) - the comp. was on for the day and you had to go into the radio station for them to measure. My record stood from 10.30am onwards.

2. During my school holidays I used to sell Watermellons on Bondi beach in the mornings - had something going there.....

3. When I was 7 my dad dressed me up as a girl with a wig (we have a womens fashion shop in the family) etc. and took my sister and I to the local circus - as girls got in for free. (My therapist says I'm doing well now and nearly over it)

4. I'm left handed - "left handers are the only ones in their right mind" (something like that - I had a t-shirt when I was 5 with this. Yes using right handed scissors all your life is tough)

5. For my very last exam at Uni I studied for nearly 4 weeks for this last exam. Rode my push bike into the exam - panicked as the exam room was locked and no one else was there. I was 1hr early!! Got into the exam and during reading time didnt recognise one question (it was going to be tough I thought).

I discussed the exam with one of the supervisors only to be told that my lecturer in this subject stream DIDNT HAVE FINAL EXAMS!! We were assessed during the term.........I was back riding my bike again at 9.30am!

Now which island did my friends go to....

My five people I've decided to tag

  1. David McGhee - great guy now with Microsoft with a passion for just about anything.
  2. Chris Vidotto - Microsoft Technical Specialist - BizTalk. He's whooping me on xbox live at the moment.
  3. Mark Daunt - fellow BizTalk/MOSS/SQL expert - found sleeping in some bizzar places.
  4. Clayton James - Loving Sharepoint and being a MCT
  5. Mark Burch - Biztalk Support Engineer, and co-founder of the Sydney BizTalk User Group.

Looking forward in seeing what you've got folks.

Thursday, January 04, 2007 6:20:49 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [4] -
Other
# Tuesday, December 26, 2006

All full up, eaten several families out of house and home and we all slept under the tree waiting for Santa...early mornings.....:|

Best wishes and see you all in 2007 for an even better year!

Tuesday, December 26, 2006 10:32:56 AM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0] -
BizTalk | Events | Other
# Wednesday, December 20, 2006
I'm thinking this is a bad thing if you want dynamic resolution.

I've experienced this with both the XMLReceive and a Custom Flat File Receive Pipeline (I built).

1. Both worked a treat - '5 minutes ago' as I've been working away.
2. Went into the BizTalk Admin console and 'adjusted' a property on the pipeline at the receive location ->clicked on the '...' button next to the pipeline.
3. Even if you dont change anything and hit OK...you're affected.
4. XMLReceive + FlatFile both complain about 'blank document schema' which must be specified.
(as in this case I'd changed a few things coding....it took me AGES to come back to here)
I even explicitly supplied the correct schema as a property on the FFDASM component I was using and no go!
5. Resolution: go back to the pipeline within the receive location (or send port) and select another pipeline from the list. Click OK to close the property window, then repeat and add your original pipeline but dont go into the pipeline per instance properties pages

Why does this happen??? (yeah good question :)
Basically both the XMLDASM and the FFDASM take precedence with Per instance pipeline config properties than *anything* else you provide.
e.g. Dynamically processing a flat file - check the SDK example, but here's a pseduo version.
.....
//Flatfile schema resolver - normal technique.
DocumentSchema docSpec = ......determine which deployed schema to use.

//this line basically tells the Disassemblers which schema to apply.
msg.Context.write("DocumentSpecName","<system namespace xml-norm>",docSpec.DocSpecStrongName);  
_myFFDasm.Disassemble(msg);   // line - *

These above lines will work for a year and a day (I've tested this) and in both 2004 + 2006, but NOT when you add perinstance pipeline configs - it seems all 'dynamic-ness' has gone out the window.

When per instance pipeline config is specified, this config data is provided as a Message Context Property (ReceivePipelineConfig) and XMLDasm + FFDasm only look at this for their values - painful.

So as in my case, I hadnt specified a Document Schema within the pipeline config as this pipeline was dynamic (c.f. like the xmlReceive).
I explicitly assigned a Schema to the FFDasm.DocumentSchema property and still got the same error as before.

Removing the Config Data did the trick :)


Given that this is the case - I think when you hit 'OK' to save the pipeline config data a warning/message of some description should come up as you may be wanting to modify 'one' value - 'omit xml declaration' for example. The rest of the properties are written in as blanks.

Hopefully I've saved you a bit of pain from mine.

Wednesday, December 20, 2006 11:25:41 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0] -
BizTalk | Insights | Tips

Making some headway with this issue I'm experiencing.

I can now go into the BizTalk Application and configure most of the resources found within the Application. I've ventured into Microsoft.BizTalk.ApplicationDeployment.Engine.dll (found in the GAC) and was able to enumerate all the resources etc.

The only thing I havent been able to do is 'an update' to the resource properties (metadata).
I can re-add the resource and overwrite the existing ones, this time with the correct settings, but the problem here is that resources that have dependenies fail. e.g. schemas, maps....

For better of for worse right now I've located the two tables in the BizTalkMgmtDB and modified those directly - all looks good.

The interesting thing is I used %BTAD_InstallDir% extensively throughout the DestinationLocation.

Setting that at deploy time use:
msiexec /i <package.msi> /quiet /log <logfile> TARGETDIR=<your location>

Somewhere within the MSI Installer component within the Package - TARGETDIR=%BTAD_InstallDir%
(Even though all the documentation talks about %BTAD_InstallDir% being an environment variable)

 

Wednesday, December 20, 2006 2:37:16 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0] -
BizTalk | Tips
Archive
<January 2007>
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Blogroll
 AppFabric CAT
AppFabric Windows Server Customer Advisory Team - New Blog.
[Feed] BizTalk 2006 - Windows SharePoint Services adapter
BizTalk 2006 Sharepoint adapter!!
 Breeze SharePoint 2010 Bootcamp
Breeze SharePoint 2010 Bootcamp
[Feed] BTS 2006 R2/EDI
[Feed] Chris Vidotto (MS BTS Legend)
Needs no intro....
[Feed] Clayton James
Special Rants and a great perspective on all things....
 Mark Daunt
BTS/SPS/.NET GURU!!!
[Feed] Rahul Garg
National MS BizTalk TS - guru and great guy
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2012
Breeze
Sign In
Statistics
Total Posts: 517
This Year: 10
This Month: 2
This Week: 0
Comments: 259
All Content © 2012, Breeze