public static T Invoke <T>(string url, string methodName, params object[] args)
        {
            object proxy = CreateServiceProxyInstance(url);

            object[] realArgs = GetArgs(args, proxy.GetType().Assembly);
            if (typeof(T).IsValueType)
            {
                T             obj      = default(T);
                bool          hasValue = false;
                List <object> list     = new List <object>(realArgs);
                list.Add(obj);
                list.Add(hasValue);
                object[]   x  = list.ToArray();
                MethodInfo me = proxy.GetType().GetMethod(methodName);
                me.Invoke(proxy, x);
                hasValue = (bool)x[x.Length - 1];
                if (hasValue)
                {
                    object tmp = x[x.Length - 2];
                    return((T)SoapEntityMapping.ConvertFromSoapObject(tmp, typeof(T)));
                }
                else
                {
                    return(default(T));
                }
            }
            else
            {
                object tmp = Invoker.MethodInvoke(proxy, methodName, realArgs);
                return((T)SoapEntityMapping.ConvertFromSoapObject(tmp, typeof(T)));
            }
        }
        public static void InvokeAsync <T>(string url, string methodName, Action <T> callback, Action <Exception> errorHandler, params object[] args)
        {
            object proxy = CreateServiceProxyInstance(url);

            object[] realArgs        = GetArgs(args, proxy.GetType().Assembly);
            Type     t               = proxy.GetType();
            string   beginMethodName = "Begin" + methodName;
            string   endMethodName   = "End" + methodName;
            //MethodInfo beginMethod = t.GetMethod("Begin" + methodName);
            MethodInfo    endMethod = t.GetMethod(endMethodName);
            AsyncCallback cb        = ar =>
            {
                T    obj      = default(T);
                bool hasError = false;
                try
                {
                    if (typeof(T).IsValueType)
                    {
                        bool     hasValue = false;
                        object[] args1    = new object[] { ar, obj, hasValue };
                        endMethod.Invoke(ar.AsyncState, args1);
                        hasValue = (bool)args1[2];
                        if (hasValue)
                        {
                            obj = (T)SoapEntityMapping.ConvertFromSoapObject(args1[1], typeof(T));
                        }
                        else
                        {
                            obj = default(T);
                        }
                    }
                    else
                    {
                        object tmp = Invoker.MethodInvoke(ar.AsyncState, endMethodName, ar);
                        obj = (T)SoapEntityMapping.ConvertFromSoapObject(tmp, typeof(T));
                    }
                }
                catch (Exception ex)
                {
                    hasError = true;
                    if (errorHandler != null)
                    {
                        errorHandler(ex);
                    }
                }
                if (hasError == false && callback != null)
                {
                    callback(obj);
                }
            };
            List <object> list = new List <object>(realArgs);

            list.Add(cb);
            list.Add(proxy);
            Invoker.MethodInvoke(proxy, beginMethodName, list.ToArray());
        }