예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="values"></param>
        public void CallMethod(object[] values)
        {
            //  Initialize the call

            DynamicWebServiceProxy wsp = new DynamicWebServiceProxy();

            wsp.EnableMessageAccess = true;
            wsp.Wsdl       = _theMethod.Parent.Parent.WSDL;
            wsp.TypeName   = _theMethod.Parent.Name;
            wsp.MethodName = _theMethod.Name;
            wsp.Url        = new Uri(_theMethod.Parent.Parent.EndPoint);
            foreach (object o in values)
            {
                wsp.AddParameter(o);
            }

            //  Make the call
            try
            {
                object result = wsp.InvokeCall();
                _listener.HandleCall(_theMethod, values, wsp.SoapRequest, wsp.SoapResponse, null);
            }
            catch (Exception ex)
            {
                // System.Console.WriteLine("Exception while invoking call: {0}", ex.Message);
                _listener.HandleCall(_theMethod, values, wsp.SoapRequest, wsp.SoapResponse, ex.InnerException);
            }
        }
예제 #2
0
        private void bnInvoke_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            try
            {
                Init();

                HiResTimer hrt = new HiResTimer();

                hrt.Start();
                object result = wsp.InvokeCall();
                hrt.Stop();

                tbElapsedTime.Text = hrt.ElapsedMicroseconds.ToString();
                tbResult.Text      = result.ToString();

                if (wsp.EnableMessageAccess)
                {
                    string tmpReqFile  = SaveRequestToTempFile(wsp.SoapRequest);
                    string tmpRespFile = SaveResponseToTempFile(wsp.SoapResponse);

                    object obj = null;
                    webBrowserRequest.Navigate("file://" + tmpReqFile, ref obj, ref obj, ref obj, ref obj);
                    webBrowserResponse.Navigate("file://" + tmpRespFile, ref obj, ref obj, ref obj, ref obj);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            this.Cursor = Cursors.Default;
        }