public OutgoingMessageBody Serialize(IServiceRemotingResponseMessageBody serviceRemotingResponseMessageBody) { if (serviceRemotingResponseMessageBody == null) { return(null); } using (var stream = new SegmentedPoolMemoryStream(this.bufferPoolManager)) { using (var writer = XmlDictionaryWriter.CreateBinaryWriter(stream)) { this.serializer.WriteObject(writer, serviceRemotingResponseMessageBody); writer.Flush(); return(new OutgoingMessageBody(stream.GetBuffers())); } } }
public IMessageHeader SerializeRequestHeader(IServiceRemotingRequestMessageHeader serviceRemotingRequestMessageHeader) { if (serviceRemotingRequestMessageHeader == null) { return(null); } using (var stream = new SegmentedPoolMemoryStream(this.bufferPoolManager)) { using (var writer = XmlDictionaryWriter.CreateBinaryWriter(stream)) { this.requestHeaderSerializer.WriteObject(writer, serviceRemotingRequestMessageHeader); writer.Flush(); return(new OutgoingMessageHeader(stream.GetBuffers())); } } }