Hello, I'm having the exact same issue as the person who posted this thread: thread732-1163077
I have a request that requires the use of a 2-byte header for an SSL transaction.
Here is the wording from the spec for using the 2-byte header: For TCP/IP communications, these XML messages should be preceeded by a two-byte header that simply contains a two-binary byte length that indicates the total length of the XML message, plus two bytes for the length itself. The two-byte header should be in network byte order (most significant byte first). For example, if the XML message (including tags, CR LF vlaues, and payload was 500 bytes, place 502 binary (oxo1 oxF6) a two-byte header in the first 2 bytes of the TCP/IP send buffer, followed by all 500 bytes of the XML message.
Here is the code (using original authors example)
string payload = "*0210000001.0950003946614.MZ2003000.100340620000.5499992345678903.0908.106.0.aY.30329 4 CORPORATE SQ.....00.";
string xmlPackage = "<BinaryMsgReq>\r\n<Version>2.0</Version>\r\n<MsgSet>TEXT-EAST</MsgSet>\r\n<ProcessMode>CERT1</ProcessMode>\r\n<ClientRefNumber>0</ClientRefNumber>\r\n<Payload>" + payload + "</Payload>\r\n</BinaryMsgReq>\r\n";
//need to create 2-byte header from message sizebyte[] messsage = Encoding.UTF8.GetBytes(xmlPackage);
sslStream.Write(messsage);
sslStream.Flush();
string serverMessage = ReadMessage(sslStream);
client.Close();
Could anyone tell me how I can add the 2 byte header to this in network byte order? Thanks.
I have a request that requires the use of a 2-byte header for an SSL transaction.
Here is the wording from the spec for using the 2-byte header: For TCP/IP communications, these XML messages should be preceeded by a two-byte header that simply contains a two-binary byte length that indicates the total length of the XML message, plus two bytes for the length itself. The two-byte header should be in network byte order (most significant byte first). For example, if the XML message (including tags, CR LF vlaues, and payload was 500 bytes, place 502 binary (oxo1 oxF6) a two-byte header in the first 2 bytes of the TCP/IP send buffer, followed by all 500 bytes of the XML message.
Here is the code (using original authors example)
string payload = "*0210000001.0950003946614.MZ2003000.100340620000.5499992345678903.0908.106.0.aY.30329 4 CORPORATE SQ.....00.";
string xmlPackage = "<BinaryMsgReq>\r\n<Version>2.0</Version>\r\n<MsgSet>TEXT-EAST</MsgSet>\r\n<ProcessMode>CERT1</ProcessMode>\r\n<ClientRefNumber>0</ClientRefNumber>\r\n<Payload>" + payload + "</Payload>\r\n</BinaryMsgReq>\r\n";
//need to create 2-byte header from message sizebyte[] messsage = Encoding.UTF8.GetBytes(xmlPackage);
sslStream.Write(messsage);
sslStream.Flush();
string serverMessage = ReadMessage(sslStream);
client.Close();
Could anyone tell me how I can add the 2 byte header to this in network byte order? Thanks.