WCF-Bindings - additional XPaths for xml encoding

Topics: Bindings File, Settings Management and SSO
Jun 11, 2010 at 9:06 AM

Hi,

Using WCF bindings I ran into the following "problem". I exported my current binding and replaced all < and similar stuff to use the XML encoding feature. Deployment was OK, but I could not undeploy my solution because of some "root node" error. I had to manually delete two troublesome send ports first, than I could remove the application.

I fixed this by using a CDATA section (red line) for the EndpointBehaviorConfiguration section. Can I tell the xmlpreprocessor to include this field in its process? Or do I miss something? Completely removing the tag also works of course.

Thanks in advance,

Eljakim

<SendPort Name="XXX0" IsStatic="true" IsTwoWay="true" BindingOption="1">
	<Description xsi:nil="true" />
	<TransmitPipeline Name="Microsoft.BizTalk.DefaultPipelines.XMLTransmit" FullyQualifiedName="Microsoft.BizTalk.DefaultPipelines.XMLTransmit, Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Type="2" TrackingOption="ServiceStartEnd MessageSendReceive PipelineEvents" Description="" />
	<PrimaryTransport>
		<!-- ifdef ${ _xml_preprocess} -->
		<!-- <Address>${XXX1}</Address> -->
		<!-- else -->
		<Address>mssql://XXX2//XXX3</Address>
		<!-- endif -->

		<TransportType Name="WCF-Custom" Capabilities="907" ConfigurationClsid="af081f69-38ca-4d5b-87df-f0344b12557a" />
		<TransportTypeData>
			<CustomProps>
				<InboundBodyPathExpression vt="8" />
				<InboundBodyLocation vt="8">UseBodyElement</InboundBodyLocation>
				<UseSSO vt="11">0</UseSSO>
				<BindingType vt="8">sqlBinding</BindingType>
				<OutboundXmlTemplate vt="8">
					<bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="xml"/>
				</OutboundXmlTemplate>
				<BindingConfiguration vt="8">
					<binding name="sqlBinding" />
				</BindingConfiguration>
				<ProxyUserName vt="8" />
				<AffiliateApplicationName vt="8" />
				<StaticAction vt="8">TypedProcedure/dbo/Proc_StoreInExportDB_V02</StaticAction>
				<IsolationLevel vt="8">Serializable</IsolationLevel>
				<EnableTransaction vt="11">-1</EnableTransaction>
				<UserName vt="8" />
				<InboundNodeEncoding vt="8">Xml</InboundNodeEncoding>
				<PropagateFaultMessage vt="11">-1</PropagateFaultMessage>
				<ProxyAddress vt="8" />
				<EndpointBehaviorConfiguration vt="8"><![CDATA[<behavior name="EndpointBehavior" />]]></EndpointBehaviorConfiguration>
				<OutboundBodyLocation vt="8">UseBodyElement</OutboundBodyLocation>
			</CustomProps>
		</TransportTypeData>


		<!-- ifdef ${ _xml_preprocess} -->
		<!-- <RetryCount>${RetryCount}</RetryCount> -->
		<!-- <RetryInterval>${RetryInterval}</RetryInterval> -->
		<!-- else -->
		<RetryCount>0</RetryCount>
		<RetryInterval>5</RetryInterval>
		<!-- endif -->

		<ServiceWindowEnabled>false</ServiceWindowEnabled>
		<FromTime>2000-01-01T22:00:00</FromTime>
		<ToTime>2000-01-01T21:59:59</ToTime>
		<Primary>true</Primary>
		<OrderedDelivery>false</OrderedDelivery>
		<DeliveryNotification>1</DeliveryNotification>
		<SendHandler Name="BizTalkServerApplication" HostTrusted="false">
			<TransportType Name="WCF-Custom" Capabilities="907" ConfigurationClsid="af081f69-38ca-4d5b-87df-f0344b12557a" />
		</SendHandler>
	</PrimaryTransport>
	<SecondaryTransport>
		<Address />
		<RetryCount>3</RetryCount>
		<RetryInterval>5</RetryInterval>
		<ServiceWindowEnabled>false</ServiceWindowEnabled>
		<FromTime>2000-01-01T22:00:00</FromTime>
		<ToTime>2000-01-01T21:59:59</ToTime>
		<Primary>false</Primary>
		<OrderedDelivery>false</OrderedDelivery>
		<DeliveryNotification>1</DeliveryNotification>
		<SendHandler xsi:nil="true" />
	</SecondaryTransport>
	<ReceivePipeline Name="Microsoft.BizTalk.DefaultPipelines.XMLReceive" FullyQualifiedName="Microsoft.BizTalk.DefaultPipelines.XMLReceive, Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Type="1" TrackingOption="ServiceStartEnd MessageSendReceive PipelineEvents" Description="" />
	<ReceivePipelineData xsi:nil="true" />
	<Tracking>0</Tracking>
	<Filter />
	<Transforms />
	<InboundTransforms />
	<OrderedDelivery>false</OrderedDelivery>
	<Priority>5</Priority>
	<StopSendingOnFailure>false</StopSendingOnFailure>
	<RouteFailedMessage>false</RouteFailedMessage>
	<ApplicationName>XXX4</ApplicationName>
</SendPort>

<SendPort Name="StoreInExportDBPort" IsStatic="true" IsTwoWay="true" BindingOption="1">
            <Description xsi:nil="true" />
            <TransmitPipeline Name="Microsoft.BizTalk.DefaultPipelines.XMLTransmit" FullyQualifiedName="Microsoft.BizTalk.DefaultPipelines.XMLTransmit, Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Type="2" TrackingOption="ServiceStartEnd MessageSendReceive PipelineEvents" Description="" />
            <PrimaryTransport>
                <!-- ifdef ${ _xml_preprocess} -->
                <!-- <Address>${DatagateDB_WCF}</Address> -->
                <!-- else -->
                <Address>mssql://evolux//datagateDB</Address>
                <!-- endif -->

                <TransportType Name="WCF-Custom" Capabilities="907" ConfigurationClsid="af081f69-38ca-4d5b-87df-f0344b12557a" />
                <TransportTypeData>
                    <CustomProps>
                        <InboundBodyPathExpression vt="8" />
                        <InboundBodyLocation vt="8">UseBodyElement</InboundBodyLocation>
                        <UseSSO vt="11">0</UseSSO>
                        <BindingType vt="8">sqlBinding</BindingType>
                        <OutboundXmlTemplate vt="8">
                            <bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="xml"/>
                        </OutboundXmlTemplate>
                        <BindingConfiguration vt="8">
                            <binding name="sqlBinding" />
                        </BindingConfiguration>
                        <ProxyUserName vt="8" />
                        <AffiliateApplicationName vt="8" />
                        <StaticAction vt="8">TypedProcedure/dbo/Proc_StoreInExportDB_V02</StaticAction>
                        <IsolationLevel vt="8">Serializable</IsolationLevel>
                        <EnableTransaction vt="11">-1</EnableTransaction>
                        <UserName vt="8" />
                        <InboundNodeEncoding vt="8">Xml</InboundNodeEncoding>
                        <PropagateFaultMessage vt="11">-1</PropagateFaultMessage>
                        <ProxyAddress vt="8" />
                        <EndpointBehaviorConfiguration vt="8"><![CDATA[<behavior name="EndpointBehavior" />]]></EndpointBehaviorConfiguration>
                        <OutboundBodyLocation vt="8">UseBodyElement</OutboundBodyLocation>
                    </CustomProps>
                </TransportTypeData>


                <!-- ifdef ${ _xml_preprocess} -->
                <!-- <RetryCount>${RetryCount}</RetryCount> -->
                <!-- <RetryInterval>${RetryInterval}</RetryInterval> -->
                <!-- else -->
                <RetryCount>0</RetryCount>
                <RetryInterval>5</RetryInterval>
                <!-- endif -->

                <ServiceWindowEnabled>false</ServiceWindowEnabled>
                <FromTime>2000-01-01T22:00:00</FromTime>
                <ToTime>2000-01-01T21:59:59</ToTime>
                <Primary>true</Primary>
                <OrderedDelivery>false</OrderedDelivery>
                <DeliveryNotification>1</DeliveryNotification>
                <SendHandler Name="BizTalkServerApplication" HostTrusted="false">
                    <TransportType Name="WCF-Custom" Capabilities="907" ConfigurationClsid="af081f69-38ca-4d5b-87df-f0344b12557a" />
                </SendHandler>
            </PrimaryTransport>
            <SecondaryTransport>
                <Address />
                <RetryCount>3</RetryCount>
                <RetryInterval>5</RetryInterval>
                <ServiceWindowEnabled>false</ServiceWindowEnabled>
                <FromTime>2000-01-01T22:00:00</FromTime>
                <ToTime>2000-01-01T21:59:59</ToTime>
                <Primary>false</Primary>
                <OrderedDelivery>false</OrderedDelivery>
                <DeliveryNotification>1</DeliveryNotification>
                <SendHandler xsi:nil="true" />
            </SecondaryTransport>
            <ReceivePipeline Name="Microsoft.BizTalk.DefaultPipelines.XMLReceive" FullyQualifiedName="Microsoft.BizTalk.DefaultPipelines.XMLReceive, Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Type="1" TrackingOption="ServiceStartEnd MessageSendReceive PipelineEvents" Description="" />
            <ReceivePipelineData xsi:nil="true" />
            <Tracking>0</Tracking>
            <Filter />
            <Transforms />
            <InboundTransforms />
            <OrderedDelivery>false</OrderedDelivery>
            <Priority>5</Priority>
            <StopSendingOnFailure>false</StopSendingOnFailure>
            <RouteFailedMessage>false</RouteFailedMessage>
            <ApplicationName>datagate.anforderungen</ApplicationName>
        </SendPort>
Jun 11, 2010 at 9:16 AM

Some goes for the Filter element.

 

Coordinator
Jun 11, 2010 at 2:06 PM

The tool that handles re-encoding nested XML in XML files is ElementTunnel.exe.  It looks like you have un-encoded more elements than it is configured to act upon.

If you take an original binding file exported by BizTalk Admin, you can create an un-encoded file like this:

<deploymentFrameworkInstallPath>\Framework\DeployTools\ElementTunnel.exe /i:"exportedBindingFilePath" /o:"masterBindingFilePath" /x:"<deploymentFrameworkInstallPath>\Framework\DeployTools\adapterXPaths.txt" /decode

The adapterXPaths.txt file is what contains the XPaths for the elements that are un-encoded and re-encoded.

Thanks,
Tom

Jun 14, 2010 at 12:21 PM

OK, this file was what I was looking for. I'll check it out.

THANKS for your amazingly quick answers throughout!

E.

Oct 16, 2012 at 11:12 AM

Hi

This issue is driving me crazy from last many days. I am using element tunnel to do escaping . I have tried couple of adapterXPaths.txt files but no luck :(

here are the two adapterXPaths files

 

File 1 

/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceiveLocationTransportTypeData/CustomProps/AdapterConfig/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceiveLocationTransportTypeData/CustomProps/BindingConfiguration/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceiveLocationTransportTypeData/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceivePipelineData/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/SendPipelineData
/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/StaticAction/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/AdapterConfig/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/BindingConfiguration/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/BindingInfo/SendPortCollection/SendPort/ReceivePipelineData/BindingInfo/SendPortCollection/SendPort/SendPipelineData/BindingInfo/SendPortCollection/SendPort/Filter
/BindingInfo/PartyCollection/Party/CustomData

File 2

/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceiveLocationTransportTypeData/CustomProps/AdapterConfig/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceiveLocationTransportTypeData/CustomProps/BindingConfiguration/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceiveLocationTransportTypeData/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceivePipelineData/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/SendPipelineData
/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/BindingConfiguration/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/EndpointBehaviorConfiguration/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/OutboundXmlTemplate/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/StaticAction/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/AdapterConfig/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/BindingInfo/SendPortCollection/SendPort/ReceivePipelineData/BindingInfo/SendPortCollection/SendPort/SendPipelineData/BindingInfo/SendPortCollection/SendPort/Filter
/BindingInfo/PartyCollection/Party/CustomData

What am I doing wrong ?

Thanks

Coordinator
Oct 16, 2012 at 3:57 PM

Hi, I'm not sure what the issue is that you're asking about.  Did you take your original, exported bindings XML file and decode it using ElementTunnel.exe?  Have you done any editing of the file in the Visual Studio editor?

Thanks,
Tom

Oct 16, 2012 at 5:25 PM

Ok I will try to explain.

I have a application which has 2-3 file ports and  5-6 WCF Custom (All for SQL)ports (4 are strongly typed proc., 2 are select/insert from/in a table ). I created my application deployed it and exported the bindings file. renamed it as portbindingsknowngood, used element tunnel.exe to create portbindingsMaster. Till this point no issues.

Now as soon as I use this portbindingsmaster file  to deploy with  BTDF with <ApplyXmlEscape>true</ApplyXmlEscape>

First deployment, every thing works fine no issues.

As soon as I try to redeploy  BTDF says cannot remove application... If I try to export bindings from admin console it says "Root Element is Missing". Now the only way to redeploy is to delete orchestration manually and then delete the ports in admin console.

Thus to resolve this issue I was trying to use different sets of adapterXPaths. coz I was thinking that something is going wrong when I am using elementtunnel.exe

I have used BTDF before and never had this issue, only difference I can see in this application is that I am using WCF Custom adapter for SQL Insert and Select, where as in previous application I used all strongly typed proc based WCF custom adapters.

I also tried to manually replace &lt; and &gt; in portbindingsknowngood and then tried my luck ... but didnt worked :(

Coordinator
Oct 16, 2012 at 6:05 PM

Have you tried using WinMerge or another differencing tool to compare the generated PortBindings.xml with the original exported PortBindingsKnownGood.xml?  Usually that will point directly to the problem if it has to do with encoding/decoding.

Thanks,
Tom

Oct 17, 2012 at 10:06 AM

Thanks Tom for Reply

I did a compare first thing today when I came to office and differences in bold are trimmed out. This is happening in all the WCF Custom SQL ports.

I didn't had this issue in my previous project when I worked with WCF Custom SQL ports.

This information is also missing in portbindingsMaster after I generate it from elementtunnel.exe

What I have to do to counter this ?

PortBindingsKnownGood

<TransportTypeData>&lt;CustomProps&gt;&lt;BindingConfiguration vt="8"&gt;&amp;lt;binding name="sqlBinding" /&amp;gt;&lt;/BindingConfiguration&gt;&lt;InboundBodyPathExpression vt="8" /&gt;&lt;OutboundBodyLocation vt="8"&gt;UseBodyElement&lt;/OutboundBodyLocation&gt;&lt;AffiliateApplicationName vt="8" /&gt;&lt;EnableTransaction vt="11"&gt;-1&lt;/EnableTransaction&gt;&lt;StaticAction vt="8"&gt;TableOp/Insert/dbo/Tbl_Inbound_ABC&lt;/StaticAction&gt;&lt;BindingType vt="8"&gt;sqlBinding&lt;/BindingType&gt;&lt;ProxyAddress vt="8" /&gt;&lt;UserName vt="8" /&gt;&lt;InboundBodyLocation vt="8"&gt;UseBodyElement&lt;/InboundBodyLocation&gt;&lt;EndpointBehaviorConfiguration vt="8"&gt;&amp;lt;behavior name="EndpointBehavior" /&amp;gt;&lt;/EndpointBehaviorConfiguration&gt;&lt;OutboundXmlTemplate vt="8"&gt;&amp;lt;bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="xml"/&amp;gt;&lt;/OutboundXmlTemplate&gt;&lt;PropagateFaultMessage vt="11"&gt;-1&lt;/PropagateFaultMessage&gt;&lt;InboundNodeEncoding vt="8"&gt;Xml&lt;/InboundNodeEncoding&gt;&lt;ProxyUserName vt="8" /&gt;&lt;IsolationLevel vt="8"&gt;Serializable&lt;/IsolationLevel&gt;&lt;UseSSO vt="11"&gt;0&lt;/UseSSO&gt;&lt;/CustomProps&gt;</TransportTypeData>

PortBindings

<TransportTypeData>&lt;CustomProps&gt;&lt;BindingConfiguration vt="8"&gt;&lt;/BindingConfiguration&gt;&lt;InboundBodyPathExpression vt="8" /&gt;&lt;OutboundBodyLocation vt="8"&gt;UseBodyElement&lt;/OutboundBodyLocation&gt;&lt;AffiliateApplicationName vt="8" /&gt;&lt;EnableTransaction vt="11"&gt;-1&lt;/EnableTransaction&gt;&lt;StaticAction vt="8"&gt;TableOp/Insert/dbo/Tbl_Inbound_ABC&lt;/StaticAction&gt;&lt;BindingType vt="8"&gt;sqlBinding&lt;/BindingType&gt;&lt;ProxyAddress vt="8" /&gt;&lt;UserName vt="8" /&gt;&lt;InboundBodyLocation vt="8"&gt;UseBodyElement&lt;/InboundBodyLocation&gt;&lt;EndpointBehaviorConfiguration vt="8"&gt;&lt;/EndpointBehaviorConfiguration&gt;&lt;OutboundXmlTemplate vt="8"&gt;&lt;/OutboundXmlTemplate&gt;&lt;PropagateFaultMessage vt="11"&gt;-1&lt;/PropagateFaultMessage&gt;&lt;InboundNodeEncoding vt="8"&gt;Xml&lt;/InboundNodeEncoding&gt;&lt;ProxyUserName vt="8" /&gt;&lt;IsolationLevel vt="8"&gt;Serializable&lt;/IsolationLevel&gt;&lt;UseSSO vt="11"&gt;0&lt;/UseSSO&gt;&lt;/CustomProps&gt;</TransportTypeData>

Oct 17, 2012 at 10:31 AM

Since I now know what bits were missing, I manually replaced &gt; and &lt; and &amp;&gt; and &amp&lt; from the exported file and used that as portbindingsMaster and that worked. But I still wanted to use the element tunnel to do this manual job. 

Coordinator
Oct 19, 2012 at 5:13 AM

It seems that removing the BindingConfiguration XPath from the default AdapterXPaths.txt is enough to fix this, leaving:

/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceiveLocationTransportTypeData/CustomProps/AdapterConfig
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceiveLocationTransportTypeData/CustomProps/BindingConfiguration
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceiveLocationTransportTypeData
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceivePipelineData
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/SendPipelineData

/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/StaticAction
/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/AdapterConfig
/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData
/BindingInfo/SendPortCollection/SendPort/ReceivePipelineData
/BindingInfo/SendPortCollection/SendPort/SendPipelineData

/BindingInfo/PartyCollection/Party/CustomData

It seems like to add it in the first place I must have had a case where it was required... but in this case it is causing your problem.

Thanks,
Tom

Nov 2, 2012 at 2:28 PM
tfabraham wrote:

It seems that removing the BindingConfiguration XPath from the default AdapterXPaths.txt is enough to fix this, leaving:

/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceiveLocationTransportTypeData/CustomProps/AdapterConfig
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceiveLocationTransportTypeData/CustomProps/BindingConfiguration
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceiveLocationTransportTypeData
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ReceivePipelineData
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/SendPipelineData

/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/StaticAction
/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/AdapterConfig
/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData
/BindingInfo/SendPortCollection/SendPort/ReceivePipelineData
/BindingInfo/SendPortCollection/SendPort/SendPipelineData

/BindingInfo/PartyCollection/Party/CustomData

It seems like to add it in the first place I must have had a case where it was required... but in this case it is causing your problem.

Thanks,
Tom

And this is the working solution for this problem !

Apologies for later confirmation as I got time today to test it !

Cheers Thomas 

Coordinator
Nov 2, 2012 at 8:21 PM

Excellent, thanks for the update!

Tom