none
Unable to read messagetype of input message RRS feed

  • Question

  • Guys,

    I am implementing the "Disassemble" method of the IDisassembler interface in my custom pipeline component. In this method I am trying to access the access "MessageType" property using the code

    string msgType = pInMsg.Context.Read("MessageType", systemPropertiesNamespace).ToString();

    when I get a "Object reference not set to an instance of an object. " exception.

    Does anyone know if I am doing anything wrong here and possibly a way to read message type from the input message?

    Thursday, January 27, 2011 7:38 PM

Answers

  • I got around this problem. Loaded the message in an xml document object and got the namespace uri and localname of the document element and created message type out of those two. Hope this helps someone. I would like to know if there is a better solution available.
    • Marked as answer by BTS10 Friday, January 28, 2011 2:49 PM
    Thursday, January 27, 2011 9:31 PM
  • Hi there,

    just as a follow up:

    In a "Disassemble" stage noone has written the context property BTS.MessagType yet. Usually this is done by the "XML Disassembler" or "Flat File Disassembler", so you can only read the MessageType property after the disassemble stage in a receive pipeline.
    If you implement your own disassembler, you are supposed to determine and write the message type to the context.

    Best regards,

    Leo


    Please mark it as Answer if this answers your question.
    • Proposed as answer by Leo Martens Friday, January 28, 2011 10:51 AM
    • Marked as answer by BTS10 Friday, January 28, 2011 2:49 PM
    Friday, January 28, 2011 10:50 AM

All replies

  • Replace MessageType with BTS.MessageType and see.

    HTH.


    Please mark it as answer by clicking on "Propose As Answer", if it helps. My Blog : http://dotnetizen.blogspot.com
    Thursday, January 27, 2011 8:11 PM
  • Rajesh,

    That did not work, it was a smart suggestion though.

    Thursday, January 27, 2011 8:22 PM
  • Are you using "http://schemas.microsoft.com/BizTalk/2003/system-properties" as systemPropertiesNamespace ?

    something like below is used in this blog post,

    pInMsg.Context.Read("MessageType",
    "http://schemas.microsoft.com/BizTalk/2003/system-properties").ToString();


    Please mark it as answer by clicking on "Propose As Answer", if it helps. My Blog : http://dotnetizen.blogspot.com
    Thursday, January 27, 2011 8:34 PM
  • That is exactly how I am trying to read the message type. Just that in my case systemPropertiesNamespace is defined as a class variable with value of "http://schemas.microsoft.com/BizTalk/2003/system-properties"
    • Marked as answer by BTS10 Thursday, January 27, 2011 9:31 PM
    • Unmarked as answer by BTS10 Friday, January 28, 2011 2:49 PM
    Thursday, January 27, 2011 8:37 PM
  • I got around this problem. Loaded the message in an xml document object and got the namespace uri and localname of the document element and created message type out of those two. Hope this helps someone. I would like to know if there is a better solution available.
    • Marked as answer by BTS10 Friday, January 28, 2011 2:49 PM
    Thursday, January 27, 2011 9:31 PM
  • Hi there,

    just as a follow up:

    In a "Disassemble" stage noone has written the context property BTS.MessagType yet. Usually this is done by the "XML Disassembler" or "Flat File Disassembler", so you can only read the MessageType property after the disassemble stage in a receive pipeline.
    If you implement your own disassembler, you are supposed to determine and write the message type to the context.

    Best regards,

    Leo


    Please mark it as Answer if this answers your question.
    • Proposed as answer by Leo Martens Friday, January 28, 2011 10:51 AM
    • Marked as answer by BTS10 Friday, January 28, 2011 2:49 PM
    Friday, January 28, 2011 10:50 AM