SQL Server Service Broker system error -9616, when can it happen?

650 views Asked by At

I have a scenario in one of my Service Broker conversation configurations, which looks like this:

  • one message type, which is sent by initiator only (VALIDATION = WELL_FORMED_XML, no XSD)
  • one contract with this message type
  • both deployed on the initiator and target side (remote machines)

Occasionally I find Service Broker system error messages in the target queue like this:

<Error xmlns="http://schemas.microsoft.com/SQL/ServiceBroker/Error"><Code>-9616</Code><Description>A message of type 'here_is_the_name' was received and failed XML validation.  XML parsing: line 1, character 547, illegal xml character This occurred in the message with Conversation ID 'here_is_the_guid', Initiator: 1, and Message sequence number: 0.</Description</Error>

I looked at Remus Rusanu's blog post and he states that:

This system error is sent to a conversation that has sent a message type marked as conforming to a certain XML schema but the payload has failed to pass the XML validation for the said schema

In my case there is no XML schema involved and I was trying to reproduce this case in my dev env using the same SQL Server versions and I was unable to do it.


I would like to know is it possible to receive this system error message although I'm not using XSD schema ? If so, when can it happen, what is the scenario where Service Broker generates error like above?

The message clearly says "XML parsing: line 1, character 547, illegal xml character" so in my opinion it has nothing to do with the schema validation. Can it be that the transport level is encountering some problems (TCP errors) and that is why Service Broker is generating this error message ?

1

There are 1 answers

4
Remus Rusanu On

Message validation occurs on enqueue the message in the target queue, not on SEND. Message type validation (NONE, XML, XDS) is provided to protect your application. Validating during SEND is not enough, as a malicious application can send a message w/o using Service Broker ( a wire protocol simulator). Since validation during enqueue is mandatory, adding validation during SEND would add CPU burden for little value.

So what that means is the your SEND side application is sending invalid XML, and this gets caught on the target side. The wording on my blog is poorly chosen, I should had been more explicit that the validation can fail a schema (if specified) or it can fail the well formed XML test.

Can you post the message body you're sending?