Bug32886Test.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. //
  2. // Author:
  3. // Martin Baulig <[email protected]>
  4. //
  5. // Copyright (c) 2015 Xamarin, Inc.
  6. //
  7. // Permission is hereby granted, free of charge, to any person obtaining a copy
  8. // of this software and associated documentation files (the "Software"), to deal
  9. // in the Software without restriction, including without limitation the rights
  10. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. // copies of the Software, and to permit persons to whom the Software is
  12. // furnished to do so, subject to the following conditions:
  13. //
  14. // The above copyright notice and this permission notice shall be included in
  15. // all copies or substantial portions of the Software.
  16. //
  17. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23. // THE SOFTWARE.
  24. using System;
  25. using System.Collections.Generic;
  26. using System.Globalization;
  27. using System.Linq;
  28. using System.Runtime.Serialization;
  29. using System.ServiceModel;
  30. using System.ServiceModel.Description;
  31. using System.Threading;
  32. using NUnit.Framework;
  33. using WebServiceMoonlightTest.ServiceReference1;
  34. using MonoTests.Helpers;
  35. namespace MonoTests.System.ServiceModel.Dispatcher
  36. {
  37. [TestFixture]
  38. public class Bug32886
  39. {
  40. [Test]
  41. public void Bug32886_Test () // test in one of the comment
  42. {
  43. // Init service
  44. int port = NetworkHelpers.FindFreePort ();
  45. ServiceHost serviceHost = new ServiceHost (typeof (TempConvertSoapImpl), new Uri ("http://localhost:" + port + "/TempConvertSoap"));
  46. serviceHost.AddServiceEndpoint (typeof (TempConvertSoap), new BasicHttpBinding (), string.Empty);
  47. // Enable metadata exchange (WSDL publishing)
  48. var mexBehavior = new ServiceMetadataBehavior ();
  49. mexBehavior.HttpGetEnabled = true;
  50. serviceHost.Description.Behaviors.Add (mexBehavior);
  51. serviceHost.AddServiceEndpoint (typeof (IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding (), "mex");
  52. serviceHost.Open ();
  53. try {
  54. // client
  55. var binding = new BasicHttpBinding ();
  56. var remoteAddress = new EndpointAddress ("http://localhost:" + port + "/TempConvertSoap");
  57. var client = new TempConvertSoapClient (binding, remoteAddress);
  58. var wait = new ManualResetEvent (false);
  59. Exception error = null;
  60. string result = null;
  61. client.CelsiusToFahrenheitCompleted += delegate (object o, CelsiusToFahrenheitCompletedEventArgs e) {
  62. try {
  63. error = e.Error;
  64. result = e.Error == null ? e.Result : null;
  65. } finally {
  66. wait.Set ();
  67. }
  68. };
  69. client.CelsiusToFahrenheitAsync ("24.5");
  70. Assert.IsTrue (wait.WaitOne (TimeSpan.FromSeconds (20)), "timeout");
  71. Assert.IsNull (error, "#1, inner exception: {0}", error);
  72. Assert.AreEqual ("76.1", result, "#2");
  73. } finally {
  74. serviceHost.Close ();
  75. }
  76. }
  77. class TempConvertSoapImpl : TempConvertSoap
  78. {
  79. public FahrenheitToCelsiusResponse FarenheitToCelsius (FahrenheitToCelsiusRequest request)
  80. {
  81. var farenheit = double.Parse (request.Body.Fahrenheit, CultureInfo.InvariantCulture);
  82. var celsius = ((farenheit - 32) / 9) * 5;
  83. return new FahrenheitToCelsiusResponse (new FahrenheitToCelsiusResponseBody (celsius.ToString (CultureInfo.InvariantCulture)));
  84. }
  85. public CelsiusToFahrenheitResponse CelsiusToFarenheit (CelsiusToFahrenheitRequest request)
  86. {
  87. var celsius = double.Parse (request.Body.Celsius, CultureInfo.InvariantCulture);
  88. var farenheit = ((celsius * 9) / 5) + 32;
  89. return new CelsiusToFahrenheitResponse (new CelsiusToFahrenheitResponseBody (farenheit.ToString (CultureInfo.InvariantCulture)));
  90. }
  91. Func<FahrenheitToCelsiusRequest,FahrenheitToCelsiusResponse> farenheitToCelsius;
  92. Func<CelsiusToFahrenheitRequest,CelsiusToFahrenheitResponse> celsiusToFarenheit;
  93. public IAsyncResult BeginFahrenheitToCelsius (FahrenheitToCelsiusRequest request, AsyncCallback callback, object asyncState)
  94. {
  95. if (farenheitToCelsius == null)
  96. farenheitToCelsius = new Func<FahrenheitToCelsiusRequest,FahrenheitToCelsiusResponse> (FarenheitToCelsius);
  97. return farenheitToCelsius.BeginInvoke (request, callback, asyncState);
  98. }
  99. public FahrenheitToCelsiusResponse EndFahrenheitToCelsius (IAsyncResult result)
  100. {
  101. return farenheitToCelsius.EndInvoke (result);
  102. }
  103. public IAsyncResult BeginCelsiusToFahrenheit (CelsiusToFahrenheitRequest request, AsyncCallback callback, object asyncState)
  104. {
  105. if (celsiusToFarenheit == null)
  106. celsiusToFarenheit = new Func<CelsiusToFahrenheitRequest,CelsiusToFahrenheitResponse> (CelsiusToFarenheit);
  107. return celsiusToFarenheit.BeginInvoke (request, callback, asyncState);
  108. }
  109. public CelsiusToFahrenheitResponse EndCelsiusToFahrenheit (IAsyncResult result)
  110. {
  111. return celsiusToFarenheit.EndInvoke (result);
  112. }
  113. }
  114. }
  115. }
  116. //------------------------------------------------------------------------------
  117. // <auto-generated>
  118. // This code was generated by a tool.
  119. // Runtime Version:4.0.30319.34003
  120. //
  121. // Changes to this file may cause incorrect behavior and will be lost if
  122. // the code is regenerated.
  123. // </auto-generated>
  124. //------------------------------------------------------------------------------
  125. //
  126. // This code was auto-generated by SlSvcUtil, version 5.0.61118.0
  127. //
  128. [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
  129. [System.ServiceModel.ServiceContractAttribute (Namespace = "http://www.w3schools.com/webservices/", ConfigurationName = "TempConvertSoap")]
  130. public interface TempConvertSoap
  131. {
  132. [System.ServiceModel.OperationContractAttribute (AsyncPattern = true, Action = "http://www.w3schools.com/webservices/FahrenheitToCelsius", ReplyAction = "*")]
  133. System.IAsyncResult BeginFahrenheitToCelsius (FahrenheitToCelsiusRequest request, System.AsyncCallback callback, object asyncState);
  134. FahrenheitToCelsiusResponse EndFahrenheitToCelsius (System.IAsyncResult result);
  135. [System.ServiceModel.OperationContractAttribute (AsyncPattern = true, Action = "http://www.w3schools.com/webservices/CelsiusToFahrenheit", ReplyAction = "*")]
  136. System.IAsyncResult BeginCelsiusToFahrenheit (CelsiusToFahrenheitRequest request, System.AsyncCallback callback, object asyncState);
  137. CelsiusToFahrenheitResponse EndCelsiusToFahrenheit (System.IAsyncResult result);
  138. }
  139. [System.Diagnostics.DebuggerStepThroughAttribute ()]
  140. [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
  141. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  142. [System.ServiceModel.MessageContractAttribute (IsWrapped = false)]
  143. public partial class FahrenheitToCelsiusRequest
  144. {
  145. [System.ServiceModel.MessageBodyMemberAttribute (Name = "FahrenheitToCelsius", Namespace = "http://www.w3schools.com/webservices/", Order = 0)]
  146. public FahrenheitToCelsiusRequestBody Body;
  147. public FahrenheitToCelsiusRequest ()
  148. {
  149. }
  150. public FahrenheitToCelsiusRequest (FahrenheitToCelsiusRequestBody Body)
  151. {
  152. this.Body = Body;
  153. }
  154. }
  155. [System.Diagnostics.DebuggerStepThroughAttribute ()]
  156. [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
  157. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  158. [System.Runtime.Serialization.DataContractAttribute (Namespace = "http://www.w3schools.com/webservices/")]
  159. public partial class FahrenheitToCelsiusRequestBody
  160. {
  161. [System.Runtime.Serialization.DataMemberAttribute (EmitDefaultValue = false, Order = 0)]
  162. public string Fahrenheit;
  163. public FahrenheitToCelsiusRequestBody ()
  164. {
  165. }
  166. public FahrenheitToCelsiusRequestBody (string Fahrenheit)
  167. {
  168. this.Fahrenheit = Fahrenheit;
  169. }
  170. }
  171. [System.Diagnostics.DebuggerStepThroughAttribute ()]
  172. [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
  173. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  174. [System.ServiceModel.MessageContractAttribute (IsWrapped = false)]
  175. public partial class FahrenheitToCelsiusResponse
  176. {
  177. [System.ServiceModel.MessageBodyMemberAttribute (Name = "FahrenheitToCelsiusResponse", Namespace = "http://www.w3schools.com/webservices/", Order = 0)]
  178. public FahrenheitToCelsiusResponseBody Body;
  179. public FahrenheitToCelsiusResponse ()
  180. {
  181. }
  182. public FahrenheitToCelsiusResponse (FahrenheitToCelsiusResponseBody Body)
  183. {
  184. this.Body = Body;
  185. }
  186. }
  187. [System.Diagnostics.DebuggerStepThroughAttribute ()]
  188. [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
  189. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  190. [System.Runtime.Serialization.DataContractAttribute (Namespace = "http://www.w3schools.com/webservices/")]
  191. public partial class FahrenheitToCelsiusResponseBody
  192. {
  193. [System.Runtime.Serialization.DataMemberAttribute (EmitDefaultValue = false, Order = 0)]
  194. public string FahrenheitToCelsiusResult;
  195. public FahrenheitToCelsiusResponseBody ()
  196. {
  197. }
  198. public FahrenheitToCelsiusResponseBody (string FahrenheitToCelsiusResult)
  199. {
  200. this.FahrenheitToCelsiusResult = FahrenheitToCelsiusResult;
  201. }
  202. }
  203. [System.Diagnostics.DebuggerStepThroughAttribute ()]
  204. [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
  205. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  206. [System.ServiceModel.MessageContractAttribute (IsWrapped = false)]
  207. public partial class CelsiusToFahrenheitRequest
  208. {
  209. [System.ServiceModel.MessageBodyMemberAttribute (Name = "CelsiusToFahrenheit", Namespace = "http://www.w3schools.com/webservices/", Order = 0)]
  210. public CelsiusToFahrenheitRequestBody Body;
  211. public CelsiusToFahrenheitRequest ()
  212. {
  213. }
  214. public CelsiusToFahrenheitRequest (CelsiusToFahrenheitRequestBody Body)
  215. {
  216. this.Body = Body;
  217. }
  218. }
  219. [System.Diagnostics.DebuggerStepThroughAttribute ()]
  220. [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
  221. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  222. [System.Runtime.Serialization.DataContractAttribute (Namespace = "http://www.w3schools.com/webservices/")]
  223. public partial class CelsiusToFahrenheitRequestBody
  224. {
  225. [System.Runtime.Serialization.DataMemberAttribute (EmitDefaultValue = false, Order = 0)]
  226. public string Celsius;
  227. public CelsiusToFahrenheitRequestBody ()
  228. {
  229. }
  230. public CelsiusToFahrenheitRequestBody (string Celsius)
  231. {
  232. this.Celsius = Celsius;
  233. }
  234. }
  235. [System.Diagnostics.DebuggerStepThroughAttribute ()]
  236. [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
  237. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  238. [System.ServiceModel.MessageContractAttribute (IsWrapped = false)]
  239. public partial class CelsiusToFahrenheitResponse
  240. {
  241. [System.ServiceModel.MessageBodyMemberAttribute (Name = "CelsiusToFahrenheitResponse", Namespace = "http://www.w3schools.com/webservices/", Order = 0)]
  242. public CelsiusToFahrenheitResponseBody Body;
  243. public CelsiusToFahrenheitResponse ()
  244. {
  245. }
  246. public CelsiusToFahrenheitResponse (CelsiusToFahrenheitResponseBody Body)
  247. {
  248. this.Body = Body;
  249. }
  250. }
  251. [System.Diagnostics.DebuggerStepThroughAttribute ()]
  252. [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
  253. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  254. [System.Runtime.Serialization.DataContractAttribute (Namespace = "http://www.w3schools.com/webservices/")]
  255. public partial class CelsiusToFahrenheitResponseBody
  256. {
  257. [System.Runtime.Serialization.DataMemberAttribute (EmitDefaultValue = false, Order = 0)]
  258. public string CelsiusToFahrenheitResult;
  259. public CelsiusToFahrenheitResponseBody ()
  260. {
  261. }
  262. public CelsiusToFahrenheitResponseBody (string CelsiusToFahrenheitResult)
  263. {
  264. this.CelsiusToFahrenheitResult = CelsiusToFahrenheitResult;
  265. }
  266. }
  267. [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
  268. public interface TempConvertSoapChannel : TempConvertSoap, System.ServiceModel.IClientChannel
  269. {
  270. }
  271. [System.Diagnostics.DebuggerStepThroughAttribute ()]
  272. [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
  273. public partial class FahrenheitToCelsiusCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
  274. {
  275. private object[] results;
  276. public FahrenheitToCelsiusCompletedEventArgs (object[] results, System.Exception exception, bool cancelled, object userState) :
  277. base (exception, cancelled, userState)
  278. {
  279. this.results = results;
  280. }
  281. public string Result {
  282. get {
  283. base.RaiseExceptionIfNecessary ();
  284. return ((string)(this.results [0]));
  285. }
  286. }
  287. }
  288. [System.Diagnostics.DebuggerStepThroughAttribute ()]
  289. [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
  290. public partial class CelsiusToFahrenheitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
  291. {
  292. private object[] results;
  293. public CelsiusToFahrenheitCompletedEventArgs (object[] results, System.Exception exception, bool cancelled, object userState) :
  294. base (exception, cancelled, userState)
  295. {
  296. this.results = results;
  297. }
  298. public string Result {
  299. get {
  300. base.RaiseExceptionIfNecessary ();
  301. return ((string)(this.results [0]));
  302. }
  303. }
  304. }
  305. [System.Diagnostics.DebuggerStepThroughAttribute ()]
  306. [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
  307. public partial class TempConvertSoapClient : System.ServiceModel.ClientBase<TempConvertSoap>, TempConvertSoap
  308. {
  309. private BeginOperationDelegate onBeginFahrenheitToCelsiusDelegate;
  310. private EndOperationDelegate onEndFahrenheitToCelsiusDelegate;
  311. private System.Threading.SendOrPostCallback onFahrenheitToCelsiusCompletedDelegate;
  312. private BeginOperationDelegate onBeginCelsiusToFahrenheitDelegate;
  313. private EndOperationDelegate onEndCelsiusToFahrenheitDelegate;
  314. private System.Threading.SendOrPostCallback onCelsiusToFahrenheitCompletedDelegate;
  315. private BeginOperationDelegate onBeginOpenDelegate;
  316. private EndOperationDelegate onEndOpenDelegate;
  317. private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
  318. private BeginOperationDelegate onBeginCloseDelegate;
  319. private EndOperationDelegate onEndCloseDelegate;
  320. private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
  321. public TempConvertSoapClient ()
  322. {
  323. }
  324. public TempConvertSoapClient (string endpointConfigurationName) :
  325. base (endpointConfigurationName)
  326. {
  327. }
  328. public TempConvertSoapClient (string endpointConfigurationName, string remoteAddress) :
  329. base (endpointConfigurationName, remoteAddress)
  330. {
  331. }
  332. public TempConvertSoapClient (string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
  333. base (endpointConfigurationName, remoteAddress)
  334. {
  335. }
  336. public TempConvertSoapClient (System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
  337. base (binding, remoteAddress)
  338. {
  339. }
  340. public System.Net.CookieContainer CookieContainer {
  341. get {
  342. System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager> ();
  343. if ((httpCookieContainerManager != null)) {
  344. return httpCookieContainerManager.CookieContainer;
  345. } else {
  346. return null;
  347. }
  348. }
  349. set {
  350. System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager> ();
  351. if ((httpCookieContainerManager != null)) {
  352. httpCookieContainerManager.CookieContainer = value;
  353. } else {
  354. throw new System.InvalidOperationException ("Unable to set the CookieContainer. Please make sure the binding contains an HttpC" +
  355. "ookieContainerBindingElement.");
  356. }
  357. }
  358. }
  359. public event System.EventHandler<FahrenheitToCelsiusCompletedEventArgs> FahrenheitToCelsiusCompleted;
  360. public event System.EventHandler<CelsiusToFahrenheitCompletedEventArgs> CelsiusToFahrenheitCompleted;
  361. public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> OpenCompleted;
  362. public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> CloseCompleted;
  363. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  364. System.IAsyncResult TempConvertSoap.BeginFahrenheitToCelsius (FahrenheitToCelsiusRequest request, System.AsyncCallback callback, object asyncState)
  365. {
  366. return base.Channel.BeginFahrenheitToCelsius (request, callback, asyncState);
  367. }
  368. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  369. private System.IAsyncResult BeginFahrenheitToCelsius (string Fahrenheit, System.AsyncCallback callback, object asyncState)
  370. {
  371. FahrenheitToCelsiusRequest inValue = new FahrenheitToCelsiusRequest ();
  372. inValue.Body = new FahrenheitToCelsiusRequestBody ();
  373. inValue.Body.Fahrenheit = Fahrenheit;
  374. return ((TempConvertSoap)(this)).BeginFahrenheitToCelsius (inValue, callback, asyncState);
  375. }
  376. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  377. FahrenheitToCelsiusResponse TempConvertSoap.EndFahrenheitToCelsius (System.IAsyncResult result)
  378. {
  379. return base.Channel.EndFahrenheitToCelsius (result);
  380. }
  381. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  382. private string EndFahrenheitToCelsius (System.IAsyncResult result)
  383. {
  384. FahrenheitToCelsiusResponse retVal = ((TempConvertSoap)(this)).EndFahrenheitToCelsius (result);
  385. return retVal.Body.FahrenheitToCelsiusResult;
  386. }
  387. private System.IAsyncResult OnBeginFahrenheitToCelsius (object[] inValues, System.AsyncCallback callback, object asyncState)
  388. {
  389. string Fahrenheit = ((string)(inValues [0]));
  390. return this.BeginFahrenheitToCelsius (Fahrenheit, callback, asyncState);
  391. }
  392. private object[] OnEndFahrenheitToCelsius (System.IAsyncResult result)
  393. {
  394. string retVal = this.EndFahrenheitToCelsius (result);
  395. return new object[] {
  396. retVal
  397. };
  398. }
  399. private void OnFahrenheitToCelsiusCompleted (object state)
  400. {
  401. if ((this.FahrenheitToCelsiusCompleted != null)) {
  402. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  403. this.FahrenheitToCelsiusCompleted (this, new FahrenheitToCelsiusCompletedEventArgs (e.Results, e.Error, e.Cancelled, e.UserState));
  404. }
  405. }
  406. public void FahrenheitToCelsiusAsync (string Fahrenheit)
  407. {
  408. this.FahrenheitToCelsiusAsync (Fahrenheit, null);
  409. }
  410. public void FahrenheitToCelsiusAsync (string Fahrenheit, object userState)
  411. {
  412. if ((this.onBeginFahrenheitToCelsiusDelegate == null)) {
  413. this.onBeginFahrenheitToCelsiusDelegate = new BeginOperationDelegate (this.OnBeginFahrenheitToCelsius);
  414. }
  415. if ((this.onEndFahrenheitToCelsiusDelegate == null)) {
  416. this.onEndFahrenheitToCelsiusDelegate = new EndOperationDelegate (this.OnEndFahrenheitToCelsius);
  417. }
  418. if ((this.onFahrenheitToCelsiusCompletedDelegate == null)) {
  419. this.onFahrenheitToCelsiusCompletedDelegate = new System.Threading.SendOrPostCallback (this.OnFahrenheitToCelsiusCompleted);
  420. }
  421. base.InvokeAsync (this.onBeginFahrenheitToCelsiusDelegate, new object[] {
  422. Fahrenheit
  423. }, this.onEndFahrenheitToCelsiusDelegate, this.onFahrenheitToCelsiusCompletedDelegate, userState);
  424. }
  425. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  426. System.IAsyncResult TempConvertSoap.BeginCelsiusToFahrenheit (CelsiusToFahrenheitRequest request, System.AsyncCallback callback, object asyncState)
  427. {
  428. return base.Channel.BeginCelsiusToFahrenheit (request, callback, asyncState);
  429. }
  430. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  431. private System.IAsyncResult BeginCelsiusToFahrenheit (string Celsius, System.AsyncCallback callback, object asyncState)
  432. {
  433. CelsiusToFahrenheitRequest inValue = new CelsiusToFahrenheitRequest ();
  434. inValue.Body = new CelsiusToFahrenheitRequestBody ();
  435. inValue.Body.Celsius = Celsius;
  436. return ((TempConvertSoap)(this)).BeginCelsiusToFahrenheit (inValue, callback, asyncState);
  437. }
  438. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  439. CelsiusToFahrenheitResponse TempConvertSoap.EndCelsiusToFahrenheit (System.IAsyncResult result)
  440. {
  441. return base.Channel.EndCelsiusToFahrenheit (result);
  442. }
  443. [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
  444. private string EndCelsiusToFahrenheit (System.IAsyncResult result)
  445. {
  446. CelsiusToFahrenheitResponse retVal = ((TempConvertSoap)(this)).EndCelsiusToFahrenheit (result);
  447. return retVal.Body.CelsiusToFahrenheitResult;
  448. }
  449. private System.IAsyncResult OnBeginCelsiusToFahrenheit (object[] inValues, System.AsyncCallback callback, object asyncState)
  450. {
  451. string Celsius = ((string)(inValues [0]));
  452. return this.BeginCelsiusToFahrenheit (Celsius, callback, asyncState);
  453. }
  454. private object[] OnEndCelsiusToFahrenheit (System.IAsyncResult result)
  455. {
  456. string retVal = this.EndCelsiusToFahrenheit (result);
  457. return new object[] {
  458. retVal
  459. };
  460. }
  461. private void OnCelsiusToFahrenheitCompleted (object state)
  462. {
  463. if ((this.CelsiusToFahrenheitCompleted != null)) {
  464. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  465. this.CelsiusToFahrenheitCompleted (this, new CelsiusToFahrenheitCompletedEventArgs (e.Results, e.Error, e.Cancelled, e.UserState));
  466. }
  467. }
  468. public void CelsiusToFahrenheitAsync (string Celsius)
  469. {
  470. this.CelsiusToFahrenheitAsync (Celsius, null);
  471. }
  472. public void CelsiusToFahrenheitAsync (string Celsius, object userState)
  473. {
  474. if ((this.onBeginCelsiusToFahrenheitDelegate == null)) {
  475. this.onBeginCelsiusToFahrenheitDelegate = new BeginOperationDelegate (this.OnBeginCelsiusToFahrenheit);
  476. }
  477. if ((this.onEndCelsiusToFahrenheitDelegate == null)) {
  478. this.onEndCelsiusToFahrenheitDelegate = new EndOperationDelegate (this.OnEndCelsiusToFahrenheit);
  479. }
  480. if ((this.onCelsiusToFahrenheitCompletedDelegate == null)) {
  481. this.onCelsiusToFahrenheitCompletedDelegate = new System.Threading.SendOrPostCallback (this.OnCelsiusToFahrenheitCompleted);
  482. }
  483. base.InvokeAsync (this.onBeginCelsiusToFahrenheitDelegate, new object[] {
  484. Celsius
  485. }, this.onEndCelsiusToFahrenheitDelegate, this.onCelsiusToFahrenheitCompletedDelegate, userState);
  486. }
  487. private System.IAsyncResult OnBeginOpen (object[] inValues, System.AsyncCallback callback, object asyncState)
  488. {
  489. return ((System.ServiceModel.ICommunicationObject)(this)).BeginOpen (callback, asyncState);
  490. }
  491. private object[] OnEndOpen (System.IAsyncResult result)
  492. {
  493. ((System.ServiceModel.ICommunicationObject)(this)).EndOpen (result);
  494. return null;
  495. }
  496. private void OnOpenCompleted (object state)
  497. {
  498. if ((this.OpenCompleted != null)) {
  499. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  500. this.OpenCompleted (this, new System.ComponentModel.AsyncCompletedEventArgs (e.Error, e.Cancelled, e.UserState));
  501. }
  502. }
  503. public void OpenAsync ()
  504. {
  505. this.OpenAsync (null);
  506. }
  507. public void OpenAsync (object userState)
  508. {
  509. if ((this.onBeginOpenDelegate == null)) {
  510. this.onBeginOpenDelegate = new BeginOperationDelegate (this.OnBeginOpen);
  511. }
  512. if ((this.onEndOpenDelegate == null)) {
  513. this.onEndOpenDelegate = new EndOperationDelegate (this.OnEndOpen);
  514. }
  515. if ((this.onOpenCompletedDelegate == null)) {
  516. this.onOpenCompletedDelegate = new System.Threading.SendOrPostCallback (this.OnOpenCompleted);
  517. }
  518. base.InvokeAsync (this.onBeginOpenDelegate, null, this.onEndOpenDelegate, this.onOpenCompletedDelegate, userState);
  519. }
  520. private System.IAsyncResult OnBeginClose (object[] inValues, System.AsyncCallback callback, object asyncState)
  521. {
  522. return ((System.ServiceModel.ICommunicationObject)(this)).BeginClose (callback, asyncState);
  523. }
  524. private object[] OnEndClose (System.IAsyncResult result)
  525. {
  526. ((System.ServiceModel.ICommunicationObject)(this)).EndClose (result);
  527. return null;
  528. }
  529. private void OnCloseCompleted (object state)
  530. {
  531. if ((this.CloseCompleted != null)) {
  532. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  533. this.CloseCompleted (this, new System.ComponentModel.AsyncCompletedEventArgs (e.Error, e.Cancelled, e.UserState));
  534. }
  535. }
  536. public void CloseAsync ()
  537. {
  538. this.CloseAsync (null);
  539. }
  540. public void CloseAsync (object userState)
  541. {
  542. if ((this.onBeginCloseDelegate == null)) {
  543. this.onBeginCloseDelegate = new BeginOperationDelegate (this.OnBeginClose);
  544. }
  545. if ((this.onEndCloseDelegate == null)) {
  546. this.onEndCloseDelegate = new EndOperationDelegate (this.OnEndClose);
  547. }
  548. if ((this.onCloseCompletedDelegate == null)) {
  549. this.onCloseCompletedDelegate = new System.Threading.SendOrPostCallback (this.OnCloseCompleted);
  550. }
  551. base.InvokeAsync (this.onBeginCloseDelegate, null, this.onEndCloseDelegate, this.onCloseCompletedDelegate, userState);
  552. }
  553. protected override TempConvertSoap CreateChannel ()
  554. {
  555. return new TempConvertSoapClientChannel (this);
  556. }
  557. private class TempConvertSoapClientChannel : ChannelBase<TempConvertSoap>, TempConvertSoap
  558. {
  559. public TempConvertSoapClientChannel (System.ServiceModel.ClientBase<TempConvertSoap> client) :
  560. base (client)
  561. {
  562. }
  563. public System.IAsyncResult BeginFahrenheitToCelsius (FahrenheitToCelsiusRequest request, System.AsyncCallback callback, object asyncState)
  564. {
  565. object[] _args = new object[1];
  566. _args [0] = request;
  567. System.IAsyncResult _result = base.BeginInvoke ("FahrenheitToCelsius", _args, callback, asyncState);
  568. return _result;
  569. }
  570. public FahrenheitToCelsiusResponse EndFahrenheitToCelsius (System.IAsyncResult result)
  571. {
  572. object[] _args = new object[0];
  573. FahrenheitToCelsiusResponse _result = ((FahrenheitToCelsiusResponse)(base.EndInvoke ("FahrenheitToCelsius", _args, result)));
  574. return _result;
  575. }
  576. public System.IAsyncResult BeginCelsiusToFahrenheit (CelsiusToFahrenheitRequest request, System.AsyncCallback callback, object asyncState)
  577. {
  578. object[] _args = new object[1];
  579. _args [0] = request;
  580. System.IAsyncResult _result = base.BeginInvoke ("CelsiusToFahrenheit", _args, callback, asyncState);
  581. return _result;
  582. }
  583. public CelsiusToFahrenheitResponse EndCelsiusToFahrenheit (System.IAsyncResult result)
  584. {
  585. object[] _args = new object[0];
  586. CelsiusToFahrenheitResponse _result = ((CelsiusToFahrenheitResponse)(base.EndInvoke ("CelsiusToFahrenheit", _args, result)));
  587. return _result;
  588. }
  589. }
  590. }