0

We have two NServiceBus endpoints on different version, both with XML serialization.

When the older one tries to send messages to the newer one, for example:

<?xml version="1.0" ?>
<Messages 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://tempuri.net/****.Marketplace.Common.Interfaces.Entities" 
    xmlns:baseType="****.Marketplace.Common.Interfaces.Entities.MarketplaceAuditRecordBase" 
    xmlns:baseType1="Harmony.Core.Messages.AuditRecordBase" 
    xmlns:baseType2="Harmony.Core.Messages.IAuditRecord">
    <AuditRecord>
        <Id>0</Id>
        <BoutiqueUrlName></BoutiqueUrlName>
        <BoutiqueId>5301a9f1-d5bd-45c1-8b4f-29b60ed5d8c5</BoutiqueId>
        <UserId>null</UserId>
        <Success>true</Success>
        <EventDateUtc>2018-07-02T14:35:03.1815550</EventDateUtc>
        <UserAgent>Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36</UserAgent>
        <Url>http://marketplace.****.com/my/items/publish?productId=4181660</Url>
        <CountryCode>GB</CountryCode>
        <RequestId>4f6b42fa-4c27-4118-bb68-1e314d7a246e</RequestId>
        <Application>Site</Application>
        <EventCategory>Products</EventCategory>
        <EventType>Product-State-Change</EventType>
        <EventMessage>Product state changed from Unpublished to Live ()</EventMessage>
        <ReferenceId>4181660</ReferenceId>
        <SecondaryReferenceId>Live</SecondaryReferenceId>
    </AuditRecord>
</Messages>

The receiving endpoint fails with the message:

NServiceBus.MessageDeserializationException: An error occurred while attempting to extract logical messages from transport  
---> System.Xml.XmlException: There are multiple root elements    . Line 4, position 2.

As far as I can tell these messages are supposed to be backwards-compatible, and the XML in the message is well-formed and causes no problems if I try to parse it with XElement.Load or new XmlDocument().LoadXml(xml).

Can anyone point me in the right direction as to what's wrong?

I can't see any options on the XML serializer to play with and Googling this issue turned up pretty much bupkis.

Richiban
  • 5,569
  • 3
  • 30
  • 42
  • What are the versions of NSB in each endpoint? – Hadi Eskandari Jul 03 '18 at 05:32
  • The receiving one is v6 and the sending one is (I think) v1! We've actually upgraded everything to v6 but would like to deploy the endpoints one at a time – Richiban Jul 04 '18 at 09:33
  • Oh wow! We do boast about wire compatibility between versions, but v1 <-> v6 is a stretch. Between v1 and v6 things have changed quite a bite. – Hadi Eskandari Jul 05 '18 at 10:17
  • maybe have a look at NServiceBus.Raw to see if you can massage the incoming message in your v6 endpoint. https://docs.particular.net/nservicebus/rawmessaging/ – Hadi Eskandari Jul 05 '18 at 10:49

0 Answers0