Merge pull request #4540 from kumpera/android-changes-part1
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel.Description / XmlSerializerOperationBehavior.cs
index dd81938dd6924f6810886f5a9aec1984808095c0..6a43f3510e9f1e667ed8fef1600252c7349da942 100644 (file)
@@ -36,7 +36,7 @@ namespace System.ServiceModel.Description
 {
        public class XmlSerializerOperationBehavior
                : IOperationBehavior
-#if !NET_2_1
+#if !MOBILE
                        , IWsdlExportExtension
 #endif
        {
@@ -51,11 +51,13 @@ namespace System.ServiceModel.Description
 
                public XmlSerializerOperationBehavior (
                        OperationDescription operation,
-                       XmlSerializerFormatAttribute format)
+                       XmlSerializerFormatAttribute attribute)
                {
-                       if (format == null)
-                               format = new XmlSerializerFormatAttribute ();
-                       this.format = format;
+                       if (operation == null)
+                               throw new ArgumentNullException ("operation");
+                       if (attribute == null)
+                               attribute = new XmlSerializerFormatAttribute ();
+                       this.format = attribute;
                        this.operation = operation;
                }
 
@@ -73,32 +75,36 @@ namespace System.ServiceModel.Description
                        OperationDescription description,
                        BindingParameterCollection parameters)
                {
-                       throw new NotImplementedException ();
                }
                
-#if !NET_2_1
                void IOperationBehavior.ApplyDispatchBehavior (
                        OperationDescription description,
                        DispatchOperation dispatch)
                {
-                       throw new NotImplementedException ();
+                       if (description == null)
+                               throw new ArgumentNullException ("description");
+                       if (dispatch == null)
+                               throw new ArgumentNullException ("dispatch");
+                       dispatch.Formatter = new XmlMessagesFormatter (description, format);
                }
-#endif
 
                void IOperationBehavior.ApplyClientBehavior (
                        OperationDescription description,
                        ClientOperation proxy)
                {
-                       throw new NotImplementedException ();
+                       if (description == null)
+                               throw new ArgumentNullException ("description");
+                       if (proxy == null)
+                               throw new ArgumentNullException ("proxy");
+                       proxy.Formatter = new XmlMessagesFormatter (description, format);
                }
 
                void IOperationBehavior.Validate (
                        OperationDescription description)
                {
-                       throw new NotImplementedException ();
                }
 
-#if !NET_2_1
+#if !MOBILE && !XAMMAC_4_5
                void IWsdlExportExtension.ExportContract (
                        WsdlExporter exporter,
                        WsdlContractConversionContext context)