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);
80 ManualResetEvent wait = new ManualResetEvent (false);
81 Exception error = null;
84 normalClient.GetDataCompleted += delegate (object o, GetDataCompletedEventArgs e) {
87 result = e.Error == null ? e.Result : null;
92 normalClient.GetDataAsync ();
94 Assert.IsTrue (wait.WaitOne (TimeSpan.FromSeconds (20)), "#1 timeout");
95 Assert.IsNull (error, "#1.1, inner exception: {0}", error);
96 Assert.AreEqual ("A", ((DataType1) result).Id, "#1.2");
100 ManualResetEvent wait = new ManualResetEvent (false);
101 Exception error = null;
102 ObservableCollection<object> result = null;
104 collectionClient.GetCollectionDataCompleted += delegate (object sender, GetCollectionDataCompletedEventArgs e) {
107 result = e.Error == null ? e.Result : null;
112 collectionClient.GetCollectionDataAsync ();
114 Assert.IsTrue (wait.WaitOne (TimeSpan.FromSeconds (20)), "#2 timeout");
115 Assert.IsNull (error, "#2.1, inner exception: {0}", error);
116 Assert.AreEqual ("B,C", ItemsToString (result.Cast<DataType1> ()), "#2.2");
120 ManualResetEvent wait = new ManualResetEvent (false);
121 Exception error = null;
122 WebServiceMoonlightTest.ServiceReference2.DataType2 result = null;
124 nestedClient.GetNestedDataCompleted += delegate (object sender, GetNestedDataCompletedEventArgs e) {
127 result = e.Error == null ? e.Result : null;
132 nestedClient.GetNestedDataAsync ();
134 Assert.IsTrue (wait.WaitOne (TimeSpan.FromSeconds (20)), "#3 timeout");
135 Assert.IsNull (error, "#3.1, inner exception: {0}", error);
136 Assert.AreEqual ("D,E", ItemsToString (result.Items.Cast<DataType1> ()), "#3.2");
140 ManualResetEvent wait = new ManualResetEvent (false);
141 Exception error = null;
142 string result = null;
144 dbClient.JSMGetDatabasesCompleted += delegate (object sender, JSMGetDatabasesCompletedEventArgs e) {
147 result = e.Error == null ? e.Result : null;
152 dbClient.JSMGetDatabasesAsync();
154 Assert.IsTrue (wait.WaitOne (TimeSpan.FromSeconds (20)), "#4 timeout");
155 Assert.IsNull (error, "#4.1, inner exception: {0}", error);
156 Assert.AreEqual ("databases", result, "#4.2");
160 string ItemsToString (IEnumerable<DataType1> items)
162 return items.Aggregate ((string) null, (result, item) => result == null ? item.Id : result + "," + item.Id);
166 public class Service1 : IService1
168 public object GetData()
170 return new DataType1 { Id = "A" };
174 public IAsyncResult BeginGetData(AsyncCallback cb, object st)
176 gd = new Func<object> (GetData);
177 return gd.BeginInvoke (cb, st);
180 public object EndGetData (IAsyncResult result)
182 return gd.EndInvoke (result);
185 public ObservableCollection<object> GetCollectionData()
187 return new ObservableCollection<object> { new DataType1 { Id = "B" }, new DataType1 { Id = "C" } };
190 Func<ObservableCollection<object>> gcd;
191 public IAsyncResult BeginGetCollectionData(AsyncCallback cb, object st)
193 gcd = new Func<ObservableCollection<object>> (GetCollectionData);
194 return gcd.BeginInvoke (cb, st);
197 public ObservableCollection<object> EndGetCollectionData (IAsyncResult result)
199 return gcd.EndInvoke (result);
202 public DataType2 GetNestedData()
204 return new DataType2 { Items = new ObservableCollection<object> { new DataType1 { Id = "D" }, new DataType1 { Id = "E" } } };
208 public IAsyncResult BeginGetNestedData(AsyncCallback cb, object st)
210 gnd = new Func<DataType2> (GetNestedData);
211 return gnd.BeginInvoke (cb, st);
214 public DataType2 EndGetNestedData (IAsyncResult result)
216 return gnd.EndInvoke (result);
219 public JSMGetDatabasesResponse JSMGetDatabases(JSMGetDatabasesRequest request)
221 return new JSMGetDatabasesResponse { JSMGetDatabasesResult = "databases" };
224 Func<JSMGetDatabasesRequest, JSMGetDatabasesResponse> gjgdb;
225 public IAsyncResult BeginJSMGetDatabases(JSMGetDatabasesRequest request, AsyncCallback callback, object asyncState)
227 gjgdb = JSMGetDatabases;
228 return gjgdb.BeginInvoke (request, callback, asyncState);
231 public JSMGetDatabasesResponse EndJSMGetDatabases(IAsyncResult result)
233 return gjgdb.EndInvoke (result);
239 //------------------------------------------------------------------------------
241 // This code was generated by a tool.
242 // Runtime Version:4.0.30319.372
244 // Changes to this file may cause incorrect behavior and will be lost if
245 // the code is regenerated.
247 //------------------------------------------------------------------------------
250 // This code was auto-generated by Microsoft.Silverlight.ServiceReference, version 4.0.50826.0
252 namespace WebServiceMoonlightTest.ServiceReference2 {
253 using System.Runtime.Serialization;
256 [System.Diagnostics.DebuggerStepThroughAttribute()]
257 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
258 [System.Runtime.Serialization.DataContractAttribute(Name="DataType1", Namespace="http://mynamespace")]
259 public partial class DataType1 : object, System.ComponentModel.INotifyPropertyChanged {
261 private string IdField;
263 [System.Runtime.Serialization.DataMemberAttribute()]
269 if ((object.ReferenceEquals(this.IdField, value) != true)) {
270 this.IdField = value;
271 this.RaisePropertyChanged("Id");
276 public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
278 protected void RaisePropertyChanged(string propertyName) {
279 System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
280 if ((propertyChanged != null)) {
281 propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
286 [System.Diagnostics.DebuggerStepThroughAttribute()]
287 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
288 [System.Runtime.Serialization.DataContractAttribute(Name="DataType2", Namespace="http://mynamespace")]
289 [System.Runtime.Serialization.KnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
290 [System.Runtime.Serialization.KnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
291 public partial class DataType2 : object, System.ComponentModel.INotifyPropertyChanged {
293 private System.Collections.ObjectModel.ObservableCollection<object> ItemsField;
295 [System.Runtime.Serialization.DataMemberAttribute()]
296 public System.Collections.ObjectModel.ObservableCollection<object> Items {
298 return this.ItemsField;
301 if ((object.ReferenceEquals(this.ItemsField, value) != true)) {
302 this.ItemsField = value;
303 this.RaisePropertyChanged("Items");
308 public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
310 protected void RaisePropertyChanged(string propertyName) {
311 System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
312 if ((propertyChanged != null)) {
313 propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
318 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
319 [System.ServiceModel.ServiceContractAttribute(Namespace="http://mynamespace", ConfigurationName="ServiceReference1.IService1")]
320 public interface IService1 {
322 [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetData", ReplyAction="http://mynamespace/IService1/GetDataResponse")]
323 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
324 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType2))]
325 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
326 System.IAsyncResult BeginGetData(System.AsyncCallback callback, object asyncState);
328 object EndGetData(System.IAsyncResult result);
330 [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetCollectionData", ReplyAction="http://mynamespace/IService1/GetCollectionDataResponse")]
331 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
332 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType2))]
333 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
334 System.IAsyncResult BeginGetCollectionData(System.AsyncCallback callback, object asyncState);
336 System.Collections.ObjectModel.ObservableCollection<object> EndGetCollectionData(System.IAsyncResult result);
338 [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetNestedData", ReplyAction="http://mynamespace/IService1/GetNestedDataResponse")]
339 System.IAsyncResult BeginGetNestedData(System.AsyncCallback callback, object asyncState);
341 WebServiceMoonlightTest.ServiceReference2.DataType2 EndGetNestedData(System.IAsyncResult result);
343 [System.ServiceModel.OperationContractAttribute(AsyncPattern = true, Action = "http://mynamespace/IService1/JSMGetDatabases", ReplyAction = "http://mynamespace/IService1/JSMGetDatabasesResponse")]
344 [System.ServiceModel.ServiceKnownTypeAttribute(typeof(object[]))]
345 System.IAsyncResult BeginJSMGetDatabases(JSMGetDatabasesRequest request, System.AsyncCallback callback, object asyncState);
347 JSMGetDatabasesResponse EndJSMGetDatabases(System.IAsyncResult result);
350 #region JSMGetDatabases
351 [System.Diagnostics.DebuggerStepThroughAttribute()]
352 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
353 [System.ServiceModel.MessageContractAttribute(WrapperName = "JSMGetDatabases", WrapperNamespace = "", IsWrapped = true)]
354 public partial class JSMGetDatabasesRequest
357 public JSMGetDatabasesRequest()
362 [System.Diagnostics.DebuggerStepThroughAttribute()]
363 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
364 [System.ServiceModel.MessageContractAttribute(WrapperName = "JSMGetDatabasesResponse", WrapperNamespace = "", IsWrapped = true)]
365 public partial class JSMGetDatabasesResponse
368 [System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 0)]
369 [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
370 public string JSMGetDatabasesResult;
372 public JSMGetDatabasesResponse()
376 public JSMGetDatabasesResponse(string JSMGetDatabasesResult)
378 this.JSMGetDatabasesResult = JSMGetDatabasesResult;
384 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
385 public interface IService1Channel : WebServiceMoonlightTest.ServiceReference2.IService1, System.ServiceModel.IClientChannel {
388 [System.Diagnostics.DebuggerStepThroughAttribute()]
389 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
390 public partial class GetDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
392 private object[] results;
394 public GetDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
395 base(exception, cancelled, userState) {
396 this.results = results;
399 public object Result {
401 base.RaiseExceptionIfNecessary();
402 return ((object)(this.results[0]));
407 [System.Diagnostics.DebuggerStepThroughAttribute()]
408 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
409 public partial class GetCollectionDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
411 private object[] results;
413 public GetCollectionDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
414 base(exception, cancelled, userState) {
415 this.results = results;
418 public System.Collections.ObjectModel.ObservableCollection<object> Result {
420 base.RaiseExceptionIfNecessary();
421 return ((System.Collections.ObjectModel.ObservableCollection<object>)(this.results[0]));
426 [System.Diagnostics.DebuggerStepThroughAttribute()]
427 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
428 public partial class GetNestedDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
430 private object[] results;
432 public GetNestedDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
433 base(exception, cancelled, userState) {
434 this.results = results;
437 public WebServiceMoonlightTest.ServiceReference2.DataType2 Result {
439 base.RaiseExceptionIfNecessary();
440 return ((WebServiceMoonlightTest.ServiceReference2.DataType2)(this.results[0]));
445 [System.Diagnostics.DebuggerStepThroughAttribute()]
446 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
447 public partial class JSMGetDatabasesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
450 private object[] results;
452 public JSMGetDatabasesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
453 base(exception, cancelled, userState)
455 this.results = results;
462 base.RaiseExceptionIfNecessary();
463 return ((string)(this.results[0]));
468 [System.Diagnostics.DebuggerStepThroughAttribute()]
469 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
470 public partial class Service1Client : System.ServiceModel.ClientBase<WebServiceMoonlightTest.ServiceReference2.IService1>, WebServiceMoonlightTest.ServiceReference2.IService1 {
472 private BeginOperationDelegate onBeginGetDataDelegate;
474 private EndOperationDelegate onEndGetDataDelegate;
476 private System.Threading.SendOrPostCallback onGetDataCompletedDelegate;
478 private BeginOperationDelegate onBeginGetCollectionDataDelegate;
480 private EndOperationDelegate onEndGetCollectionDataDelegate;
482 private System.Threading.SendOrPostCallback onGetCollectionDataCompletedDelegate;
484 private BeginOperationDelegate onBeginGetNestedDataDelegate;
486 private EndOperationDelegate onEndGetNestedDataDelegate;
488 private System.Threading.SendOrPostCallback onGetNestedDataCompletedDelegate;
490 private BeginOperationDelegate onBeginOpenDelegate;
492 private EndOperationDelegate onEndOpenDelegate;
494 private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
496 private BeginOperationDelegate onBeginCloseDelegate;
498 private EndOperationDelegate onEndCloseDelegate;
500 private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
502 #region JSMGetDatabasesDelegates
503 private BeginOperationDelegate onBeginJSMGetDatabasesDelegate;
505 private EndOperationDelegate onEndJSMGetDatabasesDelegate;
507 private System.Threading.SendOrPostCallback onJSMGetDatabasesCompletedDelegate;
510 public Service1Client() {
513 public Service1Client(string endpointConfigurationName) :
514 base(endpointConfigurationName) {
517 public Service1Client(string endpointConfigurationName, string remoteAddress) :
518 base(endpointConfigurationName, remoteAddress) {
521 public Service1Client(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
522 base(endpointConfigurationName, remoteAddress) {
525 public Service1Client(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
526 base(binding, remoteAddress) {
530 public System.Net.CookieContainer CookieContainer {
532 System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
533 if ((httpCookieContainerManager != null)) {
534 return httpCookieContainerManager.CookieContainer;
541 System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
542 if ((httpCookieContainerManager != null)) {
543 httpCookieContainerManager.CookieContainer = value;
546 throw new System.InvalidOperationException("Unable to set the CookieContainer. Please make sure the binding contains an HttpC" +
547 "ookieContainerBindingElement.");
553 public event System.EventHandler<GetDataCompletedEventArgs> GetDataCompleted;
555 public event System.EventHandler<GetCollectionDataCompletedEventArgs> GetCollectionDataCompleted;
557 public event System.EventHandler<GetNestedDataCompletedEventArgs> GetNestedDataCompleted;
559 public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> OpenCompleted;
561 public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> CloseCompleted;
563 public event System.EventHandler<JSMGetDatabasesCompletedEventArgs> JSMGetDatabasesCompleted;
566 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
567 System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetData(System.AsyncCallback callback, object asyncState) {
568 return base.Channel.BeginGetData(callback, asyncState);
571 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
572 object WebServiceMoonlightTest.ServiceReference2.IService1.EndGetData(System.IAsyncResult result) {
573 return base.Channel.EndGetData(result);
576 private System.IAsyncResult OnBeginGetData(object[] inValues, System.AsyncCallback callback, object asyncState) {
577 return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetData(callback, asyncState);
580 private object[] OnEndGetData(System.IAsyncResult result) {
581 object retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetData(result);
582 return new object[] {
586 private void OnGetDataCompleted(object state) {
587 if ((this.GetDataCompleted != null)) {
588 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
589 this.GetDataCompleted(this, new GetDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
593 public void GetDataAsync() {
594 this.GetDataAsync(null);
597 public void GetDataAsync(object userState) {
598 if ((this.onBeginGetDataDelegate == null)) {
599 this.onBeginGetDataDelegate = new BeginOperationDelegate(this.OnBeginGetData);
601 if ((this.onEndGetDataDelegate == null)) {
602 this.onEndGetDataDelegate = new EndOperationDelegate(this.OnEndGetData);
604 if ((this.onGetDataCompletedDelegate == null)) {
605 this.onGetDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetDataCompleted);
607 base.InvokeAsync(this.onBeginGetDataDelegate, null, this.onEndGetDataDelegate, this.onGetDataCompletedDelegate, userState);
610 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
611 System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetCollectionData(System.AsyncCallback callback, object asyncState) {
612 return base.Channel.BeginGetCollectionData(callback, asyncState);
615 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
616 System.Collections.ObjectModel.ObservableCollection<object> WebServiceMoonlightTest.ServiceReference2.IService1.EndGetCollectionData(System.IAsyncResult result) {
617 return base.Channel.EndGetCollectionData(result);
620 private System.IAsyncResult OnBeginGetCollectionData(object[] inValues, System.AsyncCallback callback, object asyncState) {
621 return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetCollectionData(callback, asyncState);
624 private object[] OnEndGetCollectionData(System.IAsyncResult result) {
625 System.Collections.ObjectModel.ObservableCollection<object> retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetCollectionData(result);
626 return new object[] {
630 private void OnGetCollectionDataCompleted(object state) {
631 if ((this.GetCollectionDataCompleted != null)) {
632 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
633 this.GetCollectionDataCompleted(this, new GetCollectionDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
637 public void GetCollectionDataAsync() {
638 this.GetCollectionDataAsync(null);
641 public void GetCollectionDataAsync(object userState) {
642 if ((this.onBeginGetCollectionDataDelegate == null)) {
643 this.onBeginGetCollectionDataDelegate = new BeginOperationDelegate(this.OnBeginGetCollectionData);
645 if ((this.onEndGetCollectionDataDelegate == null)) {
646 this.onEndGetCollectionDataDelegate = new EndOperationDelegate(this.OnEndGetCollectionData);
648 if ((this.onGetCollectionDataCompletedDelegate == null)) {
649 this.onGetCollectionDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetCollectionDataCompleted);
651 base.InvokeAsync(this.onBeginGetCollectionDataDelegate, null, this.onEndGetCollectionDataDelegate, this.onGetCollectionDataCompletedDelegate, userState);
654 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
655 System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetNestedData(System.AsyncCallback callback, object asyncState) {
656 return base.Channel.BeginGetNestedData(callback, asyncState);
659 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
660 WebServiceMoonlightTest.ServiceReference2.DataType2 WebServiceMoonlightTest.ServiceReference2.IService1.EndGetNestedData(System.IAsyncResult result) {
661 return base.Channel.EndGetNestedData(result);
664 private System.IAsyncResult OnBeginGetNestedData(object[] inValues, System.AsyncCallback callback, object asyncState) {
665 return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetNestedData(callback, asyncState);
668 private object[] OnEndGetNestedData(System.IAsyncResult result) {
669 WebServiceMoonlightTest.ServiceReference2.DataType2 retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetNestedData(result);
670 return new object[] {
674 private void OnGetNestedDataCompleted(object state) {
675 if ((this.GetNestedDataCompleted != null)) {
676 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
677 this.GetNestedDataCompleted(this, new GetNestedDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
681 public void GetNestedDataAsync() {
682 this.GetNestedDataAsync(null);
685 public void GetNestedDataAsync(object userState) {
686 if ((this.onBeginGetNestedDataDelegate == null)) {
687 this.onBeginGetNestedDataDelegate = new BeginOperationDelegate(this.OnBeginGetNestedData);
689 if ((this.onEndGetNestedDataDelegate == null)) {
690 this.onEndGetNestedDataDelegate = new EndOperationDelegate(this.OnEndGetNestedData);
692 if ((this.onGetNestedDataCompletedDelegate == null)) {
693 this.onGetNestedDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetNestedDataCompleted);
695 base.InvokeAsync(this.onBeginGetNestedDataDelegate, null, this.onEndGetNestedDataDelegate, this.onGetNestedDataCompletedDelegate, userState);
698 private System.IAsyncResult OnBeginOpen(object[] inValues, System.AsyncCallback callback, object asyncState) {
699 return ((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(callback, asyncState);
702 private object[] OnEndOpen(System.IAsyncResult result) {
703 ((System.ServiceModel.ICommunicationObject)(this)).EndOpen(result);
707 private void OnOpenCompleted(object state) {
708 if ((this.OpenCompleted != null)) {
709 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
710 this.OpenCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
714 public void OpenAsync() {
715 this.OpenAsync(null);
718 public void OpenAsync(object userState) {
719 if ((this.onBeginOpenDelegate == null)) {
720 this.onBeginOpenDelegate = new BeginOperationDelegate(this.OnBeginOpen);
722 if ((this.onEndOpenDelegate == null)) {
723 this.onEndOpenDelegate = new EndOperationDelegate(this.OnEndOpen);
725 if ((this.onOpenCompletedDelegate == null)) {
726 this.onOpenCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnOpenCompleted);
728 base.InvokeAsync(this.onBeginOpenDelegate, null, this.onEndOpenDelegate, this.onOpenCompletedDelegate, userState);
731 private System.IAsyncResult OnBeginClose(object[] inValues, System.AsyncCallback callback, object asyncState) {
732 return ((System.ServiceModel.ICommunicationObject)(this)).BeginClose(callback, asyncState);
735 private object[] OnEndClose(System.IAsyncResult result) {
736 ((System.ServiceModel.ICommunicationObject)(this)).EndClose(result);
740 private void OnCloseCompleted(object state) {
741 if ((this.CloseCompleted != null)) {
742 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
743 this.CloseCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
747 #region JSMGetDatabases
748 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
749 System.IAsyncResult IService1.BeginJSMGetDatabases(JSMGetDatabasesRequest request, System.AsyncCallback callback, object asyncState)
751 return base.Channel.BeginJSMGetDatabases(request, callback, asyncState);
754 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
755 private System.IAsyncResult BeginJSMGetDatabases(System.AsyncCallback callback, object asyncState)
757 JSMGetDatabasesRequest inValue = new JSMGetDatabasesRequest();
758 return ((IService1)(this)).BeginJSMGetDatabases(inValue, callback, asyncState);
761 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
762 JSMGetDatabasesResponse IService1.EndJSMGetDatabases(System.IAsyncResult result)
764 return base.Channel.EndJSMGetDatabases(result);
767 [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
768 private string EndJSMGetDatabases(System.IAsyncResult result)
770 JSMGetDatabasesResponse retVal = ((IService1)(this)).EndJSMGetDatabases(result);
771 return retVal.JSMGetDatabasesResult;
774 private System.IAsyncResult OnBeginJSMGetDatabases(object[] inValues, System.AsyncCallback callback, object asyncState)
776 return this.BeginJSMGetDatabases(callback, asyncState);
779 private object[] OnEndJSMGetDatabases(System.IAsyncResult result)
781 string retVal = this.EndJSMGetDatabases(result);
782 return new object[] {
786 private void OnJSMGetDatabasesCompleted(object state)
788 if ((this.JSMGetDatabasesCompleted != null))
790 InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
791 this.JSMGetDatabasesCompleted(this, new JSMGetDatabasesCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
795 public void JSMGetDatabasesAsync()
797 this.JSMGetDatabasesAsync(null);
800 public void JSMGetDatabasesAsync(object userState)
802 if ((this.onBeginJSMGetDatabasesDelegate == null))
804 this.onBeginJSMGetDatabasesDelegate = new BeginOperationDelegate(this.OnBeginJSMGetDatabases);
806 if ((this.onEndJSMGetDatabasesDelegate == null))
808 this.onEndJSMGetDatabasesDelegate = new EndOperationDelegate(this.OnEndJSMGetDatabases);
810 if ((this.onJSMGetDatabasesCompletedDelegate == null))
812 this.onJSMGetDatabasesCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnJSMGetDatabasesCompleted);
814 base.InvokeAsync(this.onBeginJSMGetDatabasesDelegate, null, this.onEndJSMGetDatabasesDelegate, this.onJSMGetDatabasesCompletedDelegate, userState);
818 public void CloseAsync() {
819 this.CloseAsync(null);
822 public void CloseAsync(object userState) {
823 if ((this.onBeginCloseDelegate == null)) {
824 this.onBeginCloseDelegate = new BeginOperationDelegate(this.OnBeginClose);
826 if ((this.onEndCloseDelegate == null)) {
827 this.onEndCloseDelegate = new EndOperationDelegate(this.OnEndClose);
829 if ((this.onCloseCompletedDelegate == null)) {
830 this.onCloseCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnCloseCompleted);
832 base.InvokeAsync(this.onBeginCloseDelegate, null, this.onEndCloseDelegate, this.onCloseCompletedDelegate, userState);
836 protected override WebServiceMoonlightTest.ServiceReference2.IService1 CreateChannel() {
837 return new Service1ClientChannel(this);
840 private class Service1ClientChannel : ChannelBase<WebServiceMoonlightTest.ServiceReference2.IService1>, WebServiceMoonlightTest.ServiceReference2.IService1 {
842 public Service1ClientChannel(System.ServiceModel.ClientBase<WebServiceMoonlightTest.ServiceReference2.IService1> client) :
846 public System.IAsyncResult BeginGetData(System.AsyncCallback callback, object asyncState) {
847 object[] _args = new object[0];
848 System.IAsyncResult _result = base.BeginInvoke("GetData", _args, callback, asyncState);
852 public object EndGetData(System.IAsyncResult result) {
853 object[] _args = new object[0];
854 object _result = ((object)(base.EndInvoke("GetData", _args, result)));
858 public System.IAsyncResult BeginGetCollectionData(System.AsyncCallback callback, object asyncState) {
859 object[] _args = new object[0];
860 System.IAsyncResult _result = base.BeginInvoke("GetCollectionData", _args, callback, asyncState);
864 public System.Collections.ObjectModel.ObservableCollection<object> EndGetCollectionData(System.IAsyncResult result) {
865 object[] _args = new object[0];
866 System.Collections.ObjectModel.ObservableCollection<object> _result = ((System.Collections.ObjectModel.ObservableCollection<object>)(base.EndInvoke("GetCollectionData", _args, result)));
870 public System.IAsyncResult BeginGetNestedData(System.AsyncCallback callback, object asyncState) {
871 object[] _args = new object[0];
872 System.IAsyncResult _result = base.BeginInvoke("GetNestedData", _args, callback, asyncState);
876 public WebServiceMoonlightTest.ServiceReference2.DataType2 EndGetNestedData(System.IAsyncResult result) {
877 object[] _args = new object[0];
878 WebServiceMoonlightTest.ServiceReference2.DataType2 _result = ((WebServiceMoonlightTest.ServiceReference2.DataType2)(base.EndInvoke("GetNestedData", _args, result)));