Esempio n. 1
0
 public P2GeoSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(P2GeoSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     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. 3
0
 public P2GeoSoapClient(EndpointConfiguration endpointConfiguration) :
     base(P2GeoSoapClient.GetBindingForEndpoint(endpointConfiguration), P2GeoSoapClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }