Problem
I came across the following problem the other day. I had setup a send port to pick up messages from the messagebox. I then enlisted and started it. All good so far.
To ensure this port was setup as part of the build I exported the bindings.
At this point I need to mention a little about the build process for our solution. On the project we have a large number of test environments so in order to simplify the management of config settings between environments the solution contains a custom MsBuild task which will use a custom xml dictionary and a template of the binding file.
During the build the process will run the template against the dictionary and produce a number of correctly configured files for each environment. We typically do this with the BizTalk config file, WSE Adapter policy cache and each applications binding files.
In this particular instance when I amended the template and produced the new bindings to use for this application I started getting the following error once they had been imported and I tried to enlist the ports.
"Could not enlist send port '[Send Port Name]' Exception from HRESULT: 0xC00CE557(Microsoft.BizTalk.ExplorerOM) "
The binding file would import without error so I assumed it was something related to setting up subscriptions when the port was enlisted which for this port indicated a problem with the filter.
When I checked the filter page of the port settings there was no filter listed yet there is a filter defined in the bindings file.
Work Around
After some experimentation I found that it was definately the filter and I think what was happening was that when I edited the file and saved it through Visual Studio it must be affecting the encoding of the file when it was saved. When I edited the file through Visual Studio I could not successfully import the bindings to setup the port. If I configured the template only through Notepad the import of bindings into BizTalk would setup the filter correctly.
Something to consider if you experience a similar problem
UPDATE!!
I actually found the cause of the problem for this. Basically when I opened the binding file in Visual Studio somehow the xml within the filter property of the send port had reformatted slightly. It should be like below:
<Filter><?xml version="1.0" encoding="utf-16"?>
<Filter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Group>
<Statement Property="BTS.MessageType" Operator="0" Value="http://Acme#Remittance" />
</Group>
</Filter></Filter>
But it had changed to the following:
<Filter>
<?xml version="1.0" encoding="utf-16"?>
<Filter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Group>
<Statement Property="BTS.MessageType" Operator="0" Value="http://Acme#Remittance" />
</Group>
</Filter>
</Filter>
The key difference is the new line before and after the content within the element. When I removed these it imported correctly.