5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2011 Novell, Inc. http://www.novell.com
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using System.Collections.Generic;
30 using System.Collections.ObjectModel;
32 using System.Runtime.Serialization;
33 using System.ServiceModel;
34 using System.ServiceModel.Description;
35 using System.Threading;
36 using NUnit.Framework;
38 using WebServiceMoonlightTest.ServiceReference2;
40 namespace MonoTests.System.ServiceModel.Dispatcher
43 public class Bug652331_2Test
46 [Category ("NotWorking")]
47 public void Bug652331_3 ()
50 ServiceHost serviceHost = new ServiceHost(typeof(Service1), new Uri("http://localhost:37564/Service1"));
51 serviceHost.AddServiceEndpoint(typeof(IService1), new BasicHttpBinding(), string.Empty);
53 // Enable metadata exchange (WSDL publishing)
54 ServiceMetadataBehavior mexBehavior = new ServiceMetadataBehavior();
55 mexBehavior.HttpGetEnabled = true;
56 serviceHost.Description.Behaviors.Add(mexBehavior);
57 serviceHost.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex");
70 var binding = new BasicHttpBinding ();
71 var remoteAddress = new EndpointAddress ("http://localhost:37564/Service1");
73 var normalClient = new Service1Client (binding, remoteAddress);
74 var collectionClient = new Service1Client (binding, remoteAddress);
75 var nestedClient = new Service1Client (binding, remoteAddress);
76 var dbClient = new Service1Client (binding, remoteAddress);
78 var waits = new ManualResetEvent [4];
79 for (int i = 0; i < waits.Length; i++)
80 waits [i] = new ManualResetEvent (false);
84 normalClient.GetDataCompleted += delegate (object o, GetDataCompletedEventArgs e) {
85 if (e.Error != null) {
86 Assert.Fail ("Normal failed; error: {0}", e.Error);
89 Assert.AreEqual ("A", ((DataType1) e.Result).Id, "Normal");
90 Interlocked.Increment (ref passed);
93 normalClient.GetDataAsync ();
95 collectionClient.GetCollectionDataCompleted += delegate (object sender, GetCollectionDataCompletedEventArgs e) {
96 if (e.Error != null) {
97 Assert.Fail ("Collection failed; error: {0}", e.Error);
100 Assert.AreEqual ("B,C", ItemsToString (e.Result.Cast<DataType1> ()), "Collection");
101 Interlocked.Increment (ref passed);
104 collectionClient.GetCollectionDataAsync ();
106 nestedClient.GetNestedDataCompleted += delegate (object sender, GetNestedDataCompletedEventArgs e) {
107 if (e.Error != null) {
108 Assert.Fail ("Nested failed; error: {0}", e.Error);
111 Assert.AreEqual ("D,E", ItemsToString (e.Result.Items.Cast<DataType1> ()), "Nested");
112 Interlocked.Increment (ref passed);
115 nestedClient.GetNestedDataAsync ();
117 dbClient.JSMGetDatabasesCompleted += delegate (object sender, JSMGetDatabasesCompletedEventArgs e) {
119 if (e.Error != null) {
122 Assert.AreEqual ("databases", e.Result, "Databases");
123 Interlocked.Increment (ref passed);
125 dbClient.JSMGetDatabasesAsync();
127 WaitHandle.WaitAll (waits, TimeSpan.FromMinutes (1));
128 if (passed != waits.Length)
129 Assert.Fail ("Not all tests passed!");
132 string ItemsToString (IEnumerable<DataType1> items)
134 return items.Aggregate ((string) null, (result, item) => result == null ? item.Id : result + "," + item.Id);
138 public class Service1 : IService1
140 public object GetData()
142 return new DataType1 { Id = "A" };
146 public IAsyncResult BeginGetData(AsyncCallback cb, object st)
148 gd = new Func<object> (GetData);
149 return gd.BeginInvoke (cb, st);
152 public object EndGetData (IAsyncResult result)
154 return gd.EndInvoke (result);
157 public ObservableCollection<object> GetCollectionData()
159 return new ObservableCollection<object> { new DataType1 { Id = "B" }, new DataType1 { Id = "C" } };
162 Func<ObservableCollection<object>> gcd;
163 public IAsyncResult BeginGetCollectionData(AsyncCallback cb, object st)
165 gcd = new Func<ObservableCollection<object>> (GetCollectionData);
166 return gcd.BeginInvoke (cb, st);
169 public ObservableCollection<object> EndGetCollectionData (IAsyncResult result)
171 return gcd.EndInvoke (result);
174 public DataType2 GetNestedData()
176 return new DataType2 { Items = new ObservableCollection<object> { new DataType1 { Id = "D" }, new DataType1 { Id = "E" } } };
180 public IAsyncResult BeginGetNestedData(AsyncCallback cb, object st)
182 gnd = new Func<DataType2> (GetNestedData);
183 return gnd.BeginInvoke (cb, st);
186 public DataType2 EndGetNestedData (IAsyncResult result)
188 return gnd.EndInvoke (result);
191 public JSMGetDatabasesResponse JSMGetDatabases(JSMGetDatabasesRequest request)
193 return new JSMGetDatabasesResponse { JSMGetDatabasesResult = "databases" };
196 Func<JSMGetDatabasesRequest, JSMGetDatabasesResponse> gjgdb;
197 public IAsyncResult BeginJSMGetDatabases(JSMGetDatabasesRequest request, AsyncCallback callback, object asyncState)
199 gjgdb = JSMGetDatabases;
200 return gjgdb.BeginInvoke (request, callback, asyncState);
203 public JSMGetDatabasesResponse EndJSMGetDatabases(IAsyncResult result)
205 return gjgdb.EndInvoke (result);
211 //------------------------------------------------------------------------------
213 // This code was generated by a tool.
214 // Runtime Version:4.0.30319.372
216 // Changes to this file may cause incorrect behavior and will be lost if
217 // the code is regenerated.
219 //------------------------------------------------------------------------------
222 // This code was auto-generated by Microsoft.Silverlight.ServiceReference, version 4.0.50826.0
224 namespace WebServiceMoonlightTest.ServiceReference2 {
225 using System.Runtime.Serialization;
228 [System.Diagnostics.DebuggerStepThroughAttribute()]
229 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
230 [System.Runtime.Serialization.DataContractAttribute(Name="DataType1", Namespace="http://mynamespace")]
231 public partial class DataType1 : object, System.ComponentModel.INotifyPropertyChanged {
233 private string IdField;
235 [System.Runtime.Serialization.DataMemberAttribute()]
241 if ((object.ReferenceEquals(this.IdField, value) != true)) {
242 this.IdField = value;
243 this.RaisePropertyChanged("Id");
248 public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
250 protected void RaisePropertyChanged(string propertyName) {
251 System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
252 if ((propertyChanged != null)) {
253 propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
258 [System.Diagnostics.DebuggerStepThroughAttribute()]
259 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
260 [System.Runtime.Serialization.DataContractAttribute(Name="DataType2", Namespace="http://mynamespace")]
261 [System.Runtime.Serialization.KnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
262 [System.Runtime.Serialization.KnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
263 public partial class DataType2 : object, System.ComponentModel.INotifyPropertyChanged {
265 private System.Collections.ObjectModel.ObservableCollection<object> ItemsField;
267 [System.Runtime.Serialization.DataMemberAttribute()]
268 public System.Collections.ObjectModel.ObservableCollection<object> Items {
270 return this.ItemsField;
273 if ((object.ReferenceEquals(this.ItemsField, value) != true)) {
274 this.ItemsField = value;
275 this.RaisePropertyChanged("Items");
280 public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
282 protected void RaisePropertyChanged(string propertyName) {
283 System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
284 if ((propertyChanged != null)) {
285 propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
290 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
291 [System.ServiceModel.ServiceContractAttribute(Namespace="http://mynamespace", ConfigurationName="ServiceReference1.IService1")]
292 public interface IService1 {
294 [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetData", ReplyAction="http://mynamespace/IService1/GetDataResponse")]
295 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
296 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType2))]
297 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
298 System.IAsyncResult BeginGetData(System.AsyncCallback callback, object asyncState);
300 object EndGetData(System.IAsyncResult result);
302 [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetCollectionData", ReplyAction="http://mynamespace/IService1/GetCollectionDataResponse")]
303 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
304 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType2))]
305 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
306 System.IAsyncResult BeginGetCollectionData(System.AsyncCallback callback, object asyncState);
308 System.Collections.ObjectModel.ObservableCollection<object> EndGetCollectionData(System.IAsyncResult result);
310 [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetNestedData", ReplyAction="http://mynamespace/IService1/GetNestedDataResponse")]
311 System.IAsyncResult BeginGetNestedData(System.AsyncCallback callback, object asyncState);
313 WebServiceMoonlightTest.ServiceReference2.DataType2 EndGetNestedData(System.IAsyncResult result);
315 [System.ServiceModel.OperationContractAttribute(AsyncPattern = true, Action = "http://mynamespace/IService1/JSMGetDatabases", ReplyAction = "http://mynamespace/IService1/JSMGetDatabasesResponse")]
316 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(object[]))]
317 System.IAsyncResult BeginJSMGetDatabases(JSMGetDatabasesRequest request, System.AsyncCallback callback, object asyncState);
319 JSMGetDatabasesResponse EndJSMGetDatabases(System.IAsyncResult result);
322 #region JSMGetDatabases
323 [System.Diagnostics.DebuggerStepThroughAttribute()]
324 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
325 [System.ServiceModel.MessageContractAttribute(WrapperName = "JSMGetDatabases", WrapperNamespace = "", IsWrapped = true)]
326 public partial class JSMGetDatabasesRequest
329 public JSMGetDatabasesRequest()
334 [System.Diagnostics.DebuggerStepThroughAttribute()]
335 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
336 [System.ServiceModel.MessageContractAttribute(WrapperName = "JSMGetDatabasesResponse", WrapperNamespace = "", IsWrapped = true)]
337 public partial class JSMGetDatabasesResponse
340 [System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 0)]
341 [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
342 public string JSMGetDatabasesResult;
344 public JSMGetDatabasesResponse()
348 public JSMGetDatabasesResponse(string JSMGetDatabasesResult)
350 this.JSMGetDatabasesResult = JSMGetDatabasesResult;
356 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
357 public interface IService1Channel : WebServiceMoonlightTest.ServiceReference2.IService1, System.ServiceModel.IClientChannel {
360 [System.Diagnostics.DebuggerStepThroughAttribute()]
361 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
362 public partial class GetDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
364 private object[] results;
366 public GetDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
367 base(exception, cancelled, userState) {
368 this.results = results;
371 public object Result {
373 base.RaiseExceptionIfNecessary();
374 return ((object)(this.results[0]));
379 [System.Diagnostics.DebuggerStepThroughAttribute()]
380 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
381 public partial class GetCollectionDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
383 private object[] results;
385 public GetCollectionDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
386 base(exception, cancelled, userState) {
387 this.results = results;
390 public System.Collections.ObjectModel.ObservableCollection<object> Result {
392 base.RaiseExceptionIfNecessary();
393 return ((System.Collections.ObjectModel.ObservableCollection<object>)(this.results[0]));
398 [System.Diagnostics.DebuggerStepThroughAttribute()]
399 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
400 public partial class GetNestedDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
402 private object[] results;
404 public GetNestedDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
405 base(exception, cancelled, userState) {
406 this.results = results;
409 public WebServiceMoonlightTest.ServiceReference2.DataType2 Result {
411 base.RaiseExceptionIfNecessary();
412 return ((WebServiceMoonlightTest.ServiceReference2.DataType2)(this.results[0]));
417 [System.Diagnostics.DebuggerStepThroughAttribute()]
418 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
419 public partial class JSMGetDatabasesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
422 private object[] results;
424 public JSMGetDatabasesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
425 base(exception, cancelled, userState)
427 this.results = results;
434 base.RaiseExceptionIfNecessary();
435 return ((string)(this.results[0]));
440 [System.Diagnostics.DebuggerStepThroughAttribute()]
441 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
442 public partial class Service1Client : System.ServiceModel.ClientBase<WebServiceMoonlightTest.ServiceReference2.IService1>, WebServiceMoonlightTest.ServiceReference2.IService1 {
444 private BeginOperationDelegate onBeginGetDataDelegate;
446 private EndOperationDelegate onEndGetDataDelegate;
448 private System.Threading.SendOrPostCallback onGetDataCompletedDelegate;
450 private BeginOperationDelegate onBeginGetCollectionDataDelegate;
452 private EndOperationDelegate onEndGetCollectionDataDelegate;
454 private System.Threading.SendOrPostCallback onGetCollectionDataCompletedDelegate;
456 private BeginOperationDelegate onBeginGetNestedDataDelegate;
458 private EndOperationDelegate onEndGetNestedDataDelegate;
460 private System.Threading.SendOrPostCallback onGetNestedDataCompletedDelegate;
462 private BeginOperationDelegate onBeginOpenDelegate;
464 private EndOperationDelegate onEndOpenDelegate;
466 private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
468 private BeginOperationDelegate onBeginCloseDelegate;
470 private EndOperationDelegate onEndCloseDelegate;
472 private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
474 #region JSMGetDatabasesDelegates
475 private BeginOperationDelegate onBeginJSMGetDatabasesDelegate;
477 private EndOperationDelegate onEndJSMGetDatabasesDelegate;
479 private System.Threading.SendOrPostCallback onJSMGetDatabasesCompletedDelegate;
482 public Service1Client() {
485 public Service1Client(string endpointConfigurationName) :
486 base(endpointConfigurationName) {
489 public Service1Client(string endpointConfigurationName, string remoteAddress) :
490 base(endpointConfigurationName, remoteAddress) {
493 public Service1Client(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
494 base(endpointConfigurationName, remoteAddress) {
497 public Service1Client(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
498 base(binding, remoteAddress) {
502 public System.Net.CookieContainer CookieContainer {
504 System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
505 if ((httpCookieContainerManager != null)) {
506 return httpCookieContainerManager.CookieContainer;
513 System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
514 if ((httpCookieContainerManager != null)) {
515 httpCookieContainerManager.CookieContainer = value;
518 throw new System.InvalidOperationException("Unable to set the CookieContainer. Please make sure the binding contains an HttpC" +
519 "ookieContainerBindingElement.");
525 public event System.EventHandler<GetDataCompletedEventArgs> GetDataCompleted;
527 public event System.EventHandler<GetCollectionDataCompletedEventArgs> GetCollectionDataCompleted;
529 public event System.EventHandler<GetNestedDataCompletedEventArgs> GetNestedDataCompleted;
531 public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> OpenCompleted;
533 public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> CloseCompleted;
535 public event System.EventHandler<JSMGetDatabasesCompletedEventArgs> JSMGetDatabasesCompleted;
538 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
539 System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetData(System.AsyncCallback callback, object asyncState) {
540 return base.Channel.BeginGetData(callback, asyncState);
543 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
544 object WebServiceMoonlightTest.ServiceReference2.IService1.EndGetData(System.IAsyncResult result) {
545 return base.Channel.EndGetData(result);
548 private System.IAsyncResult OnBeginGetData(object[] inValues, System.AsyncCallback callback, object asyncState) {
549 return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetData(callback, asyncState);
552 private object[] OnEndGetData(System.IAsyncResult result) {
553 object retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetData(result);
554 return new object[] {
558 private void OnGetDataCompleted(object state) {
559 if ((this.GetDataCompleted != null)) {
560 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
561 this.GetDataCompleted(this, new GetDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
565 public void GetDataAsync() {
566 this.GetDataAsync(null);
569 public void GetDataAsync(object userState) {
570 if ((this.onBeginGetDataDelegate == null)) {
571 this.onBeginGetDataDelegate = new BeginOperationDelegate(this.OnBeginGetData);
573 if ((this.onEndGetDataDelegate == null)) {
574 this.onEndGetDataDelegate = new EndOperationDelegate(this.OnEndGetData);
576 if ((this.onGetDataCompletedDelegate == null)) {
577 this.onGetDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetDataCompleted);
579 base.InvokeAsync(this.onBeginGetDataDelegate, null, this.onEndGetDataDelegate, this.onGetDataCompletedDelegate, userState);
582 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
583 System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetCollectionData(System.AsyncCallback callback, object asyncState) {
584 return base.Channel.BeginGetCollectionData(callback, asyncState);
587 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
588 System.Collections.ObjectModel.ObservableCollection<object> WebServiceMoonlightTest.ServiceReference2.IService1.EndGetCollectionData(System.IAsyncResult result) {
589 return base.Channel.EndGetCollectionData(result);
592 private System.IAsyncResult OnBeginGetCollectionData(object[] inValues, System.AsyncCallback callback, object asyncState) {
593 return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetCollectionData(callback, asyncState);
596 private object[] OnEndGetCollectionData(System.IAsyncResult result) {
597 System.Collections.ObjectModel.ObservableCollection<object> retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetCollectionData(result);
598 return new object[] {
602 private void OnGetCollectionDataCompleted(object state) {
603 if ((this.GetCollectionDataCompleted != null)) {
604 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
605 this.GetCollectionDataCompleted(this, new GetCollectionDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
609 public void GetCollectionDataAsync() {
610 this.GetCollectionDataAsync(null);
613 public void GetCollectionDataAsync(object userState) {
614 if ((this.onBeginGetCollectionDataDelegate == null)) {
615 this.onBeginGetCollectionDataDelegate = new BeginOperationDelegate(this.OnBeginGetCollectionData);
617 if ((this.onEndGetCollectionDataDelegate == null)) {
618 this.onEndGetCollectionDataDelegate = new EndOperationDelegate(this.OnEndGetCollectionData);
620 if ((this.onGetCollectionDataCompletedDelegate == null)) {
621 this.onGetCollectionDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetCollectionDataCompleted);
623 base.InvokeAsync(this.onBeginGetCollectionDataDelegate, null, this.onEndGetCollectionDataDelegate, this.onGetCollectionDataCompletedDelegate, userState);
626 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
627 System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetNestedData(System.AsyncCallback callback, object asyncState) {
628 return base.Channel.BeginGetNestedData(callback, asyncState);
631 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
632 WebServiceMoonlightTest.ServiceReference2.DataType2 WebServiceMoonlightTest.ServiceReference2.IService1.EndGetNestedData(System.IAsyncResult result) {
633 return base.Channel.EndGetNestedData(result);
636 private System.IAsyncResult OnBeginGetNestedData(object[] inValues, System.AsyncCallback callback, object asyncState) {
637 return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetNestedData(callback, asyncState);
640 private object[] OnEndGetNestedData(System.IAsyncResult result) {
641 WebServiceMoonlightTest.ServiceReference2.DataType2 retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetNestedData(result);
642 return new object[] {
646 private void OnGetNestedDataCompleted(object state) {
647 if ((this.GetNestedDataCompleted != null)) {
648 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
649 this.GetNestedDataCompleted(this, new GetNestedDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
653 public void GetNestedDataAsync() {
654 this.GetNestedDataAsync(null);
657 public void GetNestedDataAsync(object userState) {
658 if ((this.onBeginGetNestedDataDelegate == null)) {
659 this.onBeginGetNestedDataDelegate = new BeginOperationDelegate(this.OnBeginGetNestedData);
661 if ((this.onEndGetNestedDataDelegate == null)) {
662 this.onEndGetNestedDataDelegate = new EndOperationDelegate(this.OnEndGetNestedData);
664 if ((this.onGetNestedDataCompletedDelegate == null)) {
665 this.onGetNestedDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetNestedDataCompleted);
667 base.InvokeAsync(this.onBeginGetNestedDataDelegate, null, this.onEndGetNestedDataDelegate, this.onGetNestedDataCompletedDelegate, userState);
670 private System.IAsyncResult OnBeginOpen(object[] inValues, System.AsyncCallback callback, object asyncState) {
671 return ((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(callback, asyncState);
674 private object[] OnEndOpen(System.IAsyncResult result) {
675 ((System.ServiceModel.ICommunicationObject)(this)).EndOpen(result);
679 private void OnOpenCompleted(object state) {
680 if ((this.OpenCompleted != null)) {
681 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
682 this.OpenCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
686 public void OpenAsync() {
687 this.OpenAsync(null);
690 public void OpenAsync(object userState) {
691 if ((this.onBeginOpenDelegate == null)) {
692 this.onBeginOpenDelegate = new BeginOperationDelegate(this.OnBeginOpen);
694 if ((this.onEndOpenDelegate == null)) {
695 this.onEndOpenDelegate = new EndOperationDelegate(this.OnEndOpen);
697 if ((this.onOpenCompletedDelegate == null)) {
698 this.onOpenCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnOpenCompleted);
700 base.InvokeAsync(this.onBeginOpenDelegate, null, this.onEndOpenDelegate, this.onOpenCompletedDelegate, userState);
703 private System.IAsyncResult OnBeginClose(object[] inValues, System.AsyncCallback callback, object asyncState) {
704 return ((System.ServiceModel.ICommunicationObject)(this)).BeginClose(callback, asyncState);
707 private object[] OnEndClose(System.IAsyncResult result) {
708 ((System.ServiceModel.ICommunicationObject)(this)).EndClose(result);
712 private void OnCloseCompleted(object state) {
713 if ((this.CloseCompleted != null)) {
714 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
715 this.CloseCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
719 #region JSMGetDatabases
720 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
721 System.IAsyncResult IService1.BeginJSMGetDatabases(JSMGetDatabasesRequest request, System.AsyncCallback callback, object asyncState)
723 return base.Channel.BeginJSMGetDatabases(request, callback, asyncState);
726 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
727 private System.IAsyncResult BeginJSMGetDatabases(System.AsyncCallback callback, object asyncState)
729 JSMGetDatabasesRequest inValue = new JSMGetDatabasesRequest();
730 return ((IService1)(this)).BeginJSMGetDatabases(inValue, callback, asyncState);
733 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
734 JSMGetDatabasesResponse IService1.EndJSMGetDatabases(System.IAsyncResult result)
736 return base.Channel.EndJSMGetDatabases(result);
739 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
740 private string EndJSMGetDatabases(System.IAsyncResult result)
742 JSMGetDatabasesResponse retVal = ((IService1)(this)).EndJSMGetDatabases(result);
743 return retVal.JSMGetDatabasesResult;
746 private System.IAsyncResult OnBeginJSMGetDatabases(object[] inValues, System.AsyncCallback callback, object asyncState)
748 return this.BeginJSMGetDatabases(callback, asyncState);
751 private object[] OnEndJSMGetDatabases(System.IAsyncResult result)
753 string retVal = this.EndJSMGetDatabases(result);
754 return new object[] {
758 private void OnJSMGetDatabasesCompleted(object state)
760 if ((this.JSMGetDatabasesCompleted != null))
762 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
763 this.JSMGetDatabasesCompleted(this, new JSMGetDatabasesCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
767 public void JSMGetDatabasesAsync()
769 this.JSMGetDatabasesAsync(null);
772 public void JSMGetDatabasesAsync(object userState)
774 if ((this.onBeginJSMGetDatabasesDelegate == null))
776 this.onBeginJSMGetDatabasesDelegate = new BeginOperationDelegate(this.OnBeginJSMGetDatabases);
778 if ((this.onEndJSMGetDatabasesDelegate == null))
780 this.onEndJSMGetDatabasesDelegate = new EndOperationDelegate(this.OnEndJSMGetDatabases);
782 if ((this.onJSMGetDatabasesCompletedDelegate == null))
784 this.onJSMGetDatabasesCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnJSMGetDatabasesCompleted);
786 base.InvokeAsync(this.onBeginJSMGetDatabasesDelegate, null, this.onEndJSMGetDatabasesDelegate, this.onJSMGetDatabasesCompletedDelegate, userState);
790 public void CloseAsync() {
791 this.CloseAsync(null);
794 public void CloseAsync(object userState) {
795 if ((this.onBeginCloseDelegate == null)) {
796 this.onBeginCloseDelegate = new BeginOperationDelegate(this.OnBeginClose);
798 if ((this.onEndCloseDelegate == null)) {
799 this.onEndCloseDelegate = new EndOperationDelegate(this.OnEndClose);
801 if ((this.onCloseCompletedDelegate == null)) {
802 this.onCloseCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnCloseCompleted);
804 base.InvokeAsync(this.onBeginCloseDelegate, null, this.onEndCloseDelegate, this.onCloseCompletedDelegate, userState);
808 protected override WebServiceMoonlightTest.ServiceReference2.IService1 CreateChannel() {
809 return new Service1ClientChannel(this);
812 private class Service1ClientChannel : ChannelBase<WebServiceMoonlightTest.ServiceReference2.IService1>, WebServiceMoonlightTest.ServiceReference2.IService1 {
814 public Service1ClientChannel(System.ServiceModel.ClientBase<WebServiceMoonlightTest.ServiceReference2.IService1> client) :
818 public System.IAsyncResult BeginGetData(System.AsyncCallback callback, object asyncState) {
819 object[] _args = new object[0];
820 System.IAsyncResult _result = base.BeginInvoke("GetData", _args, callback, asyncState);
824 public object EndGetData(System.IAsyncResult result) {
825 object[] _args = new object[0];
826 object _result = ((object)(base.EndInvoke("GetData", _args, result)));
830 public System.IAsyncResult BeginGetCollectionData(System.AsyncCallback callback, object asyncState) {
831 object[] _args = new object[0];
832 System.IAsyncResult _result = base.BeginInvoke("GetCollectionData", _args, callback, asyncState);
836 public System.Collections.ObjectModel.ObservableCollection<object> EndGetCollectionData(System.IAsyncResult result) {
837 object[] _args = new object[0];
838 System.Collections.ObjectModel.ObservableCollection<object> _result = ((System.Collections.ObjectModel.ObservableCollection<object>)(base.EndInvoke("GetCollectionData", _args, result)));
842 public System.IAsyncResult BeginGetNestedData(System.AsyncCallback callback, object asyncState) {
843 object[] _args = new object[0];
844 System.IAsyncResult _result = base.BeginInvoke("GetNestedData", _args, callback, asyncState);
848 public WebServiceMoonlightTest.ServiceReference2.DataType2 EndGetNestedData(System.IAsyncResult result) {
849 object[] _args = new object[0];
850 WebServiceMoonlightTest.ServiceReference2.DataType2 _result = ((WebServiceMoonlightTest.ServiceReference2.DataType2)(base.EndInvoke("GetNestedData", _args, result)));