I have created a BizTalk receive location which has a subscribing send port which accepts an enveloped message and splits into separate messages just using the XML Receive Pipeline.
<?xml version="1.0" encoding="utf-8"?>
<MyEnvelope xmlns="MyNameSpace">
<MyData>ABC</MyData>
<MyData>DEF</MyData>
<MyData>GHI</MyData>
</MyEnvelope>
Gets saved as
<?xml version="1.0" encoding="utf-8"?>
<MyData xmlns="MyNameSpace">ABC</MyData>
,
<?xml version="1.0" encoding="utf-8"?>
<MyData xmlns="MyNameSpace">DEF</MyData>
and
<?xml version="1.0" encoding="utf-8"?>
<MyData xmlns="MyNameSpace">GHI</MyData>
which is great.
However, when there are no elements in the message the service sends the message with self-closing and empty envelope:
<?xml version="1.0" encoding="utf-8"?>
<MyEnvelope xmlns="MyNameSpace"/>
And I get the error message
Source: "XML disassembler" Receive Port: "InLocation" URI: "c:\MyLocation*.xml" Reason: Unexpected event ("eos") in state "processing_header".
If I manually create a message which is not self-closing:
<?xml version="1.0" encoding="utf-8"?>
<MyEnvelope xmlns="MyNameSpace"></MyEnvelope>
I get no error. My processing is unaffected by the errors but it must have some performance impact and litters the Group Hub suspended instances view.
It seems that BizTalk interprets self-closing nodes as whitespace instead of null. This seems linked to my issues with attempting to call a service with no parameters where I need to send a self-closing node but BizTalk just sends nothing.
It must be a common issue to handle an envelope with no content. How can I configure my application to pick up and ignore these messages with self-closing envelope nodes?
Every so often they seem to change the behaviour of how white space is treated. See Change in Default Whitespace Behavior in BizTalk. I'm not sure if your issue is related or not but worth a look. It doesn't mention BizTalk 2013 however but the setting is there in the Host. If you do this configuration setting it would pay to set up a host specially for it so that it has no impact on other existing applications if any.
Installing one of the following updates results in BizTalk changing default behavior to preserve whitespace within the XML during mapping:
In some environments, it may be preferred that the transform remove whitespace. In order to revert to this behavior, the following steps can be taken:
In BizTalk 2010, this is set at the host level:
In BizTalk 2009 and 2006 R2 this value is set at a per-machine level:
I have not seen or verified this behavior but I'll trust you ;).
Don't worry about the performance hit of the Exceptions unless you're getting 10K files per hours or something like that.
To prevent the errors, you'll have to quash or reformat the message in a Pipeline Component.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With