New tests.
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel / ClientBase.cs
index fb45ca455caa310b653ddde6e9cee835b3345680..d9e98a1856700aeeaee3c63f3cc801deaa1a8686 100644 (file)
@@ -33,18 +33,19 @@ using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
 using System.ServiceModel.Dispatcher;
 using System.Threading;
+using System.ServiceModel.MonoInternal;
 
 namespace System.ServiceModel
 {
        [MonoTODO ("It somehow rejects classes, but dunno how we can do that besides our code wise.")]
        public abstract class ClientBase<TChannel> :
-#if !NET_2_1
+#if !MOONLIGHT
                IDisposable,
 #endif
                ICommunicationObject where TChannel : class
        {
                static InstanceContext initialContxt = new InstanceContext (null);
-#if NET_2_1
+#if MOONLIGHT
                static readonly PropertyInfo dispatcher_main_property;
                static readonly MethodInfo dispatcher_begin_invoke_method;
 
@@ -173,11 +174,9 @@ namespace System.ServiceModel
                        }
                }
 
-#if !NET_2_1
                public ClientCredentials ClientCredentials {
                        get { return ChannelFactory.Credentials; }
                }
-#endif
 
                public ServiceEndpoint Endpoint {
                        get { return factory.Endpoint; }
@@ -223,7 +222,7 @@ namespace System.ServiceModel
 
                void RunCompletedCallback (SendOrPostCallback callback, InvokeAsyncCompletedEventArgs args)
                {
-#if !NET_2_1
+#if !MOONLIGHT
                        callback (args);
 #else
                        object dispatcher = dispatcher_main_property.GetValue (null, null);
@@ -234,9 +233,9 @@ namespace System.ServiceModel
                        EventHandler a = delegate {
                                try {
                                        callback (args); 
-                                       Console.WriteLine ("ClientBase<TChannel>: operationCompletedCallback is successfully done (unless the callback has further async operations)");
+                                       //Console.WriteLine ("ClientBase<TChannel>: operationCompletedCallback is successfully done (unless the callback has further async operations)");
                                } catch (Exception ex) {
-                                       Console.WriteLine ("ClientBase<TChannel> caught an error during operationCompletedCallback: " + ex);
+                                       //Console.WriteLine ("ClientBase<TChannel> caught an error during operationCompletedCallback: " + ex);
                                        throw;
                                }
                        };
@@ -268,16 +267,16 @@ namespace System.ServiceModel
                                        if (operationCompletedCallback != null)
                                                RunCompletedCallback (operationCompletedCallback, new InvokeAsyncCompletedEventArgs (results, error, cancelled, userState));
                                } catch (Exception ex) {
-                                       Console.WriteLine ("Exception during operationCompletedCallback" + ex);
+                                       //Console.WriteLine ("Exception during operationCompletedCallback" + ex);
                                        throw;
                                }
-                               Console.WriteLine ("System.ServiceModel.ClientBase<TChannel>: web service invocation is successfully done (operationCompletedCallback may not be).");
+                               //Console.WriteLine ("System.ServiceModel.ClientBase<TChannel>: web service invocation is successfully done (operationCompletedCallback may not be).");
                        };
                        begin_async_result = beginOperationDelegate (inValues, cb, userState);
                }
                IAsyncResult begin_async_result;
 
-#if !NET_2_1
+#if !MOONLIGHT
                void IDisposable.Dispose ()
                {
                        Close ();
@@ -398,13 +397,13 @@ namespace System.ServiceModel
                        internal ClientRuntimeChannel Inner {
                                get {
                                        if (inner_channel == null)
-                                               inner_channel = new ClientRuntimeChannel (endpoint, factory, null, null);
+                                               inner_channel = new ClientRuntimeChannel (endpoint, factory, endpoint.Address, null);
                                        return inner_channel;
                                }
                        }
 
-#if !NET_2_1
-                       public object Invoke (string methodName, object [] args)
+#if !MOONLIGHT
+                       protected object Invoke (string methodName, object [] args)
                        {
                                var cd = endpoint.Contract;
                                var od = cd.Operations.Find (methodName);