4 // Atsushi Enomoto <atsushi@ximian.com>
6 // Copyright (C) 2011 Novell, Inc. http://www.novell.com
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:
16 // The above copyright notice and this permission notice shall be
17 // included in all copies or substantial portions of the Software.
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.
28 using System.Collections.Generic;
29 using System.Collections.ObjectModel;
31 using System.Runtime.Serialization;
32 using System.ServiceModel;
33 using System.ServiceModel.Description;
34 using System.Threading;
35 using NUnit.Framework;
37 using WebServiceMoonlightTest.ServiceReference2;
39 using MonoTests.Helpers;
41 namespace MonoTests.System.ServiceModel.Dispatcher
44 public class Bug652331_2Test
47 [Category ("NotWorking")]
48 public void Bug652331_3 ()
51 ServiceHost serviceHost = new ServiceHost(typeof(Service1), new Uri("http://localhost:" + NetworkHelpers.FindFreePort () + "/Service1"));
52 serviceHost.AddServiceEndpoint(typeof(IService1), new BasicHttpBinding(), string.Empty);
54 // Enable metadata exchange (WSDL publishing)
55 ServiceMetadataBehavior mexBehavior = new ServiceMetadataBehavior();
56 mexBehavior.HttpGetEnabled = true;
57 serviceHost.Description.Behaviors.Add(mexBehavior);
58 serviceHost.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex");
71 var binding = new BasicHttpBinding ();
72 var remoteAddress = new EndpointAddress ("http://localhost:" + NetworkHelpers.FindFreePort () + "/Service1");
74 var normalClient = new Service1Client (binding, remoteAddress);
75 var collectionClient = new Service1Client (binding, remoteAddress);
76 var nestedClient = new Service1Client (binding, remoteAddress);
77 var dbClient = new Service1Client (binding, remoteAddress);
79 var waits = new ManualResetEvent [4];
80 for (int i = 0; i < waits.Length; i++)
81 waits [i] = new ManualResetEvent (false);
85 normalClient.GetDataCompleted += delegate (object o, GetDataCompletedEventArgs e) {
86 if (e.Error != null) {
87 Assert.Fail ("Normal failed; error: {0}", e.Error);
90 Assert.AreEqual ("A", ((DataType1) e.Result).Id, "Normal");
91 Interlocked.Increment (ref passed);
94 normalClient.GetDataAsync ();
96 collectionClient.GetCollectionDataCompleted += delegate (object sender, GetCollectionDataCompletedEventArgs e) {
97 if (e.Error != null) {
98 Assert.Fail ("Collection failed; error: {0}", e.Error);
101 Assert.AreEqual ("B,C", ItemsToString (e.Result.Cast<DataType1> ()), "Collection");
102 Interlocked.Increment (ref passed);
105 collectionClient.GetCollectionDataAsync ();
107 nestedClient.GetNestedDataCompleted += delegate (object sender, GetNestedDataCompletedEventArgs e) {
108 if (e.Error != null) {
109 Assert.Fail ("Nested failed; error: {0}", e.Error);
112 Assert.AreEqual ("D,E", ItemsToString (e.Result.Items.Cast<DataType1> ()), "Nested");
113 Interlocked.Increment (ref passed);
116 nestedClient.GetNestedDataAsync ();
118 dbClient.JSMGetDatabasesCompleted += delegate (object sender, JSMGetDatabasesCompletedEventArgs e) {
120 if (e.Error != null) {
123 Assert.AreEqual ("databases", e.Result, "Databases");
124 Interlocked.Increment (ref passed);
126 dbClient.JSMGetDatabasesAsync();
128 WaitHandle.WaitAll (waits, TimeSpan.FromMinutes (1));
129 if (passed != waits.Length)
130 Assert.Fail ("Not all tests passed!");
133 string ItemsToString (IEnumerable<DataType1> items)
135 return items.Aggregate ((string) null, (result, item) => result == null ? item.Id : result + "," + item.Id);
139 public class Service1 : IService1
141 public object GetData()
143 return new DataType1 { Id = "A" };
147 public IAsyncResult BeginGetData(AsyncCallback cb, object st)
149 gd = new Func<object> (GetData);
150 return gd.BeginInvoke (cb, st);
153 public object EndGetData (IAsyncResult result)
155 return gd.EndInvoke (result);
158 public ObservableCollection<object> GetCollectionData()
160 return new ObservableCollection<object> { new DataType1 { Id = "B" }, new DataType1 { Id = "C" } };
163 Func<ObservableCollection<object>> gcd;
164 public IAsyncResult BeginGetCollectionData(AsyncCallback cb, object st)
166 gcd = new Func<ObservableCollection<object>> (GetCollectionData);
167 return gcd.BeginInvoke (cb, st);
170 public ObservableCollection<object> EndGetCollectionData (IAsyncResult result)
172 return gcd.EndInvoke (result);
175 public DataType2 GetNestedData()
177 return new DataType2 { Items = new ObservableCollection<object> { new DataType1 { Id = "D" }, new DataType1 { Id = "E" } } };
181 public IAsyncResult BeginGetNestedData(AsyncCallback cb, object st)
183 gnd = new Func<DataType2> (GetNestedData);
184 return gnd.BeginInvoke (cb, st);
187 public DataType2 EndGetNestedData (IAsyncResult result)
189 return gnd.EndInvoke (result);
192 public JSMGetDatabasesResponse JSMGetDatabases(JSMGetDatabasesRequest request)
194 return new JSMGetDatabasesResponse { JSMGetDatabasesResult = "databases" };
197 Func<JSMGetDatabasesRequest, JSMGetDatabasesResponse> gjgdb;
198 public IAsyncResult BeginJSMGetDatabases(JSMGetDatabasesRequest request, AsyncCallback callback, object asyncState)
200 gjgdb = JSMGetDatabases;
201 return gjgdb.BeginInvoke (request, callback, asyncState);
204 public JSMGetDatabasesResponse EndJSMGetDatabases(IAsyncResult result)
206 return gjgdb.EndInvoke (result);
212 //------------------------------------------------------------------------------
214 // This code was generated by a tool.
215 // Runtime Version:4.0.30319.372
217 // Changes to this file may cause incorrect behavior and will be lost if
218 // the code is regenerated.
220 //------------------------------------------------------------------------------
223 // This code was auto-generated by Microsoft.Silverlight.ServiceReference, version 4.0.50826.0
225 namespace WebServiceMoonlightTest.ServiceReference2 {
226 using System.Runtime.Serialization;
229 [System.Diagnostics.DebuggerStepThroughAttribute()]
230 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
231 [System.Runtime.Serialization.DataContractAttribute(Name="DataType1", Namespace="http://mynamespace")]
232 public partial class DataType1 : object, System.ComponentModel.INotifyPropertyChanged {
234 private string IdField;
236 [System.Runtime.Serialization.DataMemberAttribute()]
242 if ((object.ReferenceEquals(this.IdField, value) != true)) {
243 this.IdField = value;
244 this.RaisePropertyChanged("Id");
249 public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
251 protected void RaisePropertyChanged(string propertyName) {
252 System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
253 if ((propertyChanged != null)) {
254 propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
259 [System.Diagnostics.DebuggerStepThroughAttribute()]
260 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
261 [System.Runtime.Serialization.DataContractAttribute(Name="DataType2", Namespace="http://mynamespace")]
262 [System.Runtime.Serialization.KnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
263 [System.Runtime.Serialization.KnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
264 public partial class DataType2 : object, System.ComponentModel.INotifyPropertyChanged {
266 private System.Collections.ObjectModel.ObservableCollection<object> ItemsField;
268 [System.Runtime.Serialization.DataMemberAttribute()]
269 public System.Collections.ObjectModel.ObservableCollection<object> Items {
271 return this.ItemsField;
274 if ((object.ReferenceEquals(this.ItemsField, value) != true)) {
275 this.ItemsField = value;
276 this.RaisePropertyChanged("Items");
281 public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
283 protected void RaisePropertyChanged(string propertyName) {
284 System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
285 if ((propertyChanged != null)) {
286 propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
291 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
292 [System.ServiceModel.ServiceContractAttribute(Namespace="http://mynamespace", ConfigurationName="ServiceReference1.IService1")]
293 public interface IService1 {
295 [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetData", ReplyAction="http://mynamespace/IService1/GetDataResponse")]
296 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
297 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType2))]
298 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
299 System.IAsyncResult BeginGetData(System.AsyncCallback callback, object asyncState);
301 object EndGetData(System.IAsyncResult result);
303 [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetCollectionData", ReplyAction="http://mynamespace/IService1/GetCollectionDataResponse")]
304 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
305 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType2))]
306 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
307 System.IAsyncResult BeginGetCollectionData(System.AsyncCallback callback, object asyncState);
309 System.Collections.ObjectModel.ObservableCollection<object> EndGetCollectionData(System.IAsyncResult result);
311 [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetNestedData", ReplyAction="http://mynamespace/IService1/GetNestedDataResponse")]
312 System.IAsyncResult BeginGetNestedData(System.AsyncCallback callback, object asyncState);
314 WebServiceMoonlightTest.ServiceReference2.DataType2 EndGetNestedData(System.IAsyncResult result);
316 [System.ServiceModel.OperationContractAttribute(AsyncPattern = true, Action = "http://mynamespace/IService1/JSMGetDatabases", ReplyAction = "http://mynamespace/IService1/JSMGetDatabasesResponse")]
317 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(object[]))]
318 System.IAsyncResult BeginJSMGetDatabases(JSMGetDatabasesRequest request, System.AsyncCallback callback, object asyncState);
320 JSMGetDatabasesResponse EndJSMGetDatabases(System.IAsyncResult result);
323 #region JSMGetDatabases
324 [System.Diagnostics.DebuggerStepThroughAttribute()]
325 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
326 [System.ServiceModel.MessageContractAttribute(WrapperName = "JSMGetDatabases", WrapperNamespace = "", IsWrapped = true)]
327 public partial class JSMGetDatabasesRequest
330 public JSMGetDatabasesRequest()
335 [System.Diagnostics.DebuggerStepThroughAttribute()]
336 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
337 [System.ServiceModel.MessageContractAttribute(WrapperName = "JSMGetDatabasesResponse", WrapperNamespace = "", IsWrapped = true)]
338 public partial class JSMGetDatabasesResponse
341 [System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 0)]
342 [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
343 public string JSMGetDatabasesResult;
345 public JSMGetDatabasesResponse()
349 public JSMGetDatabasesResponse(string JSMGetDatabasesResult)
351 this.JSMGetDatabasesResult = JSMGetDatabasesResult;
357 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
358 public interface IService1Channel : WebServiceMoonlightTest.ServiceReference2.IService1, System.ServiceModel.IClientChannel {
361 [System.Diagnostics.DebuggerStepThroughAttribute()]
362 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
363 public partial class GetDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
365 private object[] results;
367 public GetDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
368 base(exception, cancelled, userState) {
369 this.results = results;
372 public object Result {
374 base.RaiseExceptionIfNecessary();
375 return ((object)(this.results[0]));
380 [System.Diagnostics.DebuggerStepThroughAttribute()]
381 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
382 public partial class GetCollectionDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
384 private object[] results;
386 public GetCollectionDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
387 base(exception, cancelled, userState) {
388 this.results = results;
391 public System.Collections.ObjectModel.ObservableCollection<object> Result {
393 base.RaiseExceptionIfNecessary();
394 return ((System.Collections.ObjectModel.ObservableCollection<object>)(this.results[0]));
399 [System.Diagnostics.DebuggerStepThroughAttribute()]
400 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
401 public partial class GetNestedDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
403 private object[] results;
405 public GetNestedDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
406 base(exception, cancelled, userState) {
407 this.results = results;
410 public WebServiceMoonlightTest.ServiceReference2.DataType2 Result {
412 base.RaiseExceptionIfNecessary();
413 return ((WebServiceMoonlightTest.ServiceReference2.DataType2)(this.results[0]));
418 [System.Diagnostics.DebuggerStepThroughAttribute()]
419 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
420 public partial class JSMGetDatabasesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
423 private object[] results;
425 public JSMGetDatabasesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
426 base(exception, cancelled, userState)
428 this.results = results;
435 base.RaiseExceptionIfNecessary();
436 return ((string)(this.results[0]));
441 [System.Diagnostics.DebuggerStepThroughAttribute()]
442 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
443 public partial class Service1Client : System.ServiceModel.ClientBase<WebServiceMoonlightTest.ServiceReference2.IService1>, WebServiceMoonlightTest.ServiceReference2.IService1 {
445 private BeginOperationDelegate onBeginGetDataDelegate;
447 private EndOperationDelegate onEndGetDataDelegate;
449 private System.Threading.SendOrPostCallback onGetDataCompletedDelegate;
451 private BeginOperationDelegate onBeginGetCollectionDataDelegate;
453 private EndOperationDelegate onEndGetCollectionDataDelegate;
455 private System.Threading.SendOrPostCallback onGetCollectionDataCompletedDelegate;
457 private BeginOperationDelegate onBeginGetNestedDataDelegate;
459 private EndOperationDelegate onEndGetNestedDataDelegate;
461 private System.Threading.SendOrPostCallback onGetNestedDataCompletedDelegate;
463 private BeginOperationDelegate onBeginOpenDelegate;
465 private EndOperationDelegate onEndOpenDelegate;
467 private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
469 private BeginOperationDelegate onBeginCloseDelegate;
471 private EndOperationDelegate onEndCloseDelegate;
473 private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
475 #region JSMGetDatabasesDelegates
476 private BeginOperationDelegate onBeginJSMGetDatabasesDelegate;
478 private EndOperationDelegate onEndJSMGetDatabasesDelegate;
480 private System.Threading.SendOrPostCallback onJSMGetDatabasesCompletedDelegate;
483 public Service1Client() {
486 public Service1Client(string endpointConfigurationName) :
487 base(endpointConfigurationName) {
490 public Service1Client(string endpointConfigurationName, string remoteAddress) :
491 base(endpointConfigurationName, remoteAddress) {
494 public Service1Client(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
495 base(endpointConfigurationName, remoteAddress) {
498 public Service1Client(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
499 base(binding, remoteAddress) {
503 public System.Net.CookieContainer CookieContainer {
505 System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
506 if ((httpCookieContainerManager != null)) {
507 return httpCookieContainerManager.CookieContainer;
514 System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
515 if ((httpCookieContainerManager != null)) {
516 httpCookieContainerManager.CookieContainer = value;
519 throw new System.InvalidOperationException("Unable to set the CookieContainer. Please make sure the binding contains an HttpC" +
520 "ookieContainerBindingElement.");
526 public event System.EventHandler<GetDataCompletedEventArgs> GetDataCompleted;
528 public event System.EventHandler<GetCollectionDataCompletedEventArgs> GetCollectionDataCompleted;
530 public event System.EventHandler<GetNestedDataCompletedEventArgs> GetNestedDataCompleted;
532 public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> OpenCompleted;
534 public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> CloseCompleted;
536 public event System.EventHandler<JSMGetDatabasesCompletedEventArgs> JSMGetDatabasesCompleted;
539 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
540 System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetData(System.AsyncCallback callback, object asyncState) {
541 return base.Channel.BeginGetData(callback, asyncState);
544 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
545 object WebServiceMoonlightTest.ServiceReference2.IService1.EndGetData(System.IAsyncResult result) {
546 return base.Channel.EndGetData(result);
549 private System.IAsyncResult OnBeginGetData(object[] inValues, System.AsyncCallback callback, object asyncState) {
550 return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetData(callback, asyncState);
553 private object[] OnEndGetData(System.IAsyncResult result) {
554 object retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetData(result);
555 return new object[] {
559 private void OnGetDataCompleted(object state) {
560 if ((this.GetDataCompleted != null)) {
561 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
562 this.GetDataCompleted(this, new GetDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
566 public void GetDataAsync() {
567 this.GetDataAsync(null);
570 public void GetDataAsync(object userState) {
571 if ((this.onBeginGetDataDelegate == null)) {
572 this.onBeginGetDataDelegate = new BeginOperationDelegate(this.OnBeginGetData);
574 if ((this.onEndGetDataDelegate == null)) {
575 this.onEndGetDataDelegate = new EndOperationDelegate(this.OnEndGetData);
577 if ((this.onGetDataCompletedDelegate == null)) {
578 this.onGetDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetDataCompleted);
580 base.InvokeAsync(this.onBeginGetDataDelegate, null, this.onEndGetDataDelegate, this.onGetDataCompletedDelegate, userState);
583 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
584 System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetCollectionData(System.AsyncCallback callback, object asyncState) {
585 return base.Channel.BeginGetCollectionData(callback, asyncState);
588 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
589 System.Collections.ObjectModel.ObservableCollection<object> WebServiceMoonlightTest.ServiceReference2.IService1.EndGetCollectionData(System.IAsyncResult result) {
590 return base.Channel.EndGetCollectionData(result);
593 private System.IAsyncResult OnBeginGetCollectionData(object[] inValues, System.AsyncCallback callback, object asyncState) {
594 return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetCollectionData(callback, asyncState);
597 private object[] OnEndGetCollectionData(System.IAsyncResult result) {
598 System.Collections.ObjectModel.ObservableCollection<object> retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetCollectionData(result);
599 return new object[] {
603 private void OnGetCollectionDataCompleted(object state) {
604 if ((this.GetCollectionDataCompleted != null)) {
605 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
606 this.GetCollectionDataCompleted(this, new GetCollectionDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
610 public void GetCollectionDataAsync() {
611 this.GetCollectionDataAsync(null);
614 public void GetCollectionDataAsync(object userState) {
615 if ((this.onBeginGetCollectionDataDelegate == null)) {
616 this.onBeginGetCollectionDataDelegate = new BeginOperationDelegate(this.OnBeginGetCollectionData);
618 if ((this.onEndGetCollectionDataDelegate == null)) {
619 this.onEndGetCollectionDataDelegate = new EndOperationDelegate(this.OnEndGetCollectionData);
621 if ((this.onGetCollectionDataCompletedDelegate == null)) {
622 this.onGetCollectionDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetCollectionDataCompleted);
624 base.InvokeAsync(this.onBeginGetCollectionDataDelegate, null, this.onEndGetCollectionDataDelegate, this.onGetCollectionDataCompletedDelegate, userState);
627 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
628 System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetNestedData(System.AsyncCallback callback, object asyncState) {
629 return base.Channel.BeginGetNestedData(callback, asyncState);
632 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
633 WebServiceMoonlightTest.ServiceReference2.DataType2 WebServiceMoonlightTest.ServiceReference2.IService1.EndGetNestedData(System.IAsyncResult result) {
634 return base.Channel.EndGetNestedData(result);
637 private System.IAsyncResult OnBeginGetNestedData(object[] inValues, System.AsyncCallback callback, object asyncState) {
638 return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetNestedData(callback, asyncState);
641 private object[] OnEndGetNestedData(System.IAsyncResult result) {
642 WebServiceMoonlightTest.ServiceReference2.DataType2 retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetNestedData(result);
643 return new object[] {
647 private void OnGetNestedDataCompleted(object state) {
648 if ((this.GetNestedDataCompleted != null)) {
649 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
650 this.GetNestedDataCompleted(this, new GetNestedDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
654 public void GetNestedDataAsync() {
655 this.GetNestedDataAsync(null);
658 public void GetNestedDataAsync(object userState) {
659 if ((this.onBeginGetNestedDataDelegate == null)) {
660 this.onBeginGetNestedDataDelegate = new BeginOperationDelegate(this.OnBeginGetNestedData);
662 if ((this.onEndGetNestedDataDelegate == null)) {
663 this.onEndGetNestedDataDelegate = new EndOperationDelegate(this.OnEndGetNestedData);
665 if ((this.onGetNestedDataCompletedDelegate == null)) {
666 this.onGetNestedDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetNestedDataCompleted);
668 base.InvokeAsync(this.onBeginGetNestedDataDelegate, null, this.onEndGetNestedDataDelegate, this.onGetNestedDataCompletedDelegate, userState);
671 private System.IAsyncResult OnBeginOpen(object[] inValues, System.AsyncCallback callback, object asyncState) {
672 return ((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(callback, asyncState);
675 private object[] OnEndOpen(System.IAsyncResult result) {
676 ((System.ServiceModel.ICommunicationObject)(this)).EndOpen(result);
680 private void OnOpenCompleted(object state) {
681 if ((this.OpenCompleted != null)) {
682 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
683 this.OpenCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
687 public void OpenAsync() {
688 this.OpenAsync(null);
691 public void OpenAsync(object userState) {
692 if ((this.onBeginOpenDelegate == null)) {
693 this.onBeginOpenDelegate = new BeginOperationDelegate(this.OnBeginOpen);
695 if ((this.onEndOpenDelegate == null)) {
696 this.onEndOpenDelegate = new EndOperationDelegate(this.OnEndOpen);
698 if ((this.onOpenCompletedDelegate == null)) {
699 this.onOpenCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnOpenCompleted);
701 base.InvokeAsync(this.onBeginOpenDelegate, null, this.onEndOpenDelegate, this.onOpenCompletedDelegate, userState);
704 private System.IAsyncResult OnBeginClose(object[] inValues, System.AsyncCallback callback, object asyncState) {
705 return ((System.ServiceModel.ICommunicationObject)(this)).BeginClose(callback, asyncState);
708 private object[] OnEndClose(System.IAsyncResult result) {
709 ((System.ServiceModel.ICommunicationObject)(this)).EndClose(result);
713 private void OnCloseCompleted(object state) {
714 if ((this.CloseCompleted != null)) {
715 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
716 this.CloseCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
720 #region JSMGetDatabases
721 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
722 System.IAsyncResult IService1.BeginJSMGetDatabases(JSMGetDatabasesRequest request, System.AsyncCallback callback, object asyncState)
724 return base.Channel.BeginJSMGetDatabases(request, callback, asyncState);
727 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
728 private System.IAsyncResult BeginJSMGetDatabases(System.AsyncCallback callback, object asyncState)
730 JSMGetDatabasesRequest inValue = new JSMGetDatabasesRequest();
731 return ((IService1)(this)).BeginJSMGetDatabases(inValue, callback, asyncState);
734 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
735 JSMGetDatabasesResponse IService1.EndJSMGetDatabases(System.IAsyncResult result)
737 return base.Channel.EndJSMGetDatabases(result);
740 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
741 private string EndJSMGetDatabases(System.IAsyncResult result)
743 JSMGetDatabasesResponse retVal = ((IService1)(this)).EndJSMGetDatabases(result);
744 return retVal.JSMGetDatabasesResult;
747 private System.IAsyncResult OnBeginJSMGetDatabases(object[] inValues, System.AsyncCallback callback, object asyncState)
749 return this.BeginJSMGetDatabases(callback, asyncState);
752 private object[] OnEndJSMGetDatabases(System.IAsyncResult result)
754 string retVal = this.EndJSMGetDatabases(result);
755 return new object[] {
759 private void OnJSMGetDatabasesCompleted(object state)
761 if ((this.JSMGetDatabasesCompleted != null))
763 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
764 this.JSMGetDatabasesCompleted(this, new JSMGetDatabasesCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
768 public void JSMGetDatabasesAsync()
770 this.JSMGetDatabasesAsync(null);
773 public void JSMGetDatabasesAsync(object userState)
775 if ((this.onBeginJSMGetDatabasesDelegate == null))
777 this.onBeginJSMGetDatabasesDelegate = new BeginOperationDelegate(this.OnBeginJSMGetDatabases);
779 if ((this.onEndJSMGetDatabasesDelegate == null))
781 this.onEndJSMGetDatabasesDelegate = new EndOperationDelegate(this.OnEndJSMGetDatabases);
783 if ((this.onJSMGetDatabasesCompletedDelegate == null))
785 this.onJSMGetDatabasesCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnJSMGetDatabasesCompleted);
787 base.InvokeAsync(this.onBeginJSMGetDatabasesDelegate, null, this.onEndJSMGetDatabasesDelegate, this.onJSMGetDatabasesCompletedDelegate, userState);
791 public void CloseAsync() {
792 this.CloseAsync(null);
795 public void CloseAsync(object userState) {
796 if ((this.onBeginCloseDelegate == null)) {
797 this.onBeginCloseDelegate = new BeginOperationDelegate(this.OnBeginClose);
799 if ((this.onEndCloseDelegate == null)) {
800 this.onEndCloseDelegate = new EndOperationDelegate(this.OnEndClose);
802 if ((this.onCloseCompletedDelegate == null)) {
803 this.onCloseCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnCloseCompleted);
805 base.InvokeAsync(this.onBeginCloseDelegate, null, this.onEndCloseDelegate, this.onCloseCompletedDelegate, userState);
809 protected override WebServiceMoonlightTest.ServiceReference2.IService1 CreateChannel() {
810 return new Service1ClientChannel(this);
813 private class Service1ClientChannel : ChannelBase<WebServiceMoonlightTest.ServiceReference2.IService1>, WebServiceMoonlightTest.ServiceReference2.IService1 {
815 public Service1ClientChannel(System.ServiceModel.ClientBase<WebServiceMoonlightTest.ServiceReference2.IService1> client) :
819 public System.IAsyncResult BeginGetData(System.AsyncCallback callback, object asyncState) {
820 object[] _args = new object[0];
821 System.IAsyncResult _result = base.BeginInvoke("GetData", _args, callback, asyncState);
825 public object EndGetData(System.IAsyncResult result) {
826 object[] _args = new object[0];
827 object _result = ((object)(base.EndInvoke("GetData", _args, result)));
831 public System.IAsyncResult BeginGetCollectionData(System.AsyncCallback callback, object asyncState) {
832 object[] _args = new object[0];
833 System.IAsyncResult _result = base.BeginInvoke("GetCollectionData", _args, callback, asyncState);
837 public System.Collections.ObjectModel.ObservableCollection<object> EndGetCollectionData(System.IAsyncResult result) {
838 object[] _args = new object[0];
839 System.Collections.ObjectModel.ObservableCollection<object> _result = ((System.Collections.ObjectModel.ObservableCollection<object>)(base.EndInvoke("GetCollectionData", _args, result)));
843 public System.IAsyncResult BeginGetNestedData(System.AsyncCallback callback, object asyncState) {
844 object[] _args = new object[0];
845 System.IAsyncResult _result = base.BeginInvoke("GetNestedData", _args, callback, asyncState);
849 public WebServiceMoonlightTest.ServiceReference2.DataType2 EndGetNestedData(System.IAsyncResult result) {
850 object[] _args = new object[0];
851 WebServiceMoonlightTest.ServiceReference2.DataType2 _result = ((WebServiceMoonlightTest.ServiceReference2.DataType2)(base.EndInvoke("GetNestedData", _args, result)));