none
Binary Message and Soap Format RRS feed

  • Question

  • Hello,

    I just have a small question.

    My service use the basic netTcpBinding. If I understand well the message is serialized with BinaryMessageEncodingBindingElement.

    Now I have written a class that inerits from IDispatchMessageInspector, that log the message in a file.  And when I look in the file, the message is SOAP formated.

    I would like to understand there is SOAP formated data in my log? I was expecting to see unreadable binary data.

    Chris
    Tuesday, March 31, 2009 4:23 PM

Answers

  • Hi Chris

    There are two different layers in WCF: the channel layer and the service model layer:

    Channel layer
    This moves messages from one place to another. Its world is one of protocol channels, encoders and transport channels. A message object (modeled on SOAP) enters this layer and is translated into a series of bytes by an encoder. So the BinaryMessageEncoder runs against the message object transforming it to and from and Message.

    ServiceModelLayer
    This layer serializes the parameters into a message and hands hte message object to the channel layer. On the receiver it takes the message object, hands it to the dispatcher, deserializes the message object into parameters and hands it off to a method on a service object .

    A message inspector sits at the border between the channel layer and the service model layer (although it runs in the service model layer) aqnd sees the Message object). So no matter how the object was encoded on the wire (binary in your case), when the message instector sees the message its in the form of a message object which is structured like a SOAP message
    Richard Blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
    • Marked as answer by chrisqwer Wednesday, April 1, 2009 2:03 PM
    Tuesday, March 31, 2009 10:27 PM
    Moderator

All replies

  • Hi Chris

    There are two different layers in WCF: the channel layer and the service model layer:

    Channel layer
    This moves messages from one place to another. Its world is one of protocol channels, encoders and transport channels. A message object (modeled on SOAP) enters this layer and is translated into a series of bytes by an encoder. So the BinaryMessageEncoder runs against the message object transforming it to and from and Message.

    ServiceModelLayer
    This layer serializes the parameters into a message and hands hte message object to the channel layer. On the receiver it takes the message object, hands it to the dispatcher, deserializes the message object into parameters and hands it off to a method on a service object .

    A message inspector sits at the border between the channel layer and the service model layer (although it runs in the service model layer) aqnd sees the Message object). So no matter how the object was encoded on the wire (binary in your case), when the message instector sees the message its in the form of a message object which is structured like a SOAP message
    Richard Blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
    • Marked as answer by chrisqwer Wednesday, April 1, 2009 2:03 PM
    Tuesday, March 31, 2009 10:27 PM
    Moderator
  • Excellent, Thanks a lot.

    I am going to search articles on this on the web.

    Wednesday, April 1, 2009 2:04 PM