How to put password in BizTalk WCF-SQL Binding (Error: Value cannot be null)

Error

When you try to manually set the SQL password on a WCF SQL port in a binding file, you might get tthis error:

Error Description: System.ArgumentNulLException: Value cannot be null.
Parameter Name: Password

Solution

The scenario is typically that you export a binding file from BizTalk. The exported file will never contain the actual password, so you might have to add it manually, or you give the file to someone who is deploying it in another environment, and that person has to add the correct password. Alternatively, you can deploy it “as is”, then use the BizTalk Admin console to manually change the password. But many BizTalk sites have processes and procedures where the password needs to be put in the binding file, either by a person or a program, at some point during the deployment process.

Within your binding file, you will see binding something like this:

You can take that whole line and put in NotePad++, highlight the text, and then if you have XML Plugins installed, select “Unescape…” and do it twice, as the data is “double encoded”.

Then using the same XML Tools, you can select “Pretty Print” or Ctrl+Alt+Shift+B to format and indent it, and you will see something like this:


</StaticAction>
<ProxyAddress vt="8"/>
<UserName vt="8">MyUser</UserName>
<InboundBodyLocation vt="8">UseBodyElement</InboundBodyLocation>
<ProxyUserName vt="8"/>
<OutboundXmlTemplate vt="8">
<bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="xml"/>
</OutboundXmlTemplate>
<PropagateFaultMessage vt="11">-1</PropagateFaultMessage>
<InboundNodeEncoding vt="8">Xml</InboundNodeEncoding>
<IsolationLevel vt="8">Serializable</IsolationLevel>
<Password vt="1"/>
<Identity vt="8"/>
<UseSSO vt="11">0</UseSSO>
<EnableTransaction vt="11">-1</EnableTransaction>
</CustomProps>
</TransportTypeData>

The section you need to change is this:


 <Password vt="1"/>. 

In regular XML, it needs to look like this, but note, you must change the value of vt from 1 to 8. Apparently 1 means empty or null.
Notice also that they use the empty tag indicator, rather than repeating the element name to close the tag. When you put in a value, you have to handle that as well.

<Password vt="8">MyPassword</Password> 

The above was just to show you what it looks like in readable XML. Most likely, you will just make the change in the encoded XML, like this:

Before:


&lt;Password vt="1" /&gt;

After:


&lt;Password vt="8"&gt;MyPassword&lt;/Password&gt;

You do almost the same with username, but username will already have the value of vt=”8″, and it will already have the closing tag.
So it’s a lot easier to change that one without messing it up.

Reference: Tallan.com

Leave a Reply

Recent Posts

Archives

Categories

Meta

All Rights Reserved Theme by 404 THEME.