Esempio n. 1
0
        public StockQuoteService()
        {
            binding = new BasicHttpBinding
            {
                SendTimeout            = TimeSpan.FromSeconds(10000),
                MaxBufferSize          = int.MaxValue,
                MaxReceivedMessageSize = int.MaxValue,
                AllowCookies           = true,
                ReaderQuotas           = XmlDictionaryReaderQuotas.Max
            };

            binding.Security.Mode = BasicHttpSecurityMode.None;

            client = new DelayedStockQuoteSoapClient(binding, address);
        }
 public DelayedStockQuoteSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(DelayedStockQuoteSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
 public DelayedStockQuoteSoapClient(EndpointConfiguration endpointConfiguration) :
     base(DelayedStockQuoteSoapClient.GetBindingForEndpoint(endpointConfiguration), DelayedStockQuoteSoapClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
        public Form1()
        {
            var delayedStock = new DelayedStockQuoteSoapClient();
            Controls.Add(new Service("DelayedStockQuoteSoapClient/QuickQuote", "GOOG",
                async s => (await delayedStock.GetQuickQuoteAsync(s, "0")).ToString(CultureInfo.CurrentCulture)));
            Controls.Add(new Service("DelayedStockQuoteSoapClient/Quote", "GOOG",
                async s => (await delayedStock.GetQuoteAsync(s, "0")).ChangePercent));
            var ip2GeoSoap = new P2GeoSoapClient();
            Controls.Add(new Service("IP2GeoSoap/IP", "213.180.141.140",
                async s => (await ip2GeoSoap.ResolveIPAsync(s, "0")).City));
            //-> http://www.webservicex.net/ConvertTemperature.asmx?WSDL
            var temperature = new ConvertTemperatureSoapClient();
            Controls.Add(new Service("ConvTemp", "0",
                async s =>
                    (await
                        temperature.ConvertTempAsync(double.Parse(s), TemperatureUnit.degreeCelsius,
                            TemperatureUnit.kelvin)).ToString(CultureInfo.CurrentCulture)));
            //-> WSDL
            var curControl = new CurrencyConvertorSoapClient();
            Controls.Add(new Service("CurrConv", "5",
                async s => (double.Parse(s) * await curControl.ConversionRateAsync(Currency.USD, Currency.EUR)).ToString(CultureInfo.InvariantCulture)));

            var weather = new GlobalWeatherSoapClient();
            Controls.Add(new Service("Weather", "Szczecin", async s =>
            {
                var xml = await weather.GetWeatherAsync(s, "Poland");
                return CurrentWeather.ConvertXml(xml).Temperature;
            }));

            var runall = new Button { Text = "Run all", Dock = DockStyle.Bottom };
            runall.Click += (s, ev) => { Service.GoAll(); };
            Controls.Add(runall);
        }
Esempio n. 5
0
 public void ServiceOne()
 {
     var serviceClient = new DelayedStockQuoteSoapClient("DelayedStockQuoteSoap");
     var google        = serviceClient.GetQuickQuote("GOOG", "0");
 }
Esempio n. 6
0
 public void ServiceOne()
 {
     var serviceClient = new DelayedStockQuoteSoapClient("DelayedStockQuoteSoap");
     var google = serviceClient.GetQuickQuote("GOOG", "0");
     
 }