| Rajinder Singh 2004-08-15, 5:47 pm |
| Hi:
This is a follow up of my previous post on BizTalk trimming trailing blank
spaces from string elements in the message. I have attached the previous
post at the bottom of this message.
I was told that to fix my problem I should use whiteSpace schema element.
Using that is supposed to fix
the problem of trailing blank spaces removal by BizTalk.
As a result of that I modified my schema to look like this:
It is a schema with 2 elements. Both of these elements are also promoted
properties.
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://BTWhitespaces.InputSchema"
xmlns:b="http://schemas.microsoft.com/BizTalk/2003"
targetNamespace="http://BTWhitespaces.InputSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Root">
<xs:annotation>
<xs:appinfo>
<b:properties>
<b:property distinguished="true" xpath="/*[local-name()='Root' and
namespace-uri()='http://BTWhitespaces.InputSchema']/*[local-name()='Transact
ionId' and namespace-uri()='']" />
<b:property distinguished="true" xpath="/*[local-name()='Root' and
namespace-uri()='http://BTWhitespaces.InputSchema']/*[local-name()='Payload'
and namespace-uri()='']" />
</b:properties>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="TransactionId" type="NameType" />
<xs:element name="Payload" type="NameType" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="NameType">
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
The only interesting part of the schema is <xs:whiteSpace value="preserve"/>
I send a message to my orchestration. The very first thing I do in my
orchestration is call a .Net assembly via an expression shape. In the .Net
assembly I print the length of the string. The length always shows that
blank spaces were trimmed.
The bizzare part in all this is that if I have Contruct message shape as
the first thing in an orchestration and in the same contruct shape I can add
the expression shape. This expression shape calls the same assembly. If the
assembly is called from this expression shape the trailing blank spaces are
not trimmed. From this point on I never see any trimming of the blank
spaces.
I have no idea why this is happening.
Raj
[vbcol=seagreen]
This is my previous post
Hi:
I have a simple orchestration. I have published the orchestration as a web
service.
The orchestartion receives a simple XML request like this.
Request
element1 : string
element2 : string
Both element1 and element2 are distinguished fields.
After receiving the request in the orchestration I am calling a .net
assembly.
I am passing both element1 and element2 to a method in the assembly.
The very first thing I do in the method is publish the length of the
element1 and element2
to the event log.
If there are trailing blank spaces in element1 and element2 they are
trimmed.
I have verified using the orchestration debugger that it receives a
documentation where the trailing
blank spaces still exist. I suspect that the XSLT that BizTalk uses to
extract the distinguished fields
is removing the blanks spaces.
I have tried updating the XSD for Request to add a restriction and adding
min and max length but it does not seem to make any difference.
Has anyone else seen this behavior. Does anyone have any suggestion for me.
Thanks
Raj
|