protected IAsyncResult BeginInvoke (string methodName, object[] parameters, AsyncCallback callback, object asyncState)
		{
			SoapMethodStubInfo msi = (SoapMethodStubInfo) type_info.GetMethod (methodName);

			SoapWebClientAsyncResult ainfo = null;
			try
			{
				SoapClientMessage message = new SoapClientMessage (this, msi, Url, parameters);
				message.CollectHeaders (this, message.MethodStubInfo.Headers, SoapHeaderDirection.In);
				
				WebRequest request = GetRequestForMessage (uri, message);
				
				ainfo = new SoapWebClientAsyncResult (request, callback, asyncState);
				ainfo.Message = message;
				ainfo.Extensions = SoapExtension.CreateExtensionChain (type_info.SoapExtensions[0], msi.SoapExtensions, type_info.SoapExtensions[1]);

				ainfo.Request.BeginGetRequestStream (new AsyncCallback (AsyncGetRequestStreamDone), ainfo);
			}
			catch (Exception ex)
			{
				if (ainfo != null)
					ainfo.SetCompleted (null, ex, false);
			}

			return ainfo;
		}
Exemple #2
0
        protected IAsyncResult BeginInvoke(string methodName, object[] parameters, AsyncCallback callback, object asyncState)
        {
            SoapMethodStubInfo msi = (SoapMethodStubInfo)type_info.GetMethod(methodName);

            SoapWebClientAsyncResult ainfo = null;

            try
            {
                SoapClientMessage message = new SoapClientMessage(this, msi, Url, parameters);
                message.CollectHeaders(this, message.MethodStubInfo.Headers, SoapHeaderDirection.In);

                WebRequest request = GetRequestForMessage(uri, message);

                ainfo            = new SoapWebClientAsyncResult(request, callback, asyncState);
                ainfo.Message    = message;
                ainfo.Extensions = SoapExtension.CreateExtensionChain(type_info.SoapExtensions[0], msi.SoapExtensions, type_info.SoapExtensions[1]);

                ainfo.Request.BeginGetRequestStream(new AsyncCallback(AsyncGetRequestStreamDone), ainfo);
                RegisterMapping(asyncState, ainfo);
            }
            catch (Exception ex)
            {
                if (ainfo != null)
                {
                    ainfo.SetCompleted(null, ex, false);
                }
            }

            return(ainfo);
        }
Exemple #3
0
        protected object[] Invoke(string method_name, object[] parameters)
        {
            SoapMethodStubInfo msi = (SoapMethodStubInfo)type_info.GetMethod(method_name);

            SoapClientMessage message = new SoapClientMessage(this, msi, Url, parameters);

            message.CollectHeaders(this, message.MethodStubInfo.Headers, SoapHeaderDirection.In);

            SoapExtension[] extensions = SoapExtension.CreateExtensionChain(type_info.SoapExtensions[0], msi.SoapExtensions, type_info.SoapExtensions[1]);

            WebResponse response;

            try
            {
                WebRequest request = GetRequestForMessage(uri, message);
                SendRequest(request.GetRequestStream(), message, extensions);
                response = GetWebResponse(request);
            }
            catch (WebException ex)
            {
                response = ex.Response;
                HttpWebResponse http_response = response as HttpWebResponse;
                if (http_response == null || http_response.StatusCode != HttpStatusCode.InternalServerError)
                {
                    throw ex;
                }
            }

            try {
                return(ReceiveResponse(response, message, extensions));
            }
            finally {
                response.Close();
            }
        }
		protected object[] Invoke (string method_name, object[] parameters)
		{
			SoapMethodStubInfo msi = (SoapMethodStubInfo) type_info.GetMethod (method_name);
			
			SoapClientMessage message = new SoapClientMessage (this, msi, Url, parameters);
			message.CollectHeaders (this, message.MethodStubInfo.Headers, SoapHeaderDirection.In);

			SoapExtension[] extensions = SoapExtension.CreateExtensionChain (type_info.SoapExtensions[0], msi.SoapExtensions, type_info.SoapExtensions[1]);

			WebResponse response;
			try
			{
				WebRequest request = GetRequestForMessage (uri, message);
				SendRequest (request.GetRequestStream (), message, extensions);
				response = GetWebResponse (request);
			}
			catch (WebException ex)
			{
				response = ex.Response;
				HttpWebResponse http_response = response as HttpWebResponse;
				if (http_response == null || http_response.StatusCode != HttpStatusCode.InternalServerError)
					throw ex;
			}

			try {
				return ReceiveResponse (response, message, extensions);
			}
			finally {
				response.Close();
			}
		}