IT Community - Software Programming, Web Development and Technical Support

BizTalk map preserving whitespace

This is a discussion on BizTalk map preserving whitespace within the Server Management forums, part of the Servers and Hosting category; BizTalk map preserving whitespace According to the documentation at MSDN (Creating Links), BizTalk maps should not preserve whitespace. However, after ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Servers and Hosting > Server Management

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 06-10-2009, 08:48 PM
arjkhanna arjkhanna is offline
D-Web Incredible
 
Join Date: Mar 2007
Posts: 1,949
arjkhanna is on a distinguished road
Default BizTalk map preserving whitespace

BizTalk map preserving whitespace

According to the documentation at MSDN (Creating Links), BizTalk maps should not preserve whitespace.

However, after a recent upgrade from 2006 to 2006 R2 our system seems now to be preserving whitespace.

For example, when the element Field in the following XML:


<ns0:Root xmlns:ns0="http://BizTalk_Server_Project2.source1">
<Field>
</Field>
</ns0:Root>


gets mapped to an element called Field1 in a slightly different schema:


<ns0:Root Field1="&#xD;&#xA; " xmlns:ns0="http://BizTalk_Server_Project2.destination>


the whitespace remains in place.

This is causing us a problem because the max length of the destination field is 1.

I can't check (because the upgrade process does not seem to be reversible) but I don't believe this was the case prior to R2.

Can anyone tell me if this is correct behaviour, and whether it has changed in R2?
__________________
A.Rajesh Khanna
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 06-10-2009, 08:58 PM
arjkhanna arjkhanna is offline
D-Web Incredible
 
Join Date: Mar 2007
Posts: 1,949
arjkhanna is on a distinguished road
Default Re: BizTalk map preserving whitespace

Hi,

Update: one of my colleagues has just run the same test in BizTalk 2006 (non-R2) and confirmed that the behaviour is different.

In BizTalk 2006 we get this as the output:


<ns0:Root Field1="" xmlns:ns0="http://BizTalk_Server_Project2.destination>


This is a serious issue for us because our system expects the whitespace to be stripped; and unfortunately we need R2 because of a critical bugfix it contains in another area.

Does anyone know how we can revert to the previous behaviour?
__________________
A.Rajesh Khanna
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 06-10-2009, 10:11 PM
arjkhanna arjkhanna is offline
D-Web Incredible
 
Join Date: Mar 2007
Posts: 1,949
arjkhanna is on a distinguished road
Default Re: BizTalk map preserving whitespace

Hi,

OK, after some digging in Reflector, I have got to the bottom of this. The behaviour has indeed changed in R2, although this is not documented anywhere that I can find.

In BizTalk 2006 (non-R2), the method Microsoft.BizTalk.ScalableTransformation.BTSXslTra nsform.DoStandardTransformation looks like this:


private void DoStandardTransform(Stream strm, XsltArgumentList args, Stream output, XmlResolver resolver)
{
Trace.Tracer.TraceMessage(4, "LMT:Use Standard Transformation", new object[0]);
XPathDocument input = new XPathDocument(strm);
this.xform.Transform(input, args, output, resolver);
Trace.Tracer.TraceMessage(4, "LMTone with Standard Transformation", new object[0]);
}


But in R2 it looks like this:


private void DoStandardTransform(Stream strm, XsltArgumentList args, Stream output, XmlResolver resolver)
{
Trace.Tracer.TraceMessage(4, "LMT:Use Standard Transformation", new object[0]);
if (legacyWhitespaceBehavior)
{
this.xform.Transform(new XPathDocument(strm), args, output, resolver);
}
else
{
this.xform.Transform(new XPathDocument(new XmlTextReader(strm), XmlSpace.Preserve), args, output, resolver);
}
Trace.Tracer.TraceMessage(4, "LMTone with Standard Transformation", new object[0]);
}


Digging a little further, I found that legacyWhitespaceBehaviour gets set in the static constructor:


static BTSXslTransform()
{
Transform_CLSID = new Guid("{917718A6-67E1-47c0-9267-2164A0DF632B}");
legacyWhitespaceBehavior = false;
defaultAutoSwitchThreshold = 0x100000;
int registryValue = Utils.GetRegistryValue("TransformThreshold", @"Software\Microsoft\BizTalk Server\3.0\Administration");
if (registryValue > 0)
{
defaultAutoSwitchThreshold = registryValue;
}
if (Utils.GetRegistryValue("LegacyWhitespace", @"Software\Microsoft\BizTalk Server\3.0\Administration") > 0)
{
legacyWhitespaceBehavior = true;
}
}


And sure enough, by creating the registry key HKLM\Software\Microsoft\BizTalk Server\3.0\Administration\LegacyWhitespace and setting it to 1, I get the result I was expecting.

Googling for "biztalk legacywhitespace" returns no results, so this is apparently a completely undocumented feature
__________________
A.Rajesh Khanna
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 06-10-2009, 10:12 PM
nnraja nnraja is offline
D-Web Sr.Programmer
 
Join Date: May 2007
Posts: 144
nnraja is on a distinguished road
Default Re: BizTalk map preserving whitespace

Hi,

I'm having the same issue in BizTalk 2006 R2 so i followed to create Reg Key but no luck. Pls help me.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 06-10-2009, 10:13 PM
shaalini shaalini is offline
D-Web Architect
 
Join Date: Apr 2007
Posts: 633
shaalini is on a distinguished road
Default Re: BizTalk map preserving whitespace

Hi,

arjkhanna has provided solution for this issue:

open registry on R2 Biztalk box and
create new Dword named LegacyWhitespace under
by creating the registry key
HKEY_LOCAL_MACHINE\Software\Microsoft\BizTalk Server\3.0\Administration
and setting it to 1
__________________
Shaalini.S
Be the Best of Whatever you are...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 06-10-2009, 10:15 PM
bluesky bluesky is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 667
bluesky is on a distinguished road
Default Re: BizTalk map preserving whitespace

Hi,

I created the same key, recycled hosts and rebooted server as well.

I am still getting the same error.

What am i doing wrong?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 06-10-2009, 10:15 PM
arjkhanna arjkhanna is offline
D-Web Incredible
 
Join Date: Mar 2007
Posts: 1,949
arjkhanna is on a distinguished road
Default Re: BizTalk map preserving whitespace

Hi all,

The server was Win 2003 X64. But the hosts were running as 32 bit.
This article states the location for 32 bit apps on a 64 bit OS. After updating in this location it started to work


Registry changes in x64-based versions of Windows Server 2003 and in Windows XP Professional x64 Edition

For 32 bit applications running on 64 bit OS the registry settings are stored under HKLM\Software\WOW6432Node
__________________
A.Rajesh Khanna
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
BizTalk 2009 project migration nnraja Server Management 1 06-10-2009 08:36 PM
BizTalk memory behavior nnraja Server Management 3 06-10-2009 07:01 PM
BizTalk 2006 and Virtualization bluesky Server Management 2 06-10-2009 03:15 AM
BizTalk messages to processs all the messaages at a time arjkhanna Server Management 4 06-09-2009 11:46 PM
Biztalk Server Interview Questions prasannavigneshr Interview Questions & Answers and Tips 15 06-03-2008 03:00 AM


All times are GMT -7. The time now is 09:22 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0