O2 Script: consume webservices by using the WSDL’s C#
(as a follow from O2 Script: Using Reflection to Invoke Bing Search Web Service) Here is how one can consume webservices by using a (previously created) C# of the WSDL:
var _GlobalWeather = new GlobalWeather();
_GlobalWeather.GetWeather("Porto", "Portugal");
return _GlobalWeather;
//O2File:C:\O2\_tempDir\4-3-2011\wsdl_tmpC7EC\GlobalWeather.cs
//O2Ref:System.Web.Services.dll
//Note: the GlobalWeather.cs file was created with the command:
//
// return new DotNet_SDK_WSDL().wsdl_CreateCSharp("http://www.webservicex.net/globalweather.asmx?WSDL");
// //O2File:DotNet_SDK_WSDL.cs
// //using O2.XRules.Database.Languages_and_Frameworks.DotNet
Here is Bing API version, note how (when compared with this version (O2 Script: Using Reflection to Invoke Bing Search Web Service) which is reflection based) all variable references are strongly typed)
var AppID = @"C:\O2\_USERDATA\accounts.xml".credential("Bing_API").password();</pre>
var _BingService = new BingService();
var _parameters = new SearchRequest();
_parameters.AppId = AppID;
_parameters.Sources = new SourceType[] { SourceType.Web };
_parameters.Query = "OWASP";
var response = _BingService.Search(_parameters );
return response.Web.Results;
//O2File:C:\O2\_tempDir\4-3-2011\wsdl_tmp107F\BingService.cs
//O2Ref:System.Web.Services.dll
//O2File:SecretData_ExtensionMethods.cs


[...] O2 Script: consume webservices by using the WSDL’s C# [...]