Exemple #1
0
 public byte[] SerializedCall(object hostObject, ICallBoxDecoder decoder, byte[] data)
 {
     try
     {
         decoder.Parse(data);
     }
     catch(Exception ex)
     {
         return decoder.GetExceptionResponse(ex);
     }
     return SerializedCall(hostObject, decoder);
 }
Exemple #2
0
        public byte[] SerializedCall(object hostObject, ICallBoxDecoder decoder)
        {
            try
            {
                string methodName = decoder.GetMethodName();
                CallInfoCacheItem mici;
                if (CallMap.TryGetValue(methodName, out mici) == false)
                    throw new Exception("MethodName: " + methodName + " not found");

                // build parameters
                object[] callparams = BuildSerializedParameters(decoder, mici);

                object ret = mici.Call(hostObject, callparams);
                //object ret = methodinfo.Invoke(hostObject, BindingFlags.ExactBinding, null, callparams, null);

                if (mici.HasReturn)
                    return decoder.GetOKResponse(ret);
                return null;
            }
            catch (Exception ex)
            {
                return decoder.GetExceptionResponse(ex);
            }
        }