Exemple #1
0
        public void LoggingWebserviceTest()
        {
            var log = loggerFactory.CreateLogger <SampleWebServiceSoap>();

            using (var svc = new SampleWebServiceSoapClient(SampleWebServiceSoapClient.EndpointConfiguration.SampleWebServiceSoap, webserviceUrl))
            {
                svc.AddLog(log, LogLevel.Information);
                log.LogInformation("Here the current time: {CurrentTime}", svc.GetCurrentTimeAsync().Result);
                log.LogInformation("Here the sample object: {SampleObject}", svc.GetSampleObjectAsync(1).Result);
            }
        }
        protected void btnCalculate_Click(object sender, EventArgs e)
        {
            //connect to web service
            SampleWebServiceSoapClient client = new SampleWebServiceSoapClient();

            //call web service method based on user params and place result in string variable
            WebServiceResponse response = client.Calculator(Convert.ToInt32(txtFirstValue.Text), Convert.ToInt32(txtSecondValue.Text), txtOperation.Text);

            if (response.Result != string.Empty)
            {
                lblResult.Text = "Result: <b style ='color:Green'>" + response.Result + "</b>";
            }
            else
            {
                lblResult.Text = "Exception: <b style ='color:Red'>" + response.ErrorMessage + "</b>";
            }
        }