Bug652331_2Test.cs 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885
  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. {
  71. ManualResetEvent wait = new ManualResetEvent (false);
  72. Exception error = null;
  73. object result = null;
  74. normalClient.GetDataCompleted += delegate (object o, GetDataCompletedEventArgs e) {
  75. try {
  76. error = e.Error;
  77. result = e.Error == null ? e.Result : null;
  78. } finally {
  79. wait.Set ();
  80. }
  81. };
  82. normalClient.GetDataAsync ();
  83. Assert.IsTrue (wait.WaitOne (TimeSpan.FromSeconds (20)), "#1 timeout");
  84. Assert.IsNull (error, "#1.1, inner exception: {0}", error);
  85. Assert.AreEqual ("A", ((DataType1) result).Id, "#1.2");
  86. }
  87. {
  88. ManualResetEvent wait = new ManualResetEvent (false);
  89. Exception error = null;
  90. ObservableCollection<object> result = null;
  91. collectionClient.GetCollectionDataCompleted += delegate (object sender, GetCollectionDataCompletedEventArgs e) {
  92. try {
  93. error = e.Error;
  94. result = e.Error == null ? e.Result : null;
  95. } finally {
  96. wait.Set ();
  97. }
  98. };
  99. collectionClient.GetCollectionDataAsync ();
  100. Assert.IsTrue (wait.WaitOne (TimeSpan.FromSeconds (20)), "#2 timeout");
  101. Assert.IsNull (error, "#2.1, inner exception: {0}", error);
  102. Assert.AreEqual ("B,C", ItemsToString (result.Cast<DataType1> ()), "#2.2");
  103. }
  104. {
  105. ManualResetEvent wait = new ManualResetEvent (false);
  106. Exception error = null;
  107. WebServiceMoonlightTest.ServiceReference2.DataType2 result = null;
  108. nestedClient.GetNestedDataCompleted += delegate (object sender, GetNestedDataCompletedEventArgs e) {
  109. try {
  110. error = e.Error;
  111. result = e.Error == null ? e.Result : null;
  112. } finally {
  113. wait.Set ();
  114. }
  115. };
  116. nestedClient.GetNestedDataAsync ();
  117. Assert.IsTrue (wait.WaitOne (TimeSpan.FromSeconds (20)), "#3 timeout");
  118. Assert.IsNull (error, "#3.1, inner exception: {0}", error);
  119. Assert.AreEqual ("D,E", ItemsToString (result.Items.Cast<DataType1> ()), "#3.2");
  120. }
  121. {
  122. ManualResetEvent wait = new ManualResetEvent (false);
  123. Exception error = null;
  124. string result = null;
  125. dbClient.JSMGetDatabasesCompleted += delegate (object sender, JSMGetDatabasesCompletedEventArgs e) {
  126. try {
  127. error = e.Error;
  128. result = e.Error == null ? e.Result : null;
  129. } finally {
  130. wait.Set ();
  131. }
  132. };
  133. dbClient.JSMGetDatabasesAsync();
  134. Assert.IsTrue (wait.WaitOne (TimeSpan.FromSeconds (20)), "#4 timeout");
  135. Assert.IsNull (error, "#4.1, inner exception: {0}", error);
  136. Assert.AreEqual ("databases", result, "#4.2");
  137. }
  138. }
  139. string ItemsToString (IEnumerable<DataType1> items)
  140. {
  141. return items.Aggregate ((string) null, (result, item) => result == null ? item.Id : result + "," + item.Id);
  142. }
  143. }
  144. public class Service1 : IService1
  145. {
  146. public object GetData()
  147. {
  148. return new DataType1 { Id = "A" };
  149. }
  150. Func<object> gd;
  151. public IAsyncResult BeginGetData(AsyncCallback cb, object st)
  152. {
  153. gd = new Func<object> (GetData);
  154. return gd.BeginInvoke (cb, st);
  155. }
  156. public object EndGetData (IAsyncResult result)
  157. {
  158. return gd.EndInvoke (result);
  159. }
  160. public ObservableCollection<object> GetCollectionData()
  161. {
  162. return new ObservableCollection<object> { new DataType1 { Id = "B" }, new DataType1 { Id = "C" } };
  163. }
  164. Func<ObservableCollection<object>> gcd;
  165. public IAsyncResult BeginGetCollectionData(AsyncCallback cb, object st)
  166. {
  167. gcd = new Func<ObservableCollection<object>> (GetCollectionData);
  168. return gcd.BeginInvoke (cb, st);
  169. }
  170. public ObservableCollection<object> EndGetCollectionData (IAsyncResult result)
  171. {
  172. return gcd.EndInvoke (result);
  173. }
  174. public DataType2 GetNestedData()
  175. {
  176. return new DataType2 { Items = new ObservableCollection<object> { new DataType1 { Id = "D" }, new DataType1 { Id = "E" } } };
  177. }
  178. Func<DataType2> gnd;
  179. public IAsyncResult BeginGetNestedData(AsyncCallback cb, object st)
  180. {
  181. gnd = new Func<DataType2> (GetNestedData);
  182. return gnd.BeginInvoke (cb, st);
  183. }
  184. public DataType2 EndGetNestedData (IAsyncResult result)
  185. {
  186. return gnd.EndInvoke (result);
  187. }
  188. public JSMGetDatabasesResponse JSMGetDatabases(JSMGetDatabasesRequest request)
  189. {
  190. return new JSMGetDatabasesResponse { JSMGetDatabasesResult = "databases" };
  191. }
  192. Func<JSMGetDatabasesRequest, JSMGetDatabasesResponse> gjgdb;
  193. public IAsyncResult BeginJSMGetDatabases(JSMGetDatabasesRequest request, AsyncCallback callback, object asyncState)
  194. {
  195. gjgdb = JSMGetDatabases;
  196. return gjgdb.BeginInvoke (request, callback, asyncState);
  197. }
  198. public JSMGetDatabasesResponse EndJSMGetDatabases(IAsyncResult result)
  199. {
  200. return gjgdb.EndInvoke (result);
  201. }
  202. }
  203. }
  204. //------------------------------------------------------------------------------
  205. // <auto-generated>
  206. // This code was generated by a tool.
  207. // Runtime Version:4.0.30319.372
  208. //
  209. // Changes to this file may cause incorrect behavior and will be lost if
  210. // the code is regenerated.
  211. // </auto-generated>
  212. //------------------------------------------------------------------------------
  213. //
  214. // This code was auto-generated by Microsoft.Silverlight.ServiceReference, version 4.0.50826.0
  215. //
  216. namespace WebServiceMoonlightTest.ServiceReference2 {
  217. using System.Runtime.Serialization;
  218. [System.Diagnostics.DebuggerStepThroughAttribute()]
  219. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
  220. [System.Runtime.Serialization.DataContractAttribute(Name="DataType1", Namespace="http://mynamespace")]
  221. public partial class DataType1 : object, System.ComponentModel.INotifyPropertyChanged {
  222. private string IdField;
  223. [System.Runtime.Serialization.DataMemberAttribute()]
  224. public string Id {
  225. get {
  226. return this.IdField;
  227. }
  228. set {
  229. if ((object.ReferenceEquals(this.IdField, value) != true)) {
  230. this.IdField = value;
  231. this.RaisePropertyChanged("Id");
  232. }
  233. }
  234. }
  235. public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
  236. protected void RaisePropertyChanged(string propertyName) {
  237. System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
  238. if ((propertyChanged != null)) {
  239. propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
  240. }
  241. }
  242. }
  243. [System.Diagnostics.DebuggerStepThroughAttribute()]
  244. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
  245. [System.Runtime.Serialization.DataContractAttribute(Name="DataType2", Namespace="http://mynamespace")]
  246. [System.Runtime.Serialization.KnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
  247. [System.Runtime.Serialization.KnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
  248. public partial class DataType2 : object, System.ComponentModel.INotifyPropertyChanged {
  249. private System.Collections.ObjectModel.ObservableCollection<object> ItemsField;
  250. [System.Runtime.Serialization.DataMemberAttribute()]
  251. public System.Collections.ObjectModel.ObservableCollection<object> Items {
  252. get {
  253. return this.ItemsField;
  254. }
  255. set {
  256. if ((object.ReferenceEquals(this.ItemsField, value) != true)) {
  257. this.ItemsField = value;
  258. this.RaisePropertyChanged("Items");
  259. }
  260. }
  261. }
  262. public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
  263. protected void RaisePropertyChanged(string propertyName) {
  264. System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
  265. if ((propertyChanged != null)) {
  266. propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
  267. }
  268. }
  269. }
  270. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  271. [System.ServiceModel.ServiceContractAttribute(Namespace="http://mynamespace", ConfigurationName="ServiceReference1.IService1")]
  272. public interface IService1 {
  273. [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetData", ReplyAction="http://mynamespace/IService1/GetDataResponse")]
  274. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
  275. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType2))]
  276. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
  277. System.IAsyncResult BeginGetData(System.AsyncCallback callback, object asyncState);
  278. object EndGetData(System.IAsyncResult result);
  279. [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetCollectionData", ReplyAction="http://mynamespace/IService1/GetCollectionDataResponse")]
  280. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
  281. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType2))]
  282. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
  283. System.IAsyncResult BeginGetCollectionData(System.AsyncCallback callback, object asyncState);
  284. System.Collections.ObjectModel.ObservableCollection<object> EndGetCollectionData(System.IAsyncResult result);
  285. [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetNestedData", ReplyAction="http://mynamespace/IService1/GetNestedDataResponse")]
  286. System.IAsyncResult BeginGetNestedData(System.AsyncCallback callback, object asyncState);
  287. WebServiceMoonlightTest.ServiceReference2.DataType2 EndGetNestedData(System.IAsyncResult result);
  288. [System.ServiceModel.OperationContractAttribute(AsyncPattern = true, Action = "http://mynamespace/IService1/JSMGetDatabases", ReplyAction = "http://mynamespace/IService1/JSMGetDatabasesResponse")]
  289. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(object[]))]
  290. System.IAsyncResult BeginJSMGetDatabases(JSMGetDatabasesRequest request, System.AsyncCallback callback, object asyncState);
  291. JSMGetDatabasesResponse EndJSMGetDatabases(System.IAsyncResult result);
  292. }
  293. #region JSMGetDatabases
  294. [System.Diagnostics.DebuggerStepThroughAttribute()]
  295. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
  296. [System.ServiceModel.MessageContractAttribute(WrapperName = "JSMGetDatabases", WrapperNamespace = "", IsWrapped = true)]
  297. public partial class JSMGetDatabasesRequest
  298. {
  299. public JSMGetDatabasesRequest()
  300. {
  301. }
  302. }
  303. [System.Diagnostics.DebuggerStepThroughAttribute()]
  304. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
  305. [System.ServiceModel.MessageContractAttribute(WrapperName = "JSMGetDatabasesResponse", WrapperNamespace = "", IsWrapped = true)]
  306. public partial class JSMGetDatabasesResponse
  307. {
  308. [System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 0)]
  309. [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
  310. public string JSMGetDatabasesResult;
  311. public JSMGetDatabasesResponse()
  312. {
  313. }
  314. public JSMGetDatabasesResponse(string JSMGetDatabasesResult)
  315. {
  316. this.JSMGetDatabasesResult = JSMGetDatabasesResult;
  317. }
  318. }
  319. #endregion
  320. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  321. public interface IService1Channel : WebServiceMoonlightTest.ServiceReference2.IService1, System.ServiceModel.IClientChannel {
  322. }
  323. [System.Diagnostics.DebuggerStepThroughAttribute()]
  324. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  325. public partial class GetDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
  326. private object[] results;
  327. public GetDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
  328. base(exception, cancelled, userState) {
  329. this.results = results;
  330. }
  331. public object Result {
  332. get {
  333. base.RaiseExceptionIfNecessary();
  334. return ((object)(this.results[0]));
  335. }
  336. }
  337. }
  338. [System.Diagnostics.DebuggerStepThroughAttribute()]
  339. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  340. public partial class GetCollectionDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
  341. private object[] results;
  342. public GetCollectionDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
  343. base(exception, cancelled, userState) {
  344. this.results = results;
  345. }
  346. public System.Collections.ObjectModel.ObservableCollection<object> Result {
  347. get {
  348. base.RaiseExceptionIfNecessary();
  349. return ((System.Collections.ObjectModel.ObservableCollection<object>)(this.results[0]));
  350. }
  351. }
  352. }
  353. [System.Diagnostics.DebuggerStepThroughAttribute()]
  354. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  355. public partial class GetNestedDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
  356. private object[] results;
  357. public GetNestedDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
  358. base(exception, cancelled, userState) {
  359. this.results = results;
  360. }
  361. public WebServiceMoonlightTest.ServiceReference2.DataType2 Result {
  362. get {
  363. base.RaiseExceptionIfNecessary();
  364. return ((WebServiceMoonlightTest.ServiceReference2.DataType2)(this.results[0]));
  365. }
  366. }
  367. }
  368. [System.Diagnostics.DebuggerStepThroughAttribute()]
  369. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
  370. public partial class JSMGetDatabasesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
  371. {
  372. private object[] results;
  373. public JSMGetDatabasesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
  374. base(exception, cancelled, userState)
  375. {
  376. this.results = results;
  377. }
  378. public string Result
  379. {
  380. get
  381. {
  382. base.RaiseExceptionIfNecessary();
  383. return ((string)(this.results[0]));
  384. }
  385. }
  386. }
  387. [System.Diagnostics.DebuggerStepThroughAttribute()]
  388. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  389. public partial class Service1Client : System.ServiceModel.ClientBase<WebServiceMoonlightTest.ServiceReference2.IService1>, WebServiceMoonlightTest.ServiceReference2.IService1 {
  390. private BeginOperationDelegate onBeginGetDataDelegate;
  391. private EndOperationDelegate onEndGetDataDelegate;
  392. private System.Threading.SendOrPostCallback onGetDataCompletedDelegate;
  393. private BeginOperationDelegate onBeginGetCollectionDataDelegate;
  394. private EndOperationDelegate onEndGetCollectionDataDelegate;
  395. private System.Threading.SendOrPostCallback onGetCollectionDataCompletedDelegate;
  396. private BeginOperationDelegate onBeginGetNestedDataDelegate;
  397. private EndOperationDelegate onEndGetNestedDataDelegate;
  398. private System.Threading.SendOrPostCallback onGetNestedDataCompletedDelegate;
  399. private BeginOperationDelegate onBeginOpenDelegate;
  400. private EndOperationDelegate onEndOpenDelegate;
  401. private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
  402. private BeginOperationDelegate onBeginCloseDelegate;
  403. private EndOperationDelegate onEndCloseDelegate;
  404. private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
  405. #region JSMGetDatabasesDelegates
  406. private BeginOperationDelegate onBeginJSMGetDatabasesDelegate;
  407. private EndOperationDelegate onEndJSMGetDatabasesDelegate;
  408. private System.Threading.SendOrPostCallback onJSMGetDatabasesCompletedDelegate;
  409. #endregion
  410. public Service1Client() {
  411. }
  412. public Service1Client(string endpointConfigurationName) :
  413. base(endpointConfigurationName) {
  414. }
  415. public Service1Client(string endpointConfigurationName, string remoteAddress) :
  416. base(endpointConfigurationName, remoteAddress) {
  417. }
  418. public Service1Client(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
  419. base(endpointConfigurationName, remoteAddress) {
  420. }
  421. public Service1Client(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
  422. base(binding, remoteAddress) {
  423. }
  424. /*
  425. public System.Net.CookieContainer CookieContainer {
  426. get {
  427. System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
  428. if ((httpCookieContainerManager != null)) {
  429. return httpCookieContainerManager.CookieContainer;
  430. }
  431. else {
  432. return null;
  433. }
  434. }
  435. set {
  436. System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
  437. if ((httpCookieContainerManager != null)) {
  438. httpCookieContainerManager.CookieContainer = value;
  439. }
  440. else {
  441. throw new System.InvalidOperationException("Unable to set the CookieContainer. Please make sure the binding contains an HttpC" +
  442. "ookieContainerBindingElement.");
  443. }
  444. }
  445. }
  446. */
  447. public event System.EventHandler<GetDataCompletedEventArgs> GetDataCompleted;
  448. public event System.EventHandler<GetCollectionDataCompletedEventArgs> GetCollectionDataCompleted;
  449. public event System.EventHandler<GetNestedDataCompletedEventArgs> GetNestedDataCompleted;
  450. public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> OpenCompleted;
  451. public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> CloseCompleted;
  452. public event System.EventHandler<JSMGetDatabasesCompletedEventArgs> JSMGetDatabasesCompleted;
  453. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  454. System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetData(System.AsyncCallback callback, object asyncState) {
  455. return base.Channel.BeginGetData(callback, asyncState);
  456. }
  457. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  458. object WebServiceMoonlightTest.ServiceReference2.IService1.EndGetData(System.IAsyncResult result) {
  459. return base.Channel.EndGetData(result);
  460. }
  461. private System.IAsyncResult OnBeginGetData(object[] inValues, System.AsyncCallback callback, object asyncState) {
  462. return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetData(callback, asyncState);
  463. }
  464. private object[] OnEndGetData(System.IAsyncResult result) {
  465. object retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetData(result);
  466. return new object[] {
  467. retVal};
  468. }
  469. private void OnGetDataCompleted(object state) {
  470. if ((this.GetDataCompleted != null)) {
  471. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  472. this.GetDataCompleted(this, new GetDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
  473. }
  474. }
  475. public void GetDataAsync() {
  476. this.GetDataAsync(null);
  477. }
  478. public void GetDataAsync(object userState) {
  479. if ((this.onBeginGetDataDelegate == null)) {
  480. this.onBeginGetDataDelegate = new BeginOperationDelegate(this.OnBeginGetData);
  481. }
  482. if ((this.onEndGetDataDelegate == null)) {
  483. this.onEndGetDataDelegate = new EndOperationDelegate(this.OnEndGetData);
  484. }
  485. if ((this.onGetDataCompletedDelegate == null)) {
  486. this.onGetDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetDataCompleted);
  487. }
  488. base.InvokeAsync(this.onBeginGetDataDelegate, null, this.onEndGetDataDelegate, this.onGetDataCompletedDelegate, userState);
  489. }
  490. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  491. System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetCollectionData(System.AsyncCallback callback, object asyncState) {
  492. return base.Channel.BeginGetCollectionData(callback, asyncState);
  493. }
  494. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  495. System.Collections.ObjectModel.ObservableCollection<object> WebServiceMoonlightTest.ServiceReference2.IService1.EndGetCollectionData(System.IAsyncResult result) {
  496. return base.Channel.EndGetCollectionData(result);
  497. }
  498. private System.IAsyncResult OnBeginGetCollectionData(object[] inValues, System.AsyncCallback callback, object asyncState) {
  499. return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetCollectionData(callback, asyncState);
  500. }
  501. private object[] OnEndGetCollectionData(System.IAsyncResult result) {
  502. System.Collections.ObjectModel.ObservableCollection<object> retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetCollectionData(result);
  503. return new object[] {
  504. retVal};
  505. }
  506. private void OnGetCollectionDataCompleted(object state) {
  507. if ((this.GetCollectionDataCompleted != null)) {
  508. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  509. this.GetCollectionDataCompleted(this, new GetCollectionDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
  510. }
  511. }
  512. public void GetCollectionDataAsync() {
  513. this.GetCollectionDataAsync(null);
  514. }
  515. public void GetCollectionDataAsync(object userState) {
  516. if ((this.onBeginGetCollectionDataDelegate == null)) {
  517. this.onBeginGetCollectionDataDelegate = new BeginOperationDelegate(this.OnBeginGetCollectionData);
  518. }
  519. if ((this.onEndGetCollectionDataDelegate == null)) {
  520. this.onEndGetCollectionDataDelegate = new EndOperationDelegate(this.OnEndGetCollectionData);
  521. }
  522. if ((this.onGetCollectionDataCompletedDelegate == null)) {
  523. this.onGetCollectionDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetCollectionDataCompleted);
  524. }
  525. base.InvokeAsync(this.onBeginGetCollectionDataDelegate, null, this.onEndGetCollectionDataDelegate, this.onGetCollectionDataCompletedDelegate, userState);
  526. }
  527. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  528. System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetNestedData(System.AsyncCallback callback, object asyncState) {
  529. return base.Channel.BeginGetNestedData(callback, asyncState);
  530. }
  531. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  532. WebServiceMoonlightTest.ServiceReference2.DataType2 WebServiceMoonlightTest.ServiceReference2.IService1.EndGetNestedData(System.IAsyncResult result) {
  533. return base.Channel.EndGetNestedData(result);
  534. }
  535. private System.IAsyncResult OnBeginGetNestedData(object[] inValues, System.AsyncCallback callback, object asyncState) {
  536. return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetNestedData(callback, asyncState);
  537. }
  538. private object[] OnEndGetNestedData(System.IAsyncResult result) {
  539. WebServiceMoonlightTest.ServiceReference2.DataType2 retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetNestedData(result);
  540. return new object[] {
  541. retVal};
  542. }
  543. private void OnGetNestedDataCompleted(object state) {
  544. if ((this.GetNestedDataCompleted != null)) {
  545. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  546. this.GetNestedDataCompleted(this, new GetNestedDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
  547. }
  548. }
  549. public void GetNestedDataAsync() {
  550. this.GetNestedDataAsync(null);
  551. }
  552. public void GetNestedDataAsync(object userState) {
  553. if ((this.onBeginGetNestedDataDelegate == null)) {
  554. this.onBeginGetNestedDataDelegate = new BeginOperationDelegate(this.OnBeginGetNestedData);
  555. }
  556. if ((this.onEndGetNestedDataDelegate == null)) {
  557. this.onEndGetNestedDataDelegate = new EndOperationDelegate(this.OnEndGetNestedData);
  558. }
  559. if ((this.onGetNestedDataCompletedDelegate == null)) {
  560. this.onGetNestedDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetNestedDataCompleted);
  561. }
  562. base.InvokeAsync(this.onBeginGetNestedDataDelegate, null, this.onEndGetNestedDataDelegate, this.onGetNestedDataCompletedDelegate, userState);
  563. }
  564. private System.IAsyncResult OnBeginOpen(object[] inValues, System.AsyncCallback callback, object asyncState) {
  565. return ((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(callback, asyncState);
  566. }
  567. private object[] OnEndOpen(System.IAsyncResult result) {
  568. ((System.ServiceModel.ICommunicationObject)(this)).EndOpen(result);
  569. return null;
  570. }
  571. private void OnOpenCompleted(object state) {
  572. if ((this.OpenCompleted != null)) {
  573. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  574. this.OpenCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
  575. }
  576. }
  577. public void OpenAsync() {
  578. this.OpenAsync(null);
  579. }
  580. public void OpenAsync(object userState) {
  581. if ((this.onBeginOpenDelegate == null)) {
  582. this.onBeginOpenDelegate = new BeginOperationDelegate(this.OnBeginOpen);
  583. }
  584. if ((this.onEndOpenDelegate == null)) {
  585. this.onEndOpenDelegate = new EndOperationDelegate(this.OnEndOpen);
  586. }
  587. if ((this.onOpenCompletedDelegate == null)) {
  588. this.onOpenCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnOpenCompleted);
  589. }
  590. base.InvokeAsync(this.onBeginOpenDelegate, null, this.onEndOpenDelegate, this.onOpenCompletedDelegate, userState);
  591. }
  592. private System.IAsyncResult OnBeginClose(object[] inValues, System.AsyncCallback callback, object asyncState) {
  593. return ((System.ServiceModel.ICommunicationObject)(this)).BeginClose(callback, asyncState);
  594. }
  595. private object[] OnEndClose(System.IAsyncResult result) {
  596. ((System.ServiceModel.ICommunicationObject)(this)).EndClose(result);
  597. return null;
  598. }
  599. private void OnCloseCompleted(object state) {
  600. if ((this.CloseCompleted != null)) {
  601. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  602. this.CloseCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
  603. }
  604. }
  605. #region JSMGetDatabases
  606. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  607. System.IAsyncResult IService1.BeginJSMGetDatabases(JSMGetDatabasesRequest request, System.AsyncCallback callback, object asyncState)
  608. {
  609. return base.Channel.BeginJSMGetDatabases(request, callback, asyncState);
  610. }
  611. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  612. private System.IAsyncResult BeginJSMGetDatabases(System.AsyncCallback callback, object asyncState)
  613. {
  614. JSMGetDatabasesRequest inValue = new JSMGetDatabasesRequest();
  615. return ((IService1)(this)).BeginJSMGetDatabases(inValue, callback, asyncState);
  616. }
  617. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  618. JSMGetDatabasesResponse IService1.EndJSMGetDatabases(System.IAsyncResult result)
  619. {
  620. return base.Channel.EndJSMGetDatabases(result);
  621. }
  622. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
  623. private string EndJSMGetDatabases(System.IAsyncResult result)
  624. {
  625. JSMGetDatabasesResponse retVal = ((IService1)(this)).EndJSMGetDatabases(result);
  626. return retVal.JSMGetDatabasesResult;
  627. }
  628. private System.IAsyncResult OnBeginJSMGetDatabases(object[] inValues, System.AsyncCallback callback, object asyncState)
  629. {
  630. return this.BeginJSMGetDatabases(callback, asyncState);
  631. }
  632. private object[] OnEndJSMGetDatabases(System.IAsyncResult result)
  633. {
  634. string retVal = this.EndJSMGetDatabases(result);
  635. return new object[] {
  636. retVal};
  637. }
  638. private void OnJSMGetDatabasesCompleted(object state)
  639. {
  640. if ((this.JSMGetDatabasesCompleted != null))
  641. {
  642. InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
  643. this.JSMGetDatabasesCompleted(this, new JSMGetDatabasesCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
  644. }
  645. }
  646. public void JSMGetDatabasesAsync()
  647. {
  648. this.JSMGetDatabasesAsync(null);
  649. }
  650. public void JSMGetDatabasesAsync(object userState)
  651. {
  652. if ((this.onBeginJSMGetDatabasesDelegate == null))
  653. {
  654. this.onBeginJSMGetDatabasesDelegate = new BeginOperationDelegate(this.OnBeginJSMGetDatabases);
  655. }
  656. if ((this.onEndJSMGetDatabasesDelegate == null))
  657. {
  658. this.onEndJSMGetDatabasesDelegate = new EndOperationDelegate(this.OnEndJSMGetDatabases);
  659. }
  660. if ((this.onJSMGetDatabasesCompletedDelegate == null))
  661. {
  662. this.onJSMGetDatabasesCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnJSMGetDatabasesCompleted);
  663. }
  664. base.InvokeAsync(this.onBeginJSMGetDatabasesDelegate, null, this.onEndJSMGetDatabasesDelegate, this.onJSMGetDatabasesCompletedDelegate, userState);
  665. }
  666. #endregion
  667. public void CloseAsync() {
  668. this.CloseAsync(null);
  669. }
  670. public void CloseAsync(object userState) {
  671. if ((this.onBeginCloseDelegate == null)) {
  672. this.onBeginCloseDelegate = new BeginOperationDelegate(this.OnBeginClose);
  673. }
  674. if ((this.onEndCloseDelegate == null)) {
  675. this.onEndCloseDelegate = new EndOperationDelegate(this.OnEndClose);
  676. }
  677. if ((this.onCloseCompletedDelegate == null)) {
  678. this.onCloseCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnCloseCompleted);
  679. }
  680. base.InvokeAsync(this.onBeginCloseDelegate, null, this.onEndCloseDelegate, this.onCloseCompletedDelegate, userState);
  681. }
  682. /*
  683. protected override WebServiceMoonlightTest.ServiceReference2.IService1 CreateChannel() {
  684. return new Service1ClientChannel(this);
  685. }
  686. private class Service1ClientChannel : ChannelBase<WebServiceMoonlightTest.ServiceReference2.IService1>, WebServiceMoonlightTest.ServiceReference2.IService1 {
  687. public Service1ClientChannel(System.ServiceModel.ClientBase<WebServiceMoonlightTest.ServiceReference2.IService1> client) :
  688. base(client) {
  689. }
  690. public System.IAsyncResult BeginGetData(System.AsyncCallback callback, object asyncState) {
  691. object[] _args = new object[0];
  692. System.IAsyncResult _result = base.BeginInvoke("GetData", _args, callback, asyncState);
  693. return _result;
  694. }
  695. public object EndGetData(System.IAsyncResult result) {
  696. object[] _args = new object[0];
  697. object _result = ((object)(base.EndInvoke("GetData", _args, result)));
  698. return _result;
  699. }
  700. public System.IAsyncResult BeginGetCollectionData(System.AsyncCallback callback, object asyncState) {
  701. object[] _args = new object[0];
  702. System.IAsyncResult _result = base.BeginInvoke("GetCollectionData", _args, callback, asyncState);
  703. return _result;
  704. }
  705. public System.Collections.ObjectModel.ObservableCollection<object> EndGetCollectionData(System.IAsyncResult result) {
  706. object[] _args = new object[0];
  707. System.Collections.ObjectModel.ObservableCollection<object> _result = ((System.Collections.ObjectModel.ObservableCollection<object>)(base.EndInvoke("GetCollectionData", _args, result)));
  708. return _result;
  709. }
  710. public System.IAsyncResult BeginGetNestedData(System.AsyncCallback callback, object asyncState) {
  711. object[] _args = new object[0];
  712. System.IAsyncResult _result = base.BeginInvoke("GetNestedData", _args, callback, asyncState);
  713. return _result;
  714. }
  715. public WebServiceMoonlightTest.ServiceReference2.DataType2 EndGetNestedData(System.IAsyncResult result) {
  716. object[] _args = new object[0];
  717. WebServiceMoonlightTest.ServiceReference2.DataType2 _result = ((WebServiceMoonlightTest.ServiceReference2.DataType2)(base.EndInvoke("GetNestedData", _args, result)));
  718. return _result;
  719. }
  720. }
  721. */
  722. }
  723. }