Bug652331_2Test.cs 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. //
  2. // Authors:
  3. // David Straw
  4. // Atsushi Enomoto <[email protected]>
  5. //
  6. // Copyright (C) 2011 Novell, Inc. http://www.novell.com
  7. //
  8. // Permission is hereby granted, free of charge, to any person obtaining
  9. // a copy of this software and associated documentation files (the
  10. // "Software"), to deal in the Software without restriction, including
  11. // without limitation the rights to use, copy, modify, merge, publish,
  12. // distribute, sublicense, and/or sell copies of the Software, and to
  13. // permit persons to whom the Software is furnished to do so, subject to
  14. // the following conditions:
  15. //
  16. // The above copyright notice and this permission notice shall be
  17. // included in all copies or substantial portions of the Software.
  18. //
  19. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  20. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  22. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  23. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  24. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  25. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26. //
  27. using System;
  28. using System.Collections.Generic;
  29. using System.Collections.ObjectModel;
  30. using System.Linq;
  31. using System.Runtime.Serialization;
  32. using System.ServiceModel;
  33. using System.ServiceModel.Description;
  34. using System.Threading;
  35. using NUnit.Framework;
  36. using WebServiceMoonlightTest.ServiceReference2;
  37. using MonoTests.Helpers;
  38. namespace MonoTests.System.ServiceModel.Dispatcher
  39. {
  40. [TestFixture]
  41. public class Bug652331_2Test
  42. {
  43. [Test]
  44. [Category ("NotWorking")]
  45. public void Bug652331_3 ()
  46. {
  47. // Init service
  48. ServiceHost serviceHost = new ServiceHost(typeof(Service1), new Uri("http://localhost:" + NetworkHelpers.FindFreePort () + "/Service1"));
  49. serviceHost.AddServiceEndpoint(typeof(IService1), new BasicHttpBinding(), string.Empty);
  50. // Enable metadata exchange (WSDL publishing)
  51. ServiceMetadataBehavior mexBehavior = new ServiceMetadataBehavior();
  52. mexBehavior.HttpGetEnabled = true;
  53. serviceHost.Description.Behaviors.Add(mexBehavior);
  54. serviceHost.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex");
  55. serviceHost.Open();
  56. try {
  57. RunClient ();
  58. } finally {
  59. serviceHost.Close ();
  60. }
  61. }
  62. void RunClient ()
  63. {
  64. var binding = new BasicHttpBinding ();
  65. var remoteAddress = new EndpointAddress ("http://localhost:" + NetworkHelpers.FindFreePort () + "/Service1");
  66. var normalClient = new Service1Client (binding, remoteAddress);
  67. var collectionClient = new Service1Client (binding, remoteAddress);
  68. var nestedClient = new Service1Client (binding, remoteAddress);
  69. var dbClient = new Service1Client (binding, remoteAddress);
  70. var waits = new ManualResetEvent [4];
  71. for (int i = 0; i < waits.Length; i++)
  72. waits [i] = new ManualResetEvent (false);
  73. int passed = 0;
  74. normalClient.GetDataCompleted += delegate (object o, GetDataCompletedEventArgs e) {
  75. if (e.Error != null) {
  76. Assert.Fail ("Normal failed; error: {0}", e.Error);
  77. throw e.Error;
  78. }
  79. Assert.AreEqual ("A", ((DataType1) e.Result).Id, "Normal");
  80. Interlocked.Increment (ref passed);
  81. waits [0].Set ();
  82. };
  83. normalClient.GetDataAsync ();
  84. collectionClient.GetCollectionDataCompleted += delegate (object sender, GetCollectionDataCompletedEventArgs e) {
  85. if (e.Error != null) {
  86. Assert.Fail ("Collection failed; error: {0}", e.Error);
  87. throw e.Error;
  88. }
  89. Assert.AreEqual ("B,C", ItemsToString (e.Result.Cast<DataType1> ()), "Collection");
  90. Interlocked.Increment (ref passed);
  91. waits [1].Set ();
  92. };
  93. collectionClient.GetCollectionDataAsync ();
  94. nestedClient.GetNestedDataCompleted += delegate (object sender, GetNestedDataCompletedEventArgs e) {
  95. if (e.Error != null) {
  96. Assert.Fail ("Nested failed; error: {0}", e.Error);
  97. throw e.Error;
  98. }
  99. Assert.AreEqual ("D,E", ItemsToString (e.Result.Items.Cast<DataType1> ()), "Nested");
  100. Interlocked.Increment (ref passed);
  101. waits [2].Set ();
  102. };
  103. nestedClient.GetNestedDataAsync ();
  104. dbClient.JSMGetDatabasesCompleted += delegate (object sender, JSMGetDatabasesCompletedEventArgs e) {
  105. waits [3].Set ();
  106. if (e.Error != null) {
  107. throw e.Error;
  108. }
  109. Assert.AreEqual ("databases", e.Result, "Databases");
  110. Interlocked.Increment (ref passed);
  111. };
  112. dbClient.JSMGetDatabasesAsync();
  113. WaitHandle.WaitAll (waits, TimeSpan.FromMinutes (1));
  114. if (passed != waits.Length)
  115. Assert.Fail ("Not all tests passed!");
  116. }
  117. string ItemsToString (IEnumerable<DataType1> items)
  118. {
  119. return items.Aggregate ((string) null, (result, item) => result == null ? item.Id : result + "," + item.Id);
  120. }
  121. }
  122. public class Service1 : IService1
  123. {
  124. public object GetData()
  125. {
  126. return new DataType1 { Id = "A" };
  127. }
  128. Func<object> gd;
  129. public IAsyncResult BeginGetData(AsyncCallback cb, object st)
  130. {
  131. gd = new Func<object> (GetData);
  132. return gd.BeginInvoke (cb, st);
  133. }
  134. public object EndGetData (IAsyncResult result)
  135. {
  136. return gd.EndInvoke (result);
  137. }
  138. public ObservableCollection<object> GetCollectionData()
  139. {
  140. return new ObservableCollection<object> { new DataType1 { Id = "B" }, new DataType1 { Id = "C" } };
  141. }
  142. Func<ObservableCollection<object>> gcd;
  143. public IAsyncResult BeginGetCollectionData(AsyncCallback cb, object st)
  144. {
  145. gcd = new Func<ObservableCollection<object>> (GetCollectionData);
  146. return gcd.BeginInvoke (cb, st);
  147. }
  148. public ObservableCollection<object> EndGetCollectionData (IAsyncResult result)
  149. {
  150. return gcd.EndInvoke (result);
  151. }
  152. public DataType2 GetNestedData()
  153. {
  154. return new DataType2 { Items = new ObservableCollection<object> { new DataType1 { Id = "D" }, new DataType1 { Id = "E" } } };
  155. }
  156. Func<DataType2> gnd;
  157. public IAsyncResult BeginGetNestedData(AsyncCallback cb, object st)
  158. {
  159. gnd = new Func<DataType2> (GetNestedData);
  160. return gnd.BeginInvoke (cb, st);
  161. }
  162. public DataType2 EndGetNestedData (IAsyncResult result)
  163. {
  164. return gnd.EndInvoke (result);
  165. }
  166. public JSMGetDatabasesResponse JSMGetDatabases(JSMGetDatabasesRequest request)
  167. {
  168. return new JSMGetDatabasesResponse { JSMGetDatabasesResult = "databases" };
  169. }
  170. Func<JSMGetDatabasesRequest, JSMGetDatabasesResponse> gjgdb;
  171. public IAsyncResult BeginJSMGetDatabases(JSMGetDatabasesRequest request, AsyncCallback callback, object asyncState)
  172. {
  173. gjgdb = JSMGetDatabases;
  174. return gjgdb.BeginInvoke (request, callback, asyncState);
  175. }
  176. public JSMGetDatabasesResponse EndJSMGetDatabases(IAsyncResult result)
  177. {
  178. return gjgdb.EndInvoke (result);
  179. }
  180. }
  181. }
  182. //------------------------------------------------------------------------------
  183. // <auto-generated>
  184. // This code was generated by a tool.
  185. // Runtime Version:4.0.30319.372
  186. //
  187. // Changes to this file may cause incorrect behavior and will be lost if
  188. // the code is regenerated.
  189. // </auto-generated>
  190. //------------------------------------------------------------------------------
  191. //
  192. // This code was auto-generated by Microsoft.Silverlight.ServiceReference, version 4.0.50826.0
  193. //
  194. namespace WebServiceMoonlightTest.ServiceReference2 {
  195. using System.Runtime.Serialization;
  196. [System.Diagnostics.DebuggerStepThroughAttribute()]
  197. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
  198. [System.Runtime.Serialization.DataContractAttribute(Name="DataType1", Namespace="http://mynamespace")]
  199. public partial class DataType1 : object, System.ComponentModel.INotifyPropertyChanged {
  200. private string IdField;
  201. [System.Runtime.Serialization.DataMemberAttribute()]
  202. public string Id {
  203. get {
  204. return this.IdField;
  205. }
  206. set {
  207. if ((object.ReferenceEquals(this.IdField, value) != true)) {
  208. this.IdField = value;
  209. this.RaisePropertyChanged("Id");
  210. }
  211. }
  212. }
  213. public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
  214. protected void RaisePropertyChanged(string propertyName) {
  215. System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
  216. if ((propertyChanged != null)) {
  217. propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
  218. }
  219. }
  220. }
  221. [System.Diagnostics.DebuggerStepThroughAttribute()]
  222. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
  223. [System.Runtime.Serialization.DataContractAttribute(Name="DataType2", Namespace="http://mynamespace")]
  224. [System.Runtime.Serialization.KnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
  225. [System.Runtime.Serialization.KnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
  226. public partial class DataType2 : object, System.ComponentModel.INotifyPropertyChanged {
  227. private System.Collections.ObjectModel.ObservableCollection<object> ItemsField;
  228. [System.Runtime.Serialization.DataMemberAttribute()]
  229. public System.Collections.ObjectModel.ObservableCollection<object> Items {
  230. get {
  231. return this.ItemsField;
  232. }
  233. set {
  234. if ((object.ReferenceEquals(this.ItemsField, value) != true)) {
  235. this.ItemsField = value;
  236. this.RaisePropertyChanged("Items");
  237. }
  238. }
  239. }
  240. public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
  241. protected void RaisePropertyChanged(string propertyName) {
  242. System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
  243. if ((propertyChanged != null)) {
  244. propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
  245. }
  246. }
  247. }
  248. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  249. [System.ServiceModel.ServiceContractAttribute(Namespace="http://mynamespace", ConfigurationName="ServiceReference1.IService1")]
  250. public interface IService1 {
  251. [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetData", ReplyAction="http://mynamespace/IService1/GetDataResponse")]
  252. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
  253. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType2))]
  254. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
  255. System.IAsyncResult BeginGetData(System.AsyncCallback callback, object asyncState);
  256. object EndGetData(System.IAsyncResult result);
  257. [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetCollectionData", ReplyAction="http://mynamespace/IService1/GetCollectionDataResponse")]
  258. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
  259. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType2))]
  260. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
  261. System.IAsyncResult BeginGetCollectionData(System.AsyncCallback callback, object asyncState);
  262. System.Collections.ObjectModel.ObservableCollection<object> EndGetCollectionData(System.IAsyncResult result);
  263. [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetNestedData", ReplyAction="http://mynamespace/IService1/GetNestedDataResponse")]
  264. System.IAsyncResult BeginGetNestedData(System.AsyncCallback callback, object asyncState);
  265. WebServiceMoonlightTest.ServiceReference2.DataType2 EndGetNestedData(System.IAsyncResult result);
  266. [System.ServiceModel.OperationContractAttribute(AsyncPattern = true, Action = "http://mynamespace/IService1/JSMGetDatabases", ReplyAction = "http://mynamespace/IService1/JSMGetDatabasesResponse")]
  267. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(object[]))]
  268. System.IAsyncResult BeginJSMGetDatabases(JSMGetDatabasesRequest request, System.AsyncCallback callback, object asyncState);
  269. JSMGetDatabasesResponse EndJSMGetDatabases(System.IAsyncResult result);
  270. }
  271. #region JSMGetDatabases
  272. [System.Diagnostics.DebuggerStepThroughAttribute()]
  273. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
  274. [System.ServiceModel.MessageContractAttribute(WrapperName = "JSMGetDatabases", WrapperNamespace = "", IsWrapped = true)]
  275. public partial class JSMGetDatabasesRequest
  276. {
  277. public JSMGetDatabasesRequest()
  278. {
  279. }
  280. }
  281. [System.Diagnostics.DebuggerStepThroughAttribute()]
  282. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
  283. [System.ServiceModel.MessageContractAttribute(WrapperName = "JSMGetDatabasesResponse", WrapperNamespace = "", IsWrapped = true)]
  284. public partial class JSMGetDatabasesResponse
  285. {
  286. [System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 0)]
  287. [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
  288. public string JSMGetDatabasesResult;
  289. public JSMGetDatabasesResponse()
  290. {
  291. }
  292. public JSMGetDatabasesResponse(string JSMGetDatabasesResult)
  293. {
  294. this.JSMGetDatabasesResult = JSMGetDatabasesResult;
  295. }
  296. }
  297. #endregion
  298. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  299. public interface IService1Channel : WebServiceMoonlightTest.ServiceReference2.IService1, System.ServiceModel.IClientChannel {
  300. }
  301. [System.Diagnostics.DebuggerStepThroughAttribute()]
  302. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  303. public partial class GetDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
  304. private object[] results;
  305. public GetDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
  306. base(exception, cancelled, userState) {
  307. this.results = results;
  308. }
  309. public object Result {
  310. get {
  311. base.RaiseExceptionIfNecessary();
  312. return ((object)(this.results[0]));
  313. }
  314. }
  315. }
  316. [System.Diagnostics.DebuggerStepThroughAttribute()]
  317. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  318. public partial class GetCollectionDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
  319. private object[] results;
  320. public GetCollectionDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
  321. base(exception, cancelled, userState) {
  322. this.results = results;
  323. }
  324. public System.Collections.ObjectModel.ObservableCollection<object> Result {
  325. get {
  326. base.RaiseExceptionIfNecessary();
  327. return ((System.Collections.ObjectModel.ObservableCollection<object>)(this.results[0]));
  328. }
  329. }
  330. }
  331. [System.Diagnostics.DebuggerStepThroughAttribute()]
  332. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  333. public partial class GetNestedDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
  334. private object[] results;
  335. public GetNestedDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
  336. base(exception, cancelled, userState) {
  337. this.results = results;
  338. }
  339. public WebServiceMoonlightTest.ServiceReference2.DataType2 Result {
  340. get {
  341. base.RaiseExceptionIfNecessary();
  342. return ((WebServiceMoonlightTest.ServiceReference2.DataType2)(this.results[0]));
  343. }
  344. }
  345. }
  346. [System.Diagnostics.DebuggerStepThroughAttribute()]
  347. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
  348. public partial class JSMGetDatabasesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
  349. {
  350. private object[] results;
  351. public JSMGetDatabasesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
  352. base(exception, cancelled, userState)
  353. {
  354. this.results = results;
  355. }
  356. public string Result
  357. {
  358. get
  359. {
  360. base.RaiseExceptionIfNecessary();
  361. return ((string)(this.results[0]));
  362. }
  363. }
  364. }
  365. [System.Diagnostics.DebuggerStepThroughAttribute()]
  366. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  367. public partial class Service1Client : System.ServiceModel.ClientBase<WebServiceMoonlightTest.ServiceReference2.IService1>, WebServiceMoonlightTest.ServiceReference2.IService1 {
  368. private BeginOperationDelegate onBeginGetDataDelegate;
  369. private EndOperationDelegate onEndGetDataDelegate;
  370. private System.Threading.SendOrPostCallback onGetDataCompletedDelegate;
  371. private BeginOperationDelegate onBeginGetCollectionDataDelegate;
  372. private EndOperationDelegate onEndGetCollectionDataDelegate;
  373. private System.Threading.SendOrPostCallback onGetCollectionDataCompletedDelegate;
  374. private BeginOperationDelegate onBeginGetNestedDataDelegate;
  375. private EndOperationDelegate onEndGetNestedDataDelegate;
  376. private System.Threading.SendOrPostCallback onGetNestedDataCompletedDelegate;
  377. private BeginOperationDelegate onBeginOpenDelegate;
  378. private EndOperationDelegate onEndOpenDelegate;
  379. private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
  380. private BeginOperationDelegate onBeginCloseDelegate;
  381. private EndOperationDelegate onEndCloseDelegate;
  382. private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
  383. #region JSMGetDatabasesDelegates
  384. private BeginOperationDelegate onBeginJSMGetDatabasesDelegate;
  385. private EndOperationDelegate onEndJSMGetDatabasesDelegate;
  386. private System.Threading.SendOrPostCallback onJSMGetDatabasesCompletedDelegate;
  387. #endregion
  388. public Service1Client() {
  389. }
  390. public Service1Client(string endpointConfigurationName) :
  391. base(endpointConfigurationName) {
  392. }
  393. public Service1Client(string endpointConfigurationName, string remoteAddress) :
  394. base(endpointConfigurationName, remoteAddress) {
  395. }
  396. public Service1Client(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
  397. base(endpointConfigurationName, remoteAddress) {
  398. }
  399. public Service1Client(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
  400. base(binding, remoteAddress) {
  401. }
  402. /*
  403. public System.Net.CookieContainer CookieContainer {
  404. get {
  405. System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
  406. if ((httpCookieContainerManager != null)) {
  407. return httpCookieContainerManager.CookieContainer;
  408. }
  409. else {
  410. return null;
  411. }
  412. }
  413. set {
  414. System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
  415. if ((httpCookieContainerManager != null)) {
  416. httpCookieContainerManager.CookieContainer = value;
  417. }
  418. else {
  419. throw new System.InvalidOperationException("Unable to set the CookieContainer. Please make sure the binding contains an HttpC" +
  420. "ookieContainerBindingElement.");
  421. }
  422. }
  423. }
  424. */
  425. public event System.EventHandler<GetDataCompletedEventArgs> GetDataCompleted;
  426. public event System.EventHandler<GetCollectionDataCompletedEventArgs> GetCollectionDataCompleted;
  427. public event System.EventHandler<GetNestedDataCompletedEventArgs> GetNestedDataCompleted;
  428. public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> OpenCompleted;
  429. public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> CloseCompleted;
  430. public event System.EventHandler<JSMGetDatabasesCompletedEventArgs> JSMGetDatabasesCompleted;
  431. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  432. System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetData(System.AsyncCallback callback, object asyncState) {
  433. return base.Channel.BeginGetData(callback, asyncState);
  434. }
  435. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  436. object WebServiceMoonlightTest.ServiceReference2.IService1.EndGetData(System.IAsyncResult result) {
  437. return base.Channel.EndGetData(result);
  438. }
  439. private System.IAsyncResult OnBeginGetData(object[] inValues, System.AsyncCallback callback, object asyncState) {
  440. return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetData(callback, asyncState);
  441. }
  442. private object[] OnEndGetData(System.IAsyncResult result) {
  443. object retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetData(result);
  444. return new object[] {
  445. retVal};
  446. }
  447. private void OnGetDataCompleted(object state) {
  448. if ((this.GetDataCompleted != null)) {
  449. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  450. this.GetDataCompleted(this, new GetDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
  451. }
  452. }
  453. public void GetDataAsync() {
  454. this.GetDataAsync(null);
  455. }
  456. public void GetDataAsync(object userState) {
  457. if ((this.onBeginGetDataDelegate == null)) {
  458. this.onBeginGetDataDelegate = new BeginOperationDelegate(this.OnBeginGetData);
  459. }
  460. if ((this.onEndGetDataDelegate == null)) {
  461. this.onEndGetDataDelegate = new EndOperationDelegate(this.OnEndGetData);
  462. }
  463. if ((this.onGetDataCompletedDelegate == null)) {
  464. this.onGetDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetDataCompleted);
  465. }
  466. base.InvokeAsync(this.onBeginGetDataDelegate, null, this.onEndGetDataDelegate, this.onGetDataCompletedDelegate, userState);
  467. }
  468. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  469. System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetCollectionData(System.AsyncCallback callback, object asyncState) {
  470. return base.Channel.BeginGetCollectionData(callback, asyncState);
  471. }
  472. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  473. System.Collections.ObjectModel.ObservableCollection<object> WebServiceMoonlightTest.ServiceReference2.IService1.EndGetCollectionData(System.IAsyncResult result) {
  474. return base.Channel.EndGetCollectionData(result);
  475. }
  476. private System.IAsyncResult OnBeginGetCollectionData(object[] inValues, System.AsyncCallback callback, object asyncState) {
  477. return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetCollectionData(callback, asyncState);
  478. }
  479. private object[] OnEndGetCollectionData(System.IAsyncResult result) {
  480. System.Collections.ObjectModel.ObservableCollection<object> retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetCollectionData(result);
  481. return new object[] {
  482. retVal};
  483. }
  484. private void OnGetCollectionDataCompleted(object state) {
  485. if ((this.GetCollectionDataCompleted != null)) {
  486. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  487. this.GetCollectionDataCompleted(this, new GetCollectionDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
  488. }
  489. }
  490. public void GetCollectionDataAsync() {
  491. this.GetCollectionDataAsync(null);
  492. }
  493. public void GetCollectionDataAsync(object userState) {
  494. if ((this.onBeginGetCollectionDataDelegate == null)) {
  495. this.onBeginGetCollectionDataDelegate = new BeginOperationDelegate(this.OnBeginGetCollectionData);
  496. }
  497. if ((this.onEndGetCollectionDataDelegate == null)) {
  498. this.onEndGetCollectionDataDelegate = new EndOperationDelegate(this.OnEndGetCollectionData);
  499. }
  500. if ((this.onGetCollectionDataCompletedDelegate == null)) {
  501. this.onGetCollectionDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetCollectionDataCompleted);
  502. }
  503. base.InvokeAsync(this.onBeginGetCollectionDataDelegate, null, this.onEndGetCollectionDataDelegate, this.onGetCollectionDataCompletedDelegate, userState);
  504. }
  505. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  506. System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetNestedData(System.AsyncCallback callback, object asyncState) {
  507. return base.Channel.BeginGetNestedData(callback, asyncState);
  508. }
  509. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  510. WebServiceMoonlightTest.ServiceReference2.DataType2 WebServiceMoonlightTest.ServiceReference2.IService1.EndGetNestedData(System.IAsyncResult result) {
  511. return base.Channel.EndGetNestedData(result);
  512. }
  513. private System.IAsyncResult OnBeginGetNestedData(object[] inValues, System.AsyncCallback callback, object asyncState) {
  514. return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetNestedData(callback, asyncState);
  515. }
  516. private object[] OnEndGetNestedData(System.IAsyncResult result) {
  517. WebServiceMoonlightTest.ServiceReference2.DataType2 retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetNestedData(result);
  518. return new object[] {
  519. retVal};
  520. }
  521. private void OnGetNestedDataCompleted(object state) {
  522. if ((this.GetNestedDataCompleted != null)) {
  523. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  524. this.GetNestedDataCompleted(this, new GetNestedDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
  525. }
  526. }
  527. public void GetNestedDataAsync() {
  528. this.GetNestedDataAsync(null);
  529. }
  530. public void GetNestedDataAsync(object userState) {
  531. if ((this.onBeginGetNestedDataDelegate == null)) {
  532. this.onBeginGetNestedDataDelegate = new BeginOperationDelegate(this.OnBeginGetNestedData);
  533. }
  534. if ((this.onEndGetNestedDataDelegate == null)) {
  535. this.onEndGetNestedDataDelegate = new EndOperationDelegate(this.OnEndGetNestedData);
  536. }
  537. if ((this.onGetNestedDataCompletedDelegate == null)) {
  538. this.onGetNestedDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetNestedDataCompleted);
  539. }
  540. base.InvokeAsync(this.onBeginGetNestedDataDelegate, null, this.onEndGetNestedDataDelegate, this.onGetNestedDataCompletedDelegate, userState);
  541. }
  542. private System.IAsyncResult OnBeginOpen(object[] inValues, System.AsyncCallback callback, object asyncState) {
  543. return ((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(callback, asyncState);
  544. }
  545. private object[] OnEndOpen(System.IAsyncResult result) {
  546. ((System.ServiceModel.ICommunicationObject)(this)).EndOpen(result);
  547. return null;
  548. }
  549. private void OnOpenCompleted(object state) {
  550. if ((this.OpenCompleted != null)) {
  551. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  552. this.OpenCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
  553. }
  554. }
  555. public void OpenAsync() {
  556. this.OpenAsync(null);
  557. }
  558. public void OpenAsync(object userState) {
  559. if ((this.onBeginOpenDelegate == null)) {
  560. this.onBeginOpenDelegate = new BeginOperationDelegate(this.OnBeginOpen);
  561. }
  562. if ((this.onEndOpenDelegate == null)) {
  563. this.onEndOpenDelegate = new EndOperationDelegate(this.OnEndOpen);
  564. }
  565. if ((this.onOpenCompletedDelegate == null)) {
  566. this.onOpenCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnOpenCompleted);
  567. }
  568. base.InvokeAsync(this.onBeginOpenDelegate, null, this.onEndOpenDelegate, this.onOpenCompletedDelegate, userState);
  569. }
  570. private System.IAsyncResult OnBeginClose(object[] inValues, System.AsyncCallback callback, object asyncState) {
  571. return ((System.ServiceModel.ICommunicationObject)(this)).BeginClose(callback, asyncState);
  572. }
  573. private object[] OnEndClose(System.IAsyncResult result) {
  574. ((System.ServiceModel.ICommunicationObject)(this)).EndClose(result);
  575. return null;
  576. }
  577. private void OnCloseCompleted(object state) {
  578. if ((this.CloseCompleted != null)) {
  579. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  580. this.CloseCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
  581. }
  582. }
  583. #region JSMGetDatabases
  584. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  585. System.IAsyncResult IService1.BeginJSMGetDatabases(JSMGetDatabasesRequest request, System.AsyncCallback callback, object asyncState)
  586. {
  587. return base.Channel.BeginJSMGetDatabases(request, callback, asyncState);
  588. }
  589. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  590. private System.IAsyncResult BeginJSMGetDatabases(System.AsyncCallback callback, object asyncState)
  591. {
  592. JSMGetDatabasesRequest inValue = new JSMGetDatabasesRequest();
  593. return ((IService1)(this)).BeginJSMGetDatabases(inValue, callback, asyncState);
  594. }
  595. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  596. JSMGetDatabasesResponse IService1.EndJSMGetDatabases(System.IAsyncResult result)
  597. {
  598. return base.Channel.EndJSMGetDatabases(result);
  599. }
  600. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  601. private string EndJSMGetDatabases(System.IAsyncResult result)
  602. {
  603. JSMGetDatabasesResponse retVal = ((IService1)(this)).EndJSMGetDatabases(result);
  604. return retVal.JSMGetDatabasesResult;
  605. }
  606. private System.IAsyncResult OnBeginJSMGetDatabases(object[] inValues, System.AsyncCallback callback, object asyncState)
  607. {
  608. return this.BeginJSMGetDatabases(callback, asyncState);
  609. }
  610. private object[] OnEndJSMGetDatabases(System.IAsyncResult result)
  611. {
  612. string retVal = this.EndJSMGetDatabases(result);
  613. return new object[] {
  614. retVal};
  615. }
  616. private void OnJSMGetDatabasesCompleted(object state)
  617. {
  618. if ((this.JSMGetDatabasesCompleted != null))
  619. {
  620. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  621. this.JSMGetDatabasesCompleted(this, new JSMGetDatabasesCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
  622. }
  623. }
  624. public void JSMGetDatabasesAsync()
  625. {
  626. this.JSMGetDatabasesAsync(null);
  627. }
  628. public void JSMGetDatabasesAsync(object userState)
  629. {
  630. if ((this.onBeginJSMGetDatabasesDelegate == null))
  631. {
  632. this.onBeginJSMGetDatabasesDelegate = new BeginOperationDelegate(this.OnBeginJSMGetDatabases);
  633. }
  634. if ((this.onEndJSMGetDatabasesDelegate == null))
  635. {
  636. this.onEndJSMGetDatabasesDelegate = new EndOperationDelegate(this.OnEndJSMGetDatabases);
  637. }
  638. if ((this.onJSMGetDatabasesCompletedDelegate == null))
  639. {
  640. this.onJSMGetDatabasesCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnJSMGetDatabasesCompleted);
  641. }
  642. base.InvokeAsync(this.onBeginJSMGetDatabasesDelegate, null, this.onEndJSMGetDatabasesDelegate, this.onJSMGetDatabasesCompletedDelegate, userState);
  643. }
  644. #endregion
  645. public void CloseAsync() {
  646. this.CloseAsync(null);
  647. }
  648. public void CloseAsync(object userState) {
  649. if ((this.onBeginCloseDelegate == null)) {
  650. this.onBeginCloseDelegate = new BeginOperationDelegate(this.OnBeginClose);
  651. }
  652. if ((this.onEndCloseDelegate == null)) {
  653. this.onEndCloseDelegate = new EndOperationDelegate(this.OnEndClose);
  654. }
  655. if ((this.onCloseCompletedDelegate == null)) {
  656. this.onCloseCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnCloseCompleted);
  657. }
  658. base.InvokeAsync(this.onBeginCloseDelegate, null, this.onEndCloseDelegate, this.onCloseCompletedDelegate, userState);
  659. }
  660. /*
  661. protected override WebServiceMoonlightTest.ServiceReference2.IService1 CreateChannel() {
  662. return new Service1ClientChannel(this);
  663. }
  664. private class Service1ClientChannel : ChannelBase<WebServiceMoonlightTest.ServiceReference2.IService1>, WebServiceMoonlightTest.ServiceReference2.IService1 {
  665. public Service1ClientChannel(System.ServiceModel.ClientBase<WebServiceMoonlightTest.ServiceReference2.IService1> client) :
  666. base(client) {
  667. }
  668. public System.IAsyncResult BeginGetData(System.AsyncCallback callback, object asyncState) {
  669. object[] _args = new object[0];
  670. System.IAsyncResult _result = base.BeginInvoke("GetData", _args, callback, asyncState);
  671. return _result;
  672. }
  673. public object EndGetData(System.IAsyncResult result) {
  674. object[] _args = new object[0];
  675. object _result = ((object)(base.EndInvoke("GetData", _args, result)));
  676. return _result;
  677. }
  678. public System.IAsyncResult BeginGetCollectionData(System.AsyncCallback callback, object asyncState) {
  679. object[] _args = new object[0];
  680. System.IAsyncResult _result = base.BeginInvoke("GetCollectionData", _args, callback, asyncState);
  681. return _result;
  682. }
  683. public System.Collections.ObjectModel.ObservableCollection<object> EndGetCollectionData(System.IAsyncResult result) {
  684. object[] _args = new object[0];
  685. System.Collections.ObjectModel.ObservableCollection<object> _result = ((System.Collections.ObjectModel.ObservableCollection<object>)(base.EndInvoke("GetCollectionData", _args, result)));
  686. return _result;
  687. }
  688. public System.IAsyncResult BeginGetNestedData(System.AsyncCallback callback, object asyncState) {
  689. object[] _args = new object[0];
  690. System.IAsyncResult _result = base.BeginInvoke("GetNestedData", _args, callback, asyncState);
  691. return _result;
  692. }
  693. public WebServiceMoonlightTest.ServiceReference2.DataType2 EndGetNestedData(System.IAsyncResult result) {
  694. object[] _args = new object[0];
  695. WebServiceMoonlightTest.ServiceReference2.DataType2 _result = ((WebServiceMoonlightTest.ServiceReference2.DataType2)(base.EndInvoke("GetNestedData", _args, result)));
  696. return _result;
  697. }
  698. }
  699. */
  700. }
  701. }