none
Wcf serialization and data format over the wire RRS feed

  • Question

  • I have an understanding on how the format of the data will be when its sent on wire and before its sent over wire to the client while using WCF. Please let me know if its right and correct me if I am wrong.

    Case 1 :HttpBinding is used. When returning a WCF service call to the client:

    When a method returns a dot net object, it will be first serialized into netdatacontract serializer format. This serialized data will be put inside a soap envelope .This soap will be converted into binary when its sent to network wire.On the client end riverse of these steps will be done.

    Case 2 :NetTcpbinding. When returning a WCF service call to the client:

    When a method returns a dot net object, it will be first serialized into netdatacontract serializer format. This data will not be converted into soap format. Instead, the serialized format is directly converted into binary while putting the data on the wire. On the client side, reverse of the above is done.

    If the above statements are right , Is this why they say netbinding uses binary encoding and is optimized for performance ?

    I am mostly wrong in my understanding.  Would some one explain me what exactly happens to the data when using different binding [Before sending it over the wire and after ].


    Chandan_vr


    Wednesday, June 5, 2013 8:14 AM

Answers

  • On 6/5/2013 6:32 AM, chandan_vr_india wrote:

    Any data when it is on a cable wire, it cannot go as abcd or 123. It has to go as binary over the wire.

    No it doesn't,  and it can come as text data like SOAP and XML. The only binary representation is the 1's and 0's bit combinations of 1 the bit is on or 0 the bit is off that represents a byte of data.

    http://en.wikipedia.org/wiki/SOAP


    My question is:


    what data is converted to binary when data goes into the network ? E.g. Is the soap message converted to binary or the serialized object is converted to binary when it has to be sent on wire ?

    You are making more out of this than it needs to be. Everything is represented in binary with 1 or 0 bit binary representation/ combination of what constitutes data  representation.


    Does it differ with the protocol used like http or tcp ?

    You had better understand what HTTP is,  what it is used for and its purpose as opposed to TCP/IP.
     You had better understand what serialization is about.

    http://www.c-sharpcorner.com/interviews/answer/499/
     If you need to go any further than that, then you need to be posting to a network/protocol forum or NG.

    Wednesday, June 5, 2013 11:14 AM
  • I found these two links which answered my questions. forums.asp.net/t/1864812.aspx/1 stackoverflow.com/questions/2364581/binary-vs-text-protocols

    Thanks for your help.

    Chandan_vr

    Saturday, June 8, 2013 6:08 AM

All replies

  •  The custom objects are XML serialized and deserialized between the WCF client and the WCF service when the objects are sent over the wire
    for a SOAP/XML Web service.

    Some companies will use WCF over TCP/IP in a closed network infrastructure between WCF Web client application that's in communications with  the WCF over TCP/IP service running on an application server on the back-end, and where they would be concerned with speed over the wire in a protected/closed LAN infrastructure. WCF TCP/IP Binary service could be used in this situation.

    For me,  I have never seen a WCF TCP/IP service being used over the Internet. WCF over TCP/IP usage has been limited to the Intranet a closed LAN environment between a front-end Web server application program in communication with a WCF over TCP/IP service on a back-end application server on the company's closed LAN infrastructure. In the LAN situation, WCF over TCP/IP binary service can be used for speed.

    Wednesday, June 5, 2013 10:02 AM
  • Any data when it is on a cable wire, it cannot go as abcd or 123. It has to go as binary over the wire.

    My question is:

    what data is converted to binary when data goes into the network ? E.g. Is the soap message converted to binary or the serialized object is converted to binary when it has to be sent on wire ?

    Does it differ with the protocol used like http or tcp ?


    Chandan_vr

    Wednesday, June 5, 2013 10:32 AM
  • On 6/5/2013 6:32 AM, chandan_vr_india wrote:

    Any data when it is on a cable wire, it cannot go as abcd or 123. It has to go as binary over the wire.

    No it doesn't,  and it can come as text data like SOAP and XML. The only binary representation is the 1's and 0's bit combinations of 1 the bit is on or 0 the bit is off that represents a byte of data.

    http://en.wikipedia.org/wiki/SOAP


    My question is:


    what data is converted to binary when data goes into the network ? E.g. Is the soap message converted to binary or the serialized object is converted to binary when it has to be sent on wire ?

    You are making more out of this than it needs to be. Everything is represented in binary with 1 or 0 bit binary representation/ combination of what constitutes data  representation.


    Does it differ with the protocol used like http or tcp ?

    You had better understand what HTTP is,  what it is used for and its purpose as opposed to TCP/IP.
     You had better understand what serialization is about.

    http://www.c-sharpcorner.com/interviews/answer/499/
     If you need to go any further than that, then you need to be posting to a network/protocol forum or NG.

    Wednesday, June 5, 2013 11:14 AM
  • I found these two links which answered my questions. forums.asp.net/t/1864812.aspx/1 stackoverflow.com/questions/2364581/binary-vs-text-protocols

    Thanks for your help.

    Chandan_vr

    Saturday, June 8, 2013 6:08 AM