|
The easiest way to use 2-en-serialized sequence into Byte []
Then the WebService end is reverse sely, the array of objects you want. After the call is completed, sequentially become BYTE [] Return, the client is retrograde sequence to get the result.
[WebMethod]
Public Byte [] WebInvoke (Byte [] DATA)
{
}
Public Class Serializer
{
Private binaryformatter bf;
Public serializer ()
{
THIS.BF = New binaryformatter ();
}
Public Byte [] binaryserialize (Object Obj)
{
IF (Obj == Null)
{
Throw new argumentnullexception ("obj");
}
MemoryStream Stream1 = new memoryStream ();
THIS.BF.SERIALIZE (stream1, obj);
Return stream1.toArray ();
}
Public Object BinaryDeserialize (Byte [] DATA)
{
IF (data == null)
{
Return NULL;
}
MemoryStream Stream1 = New MemoryStream (DATA);
Return this.bf.deSerialize (stream1);
}
} |
|