protected IAsyncResult BeginInvoke(string methodName, string requestUrl, object[] parameters, AsyncCallback callback, object asyncState) { HttpSimpleMethodStubInfo method = (HttpSimpleMethodStubInfo)TypeStub.GetMethod(methodName); SimpleWebClientAsyncResult ainfo = null; try { MimeParameterWriter parameterWriter = (MimeParameterWriter)method.ParameterWriterType.Create(); string url = parameterWriter.GetRequestUrl(requestUrl, parameters); WebRequest req = GetWebRequest(new Uri(url)); ainfo = new SimpleWebClientAsyncResult(req, callback, asyncState); ainfo.Parameters = parameters; ainfo.ParameterWriter = parameterWriter; ainfo.Method = method; ainfo.Request = req; ainfo.Request.BeginGetRequestStream(new AsyncCallback(AsyncGetRequestStreamDone), ainfo); RegisterMapping(asyncState, ainfo); } catch (Exception ex) { if (ainfo != null) { ainfo.SetCompleted(null, ex, false); } else { throw ex; } } return(ainfo); }
internal override MethodStubInfo GetRequestMethod(HttpContext context) { string name = context.Request.PathInfo; if (name.StartsWith("/")) { name = name.Substring(1); } method = (HttpSimpleMethodStubInfo)_typeInfo.GetMethod(name); if (method == null) { WriteError(context, "Method " + name + " not defined in service " + ServiceType.Name); } return(method); }