0

Our company uses Queue Explorer 4.0 pro by cogin and I've been searching all over their website and the only thing I can find on using their .net view is this little blurp about viewing a message being parsed with a .net assembly: blog post

so for instance, the body of my message is this:

<?xml version="1.0"?>
<CreateAuditLogEntry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.net/Phone.Messages">
    <SurveyId>12345</SurveyId>
    <AuditEventId>704</AuditEventId>
    <EventDateTime>2018-06-08T13:21:07.6647304Z</EventDateTime>
</CreateAuditLogEntry>

and I've tried using the assembly that we tell NServicebus to use that sends said message.It didn't have the SerializableAttribute so I figured I'd just make my own assembly with the same namespace and try to add all the same things:

namespace Phone.Messages
{
    [System.Serializable]
    public class CreateAuditLogEntry
    {
        public long SurveyId { get; set; }
        public int AuditEventId { get; set; }
        public System.DateTime EventDateTime { get; set; }
    }
}

I compile that and point Queue Explorer to it and it tells me that it still can't deserialize the object: Error: Cannot deserialize the message passed as an argument. Cannot recognize the serialization format. Has anyone used this and made it work successfully?

Robert Snyder
  • 2,399
  • 4
  • 33
  • 65

1 Answers1

1

That xmlns part seems to be the problem here. Your sample works when that namespace is specified through XmlRoot attribute:

[XmlRoot(Namespace="http://tempuri.net/Phone.Messages")]
public class CreateAuditLogEntry
{
    public long SurveyId { get; set; }
    public int AuditEventId { get; set; }
    public System.DateTime EventDateTime { get; set; }
}

Btw. QueueExplorer dynamically loads assemblies specified for .Net views, you don't have to restart it if you rebuild and create new dll/exe.

Dejan Grujić
  • 402
  • 2
  • 6
  • the xmlroot was the trick. Put that in and compiled like you said and it worked. Not very impressed though. :/ All that messing around for an underwhelming experience. Oh well. At least I know how to do it now. Thank you. – Robert Snyder Jun 29 '18 at 11:42