//
return objArrReturn;
}
}
}
后台部分
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using LY.TEC.Core.Configuration;
using LY.TEC.Framework.Common.Container;
using LY.TEC.MicroKernel;
namespace LY.TEC.WSCommunication
{
public class InvokeServerComponent : IInvokeServerComponent
{
private CompressUtil mCompress = new CompressUtil();
private IKernel mKernel = null;
private static Hashtable mCompMaps = Hashtable.Synchronized(new Hashtable());
public InvokeServerComponent(IKernel kernal)
{
mKernel = kernal;
}
public object[] InvokeMethod(object[] args)
{
// 1.解压调用参数
object[] objArrParams = (object[])mCompress.DecryptDecompressObject((byte[])args[0], (byte[])args[1]);
//
string strInterfacename = objArrParams[0] as string;
string strMethodname = objArrParams[1] as string;
object[] objMethodArgs = objArrParams[2] as object[];
// 2. 从容器获取对象
object[] objArrReturn = CallFromIoc(strInterfacename, strMethodname, objMethodArgs);
// 3. 压缩加密
byte[] returnData = null;
byte[] byteCryptanalyze = null;
mCompress.CompressEncryptObject(objArrReturn, ref returnData, ref byteCryptanalyze);
// 压缩后的数据封装为对象数组
object[] objArrCompressedReturn = new object[] { returnData, byteCryptanalyze };
//
return objArrCompressedReturn;