Forráskód Böngészése

2008-09-12 Astushi Enomoto <[email protected]>
Jb Evain <[email protected]>

* Makefile: support net_2_1_raw compilation profile.
* net_2_1_raw_System.ServiceModel.dll.sources

* *.cs: SL2 compilation support.


svn path=/trunk/mcs/; revision=112857

Jb Evain 17 éve
szülő
commit
031fa07cc1
30 módosított fájl, 400 hozzáadás és 17 törlés
  1. 8 0
      mcs/class/System.ServiceModel/ChangeLog
  2. 59 0
      mcs/class/System.ServiceModel/Dummy_2_1.cs
  3. 19 10
      mcs/class/System.ServiceModel/Makefile
  4. 4 0
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/Binding.cs
  5. 4 0
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/BindingContext.cs
  6. 4 0
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/BindingElement.cs
  7. 8 2
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs
  8. 6 0
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpTransportBindingElement.cs
  9. 4 0
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpsTransportBindingElement.cs
  10. 8 1
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs
  11. 3 1
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageBufferImpl.cs
  12. 2 0
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageEncodingBindingElement.cs
  13. 4 0
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeader.cs
  14. 6 0
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeaders.cs
  15. 4 0
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs
  16. 2 0
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageProperties.cs
  17. 4 0
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncodingBindingElement.cs
  18. 2 0
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportBindingElement.cs
  19. 2 0
      mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
  20. 2 0
      mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceEndpoint.cs
  21. 6 1
      mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs
  22. 2 0
      mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ClientOperation.cs
  23. 6 0
      mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ClientRuntime.cs
  24. 8 1
      mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding.cs
  25. 8 0
      mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs
  26. 4 0
      mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory_1.cs
  27. 2 0
      mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs
  28. 2 0
      mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs
  29. 8 1
      mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs
  30. 199 0
      mcs/class/System.ServiceModel/net_2_1_raw_System.ServiceModel.dll.sources

+ 8 - 0
mcs/class/System.ServiceModel/ChangeLog

@@ -1,3 +1,11 @@
+2008-09-12  Astushi Enomoto  <[email protected]>
+            Jb Evain  <[email protected]>
+
+	* Makefile: support net_2_1_raw compilation profile.
+	* net_2_1_raw_System.ServiceModel.dll.sources
+
+	* *.cs: SL2 compilation support.
+
 2008-05-22  Roei Erez  <[email protected]>
 	* fix ContractDescription.GetContract implementation
 	* Refactor Request processing

+ 59 - 0
mcs/class/System.ServiceModel/Dummy_2_1.cs

@@ -0,0 +1,59 @@
+using System.Runtime.Serialization;
+
+namespace System.ServiceModel
+{
+	public class EndpointIdentity {}
+	public class InstanceContext
+	{
+		public InstanceContext (object dummy) {}
+	}
+}
+namespace System.ServiceModel.Channels
+{
+	[DataContract]
+	public class EndpointAddress10 {}
+	public interface ITransportTokenAssertionProvider {}
+}
+namespace System.ServiceModel.Configuration
+{
+	class Dummy {}
+}
+namespace System.ServiceModel.Description
+{
+	public interface IPolicyExportExtension {}
+	public interface IPolicyImportExtension {}
+	public interface IWsdlExportExtension {}
+	public interface IWsdlImportExtension {}
+	public interface IEndpointBehavior {}
+	public interface IOperationBehavior {}
+	public interface IContractBehavior {}
+}
+namespace System.ServiceModel.Dispatcher
+{
+	public interface IDispatchMessageFormatter {}
+}
+namespace System.ServiceModel.Security
+{
+	class Dummy {}
+}
+namespace System.Net
+{
+	public enum AuthenticationSchemes {Anonymous}
+}
+namespace System.Net.Security
+{
+	public enum ProtectionLevel {None}
+}
+namespace System.Xml.Serialization
+{
+	public class XmlTypeMapping {}
+}
+namespace System.Xml.XPath
+{
+	class Dummy {}
+}
+namespace Mono.Xml.XPath
+{
+	class Dummy {}
+}
+

+ 19 - 10
mcs/class/System.ServiceModel/Makefile

@@ -8,23 +8,31 @@ RESOURCE_FILES = \
 
 LIBRARY = System.ServiceModel.dll
 LIB_MCS_FLAGS = \
-		/d:NET_3_0	\
 		/nowarn:414,169,67,3005,436,219,618 \
 		/unsafe \
 	        /r:System.dll \
 	        /r:System.Xml.dll \
-	        /r:System.Configuration.dll \
 	        /r:System.Runtime.Serialization.dll \
-	        /r:System.Security.dll \
-	        /r:System.IdentityModel.dll \
-		/r:System.IdentityModel.Selectors.dll \
-	        /r:System.Transactions.dll \
-		/r:System.Messaging.dll \
-	        /r:System.Web.dll \
-		/r:System.Web.Services.dll \
-		/r:Mono.Security.dll \
 		$(RESOURCE_FILES:%=/resource:%)
 
+ifneq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += /d:NET_3_0 	\
+			/r:System.Configuration.dll \
+			/r:System.Data.dll	\
+			/r:System.Security.dll \
+			/r:System.IdentityModel.dll \
+			/r:System.IdentityModel.Selectors.dll \
+			/r:System.Transactions.dll \
+			/r:System.Messaging.dll \
+			/r:System.Web.dll \
+			/r:System.Web.Services.dll \
+			/r:Mono.Security.dll
+endif
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += /r:System.Net
+endif
+
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
 TEST_EXTRA_FILES = \
@@ -47,4 +55,5 @@ NO_TEST = yes
 endif
 
 
+
 include ../../build/library.make

+ 4 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/Binding.cs

@@ -140,6 +140,7 @@ namespace System.ServiceModel.Channels
 			return CreateContext (parameters).BuildInnerChannelFactory<TChannel> ();
 		}
 
+#if !NET_2_1
 		public virtual IChannelListener<TChannel>
 			BuildChannelListener<TChannel> (
 			Uri listenUriBaseAddress,
@@ -253,6 +254,7 @@ namespace System.ServiceModel.Channels
 				throw new ArgumentNullException ("parameters");
 			return CreateContext (parameters).BuildInnerChannelListener<TChannel> ();
 		}
+#endif
 
 		public bool CanBuildChannelFactory<TChannel> (
 			params object [] parameters)
@@ -272,6 +274,7 @@ namespace System.ServiceModel.Channels
 			return CreateContext (parameters).CanBuildInnerChannelFactory<TChannel> ();
 		}
 
+#if !NET_2_1
 		public bool CanBuildChannelListener<TChannel> (
 			params object [] parameters)
 			where TChannel : class, IChannel
@@ -291,6 +294,7 @@ namespace System.ServiceModel.Channels
 				throw new ArgumentNullException ("parameters");
 			return CreateContext (parameters).CanBuildInnerChannelListener<TChannel> ();
 		}
+#endif
 
 		public abstract BindingElementCollection CreateBindingElements ();
 

+ 4 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/BindingContext.cs

@@ -148,6 +148,7 @@ namespace System.ServiceModel.Channels
 			}
 		}
 
+#if !NET_2_1
 		public IChannelListener<TChannel>
 			BuildInnerChannelListener<TChannel> ()
 			where TChannel : class, IChannel
@@ -160,6 +161,7 @@ namespace System.ServiceModel.Channels
 					elements = empty_collection;
 			}
 		}
+#endif
 
 		public bool CanBuildInnerChannelFactory<TChannel> ()
 		{
@@ -173,6 +175,7 @@ namespace System.ServiceModel.Channels
 			}
 		}
 
+#if !NET_2_1
 		public bool CanBuildInnerChannelListener<TChannel> ()
 			where TChannel : class, IChannel
 		{
@@ -185,6 +188,7 @@ namespace System.ServiceModel.Channels
 					elements = empty_collection;
 			}
 		}
+#endif
 
 		public T GetInnerProperty<T> () where T : class
 		{

+ 4 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/BindingElement.cs

@@ -52,6 +52,7 @@ namespace System.ServiceModel.Channels
 			return context.BuildInnerChannelFactory<TChannel> ();
 		}
 
+#if !NET_2_1
 		public virtual IChannelListener<TChannel>
 			BuildChannelListener<TChannel> (
 			BindingContext context)
@@ -61,6 +62,7 @@ namespace System.ServiceModel.Channels
 				throw new ArgumentNullException ("context");
 			return context.BuildInnerChannelListener<TChannel> ();
 		}
+#endif
 
 		public virtual bool CanBuildChannelFactory<TChannel> (
 			BindingContext context)
@@ -68,12 +70,14 @@ namespace System.ServiceModel.Channels
 			return context.CanBuildInnerChannelFactory<TChannel> ();
 		}
 
+#if !NET_2_1
 		public virtual bool CanBuildChannelListener<TChannel> (
 			BindingContext context)
 			where TChannel : class, IChannel
 		{
 			return context.CanBuildInnerChannelListener<TChannel> ();
 		}
+#endif
 
 		public abstract BindingElement Clone ();
 

+ 8 - 2
mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs

@@ -91,7 +91,9 @@ namespace System.ServiceModel.Channels
 			web_request.Method = "POST";
 			web_request.ContentType = Encoder.ContentType;
 
+#if !NET_2_1 // FIXME: implement this to not depend on Timeout property
 			web_request.Timeout = (int) timeout.TotalMilliseconds;
+#endif
 
 			// There is no SOAP Action/To header when AddressingVersion is None.
 			if (message.Version.Addressing == AddressingVersion.None) {
@@ -104,6 +106,7 @@ namespace System.ServiceModel.Channels
 
 			// apply HttpRequestMessageProperty if exists.
 			bool suppressEntityBody = false;
+#if !NET_2_1
 			string pname = HttpRequestMessageProperty.Name;
 			if (message.Properties.ContainsKey (pname)) {
 				HttpRequestMessageProperty hp = (HttpRequestMessageProperty) message.Properties [pname];
@@ -113,6 +116,7 @@ namespace System.ServiceModel.Channels
 				if (hp.SuppressEntityBody)
 					suppressEntityBody = true;
 			}
+#endif
 
 			if (!suppressEntityBody && String.Compare (web_request.Method, "GET", StringComparison.OrdinalIgnoreCase) != 0) {
 				MemoryStream buffer = new MemoryStream ();
@@ -121,15 +125,17 @@ namespace System.ServiceModel.Channels
 				if (buffer.Length > int.MaxValue)
 					throw new InvalidOperationException ("The argument message is too large.");
 
+#if !NET_2_1
 				web_request.ContentLength = (int) buffer.Length;
-				Stream requestStream = web_request.GetRequestStream ();
+#endif
+				Stream requestStream = web_request.EndGetRequestStream (web_request.BeginGetRequestStream (null, null));
 				requestStream.Write (buffer.GetBuffer (), 0, (int) buffer.Length);
 				requestStream.Close ();
 			}
 
 			WebResponse res;
 			try {
-				res = web_request.GetResponse ();
+				res = web_request.EndGetResponse (web_request.BeginGetResponse (null, null));
 			}
 			catch (WebException we) {
 				res = we.Response;

+ 6 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpTransportBindingElement.cs

@@ -147,11 +147,13 @@ namespace System.ServiceModel.Channels
 			return typeof (TChannel) == typeof (IRequestChannel);
 		}
 
+#if !NET_2_1
 		public override bool CanBuildChannelListener<TChannel> (
 			BindingContext context)
 		{
 			return typeof (TChannel) == typeof (IReplyChannel);
 		}
+#endif
 
 		public override IChannelFactory<TChannel> BuildChannelFactory<TChannel> (
 			BindingContext context)
@@ -161,6 +163,7 @@ namespace System.ServiceModel.Channels
 			return new HttpChannelFactory<TChannel> (this, context);
 		}
 
+#if !NET_2_1
 		public override IChannelListener<TChannel> BuildChannelListener<TChannel> (
 			BindingContext context)
 		{
@@ -168,6 +171,7 @@ namespace System.ServiceModel.Channels
 			// element that always causes an error is ignored.
 			return new HttpChannelListener<TChannel> (this, context);
 		}
+#endif
 
 		public override BindingElement Clone ()
 		{
@@ -180,6 +184,7 @@ namespace System.ServiceModel.Channels
 			return base.GetProperty<T> (context);
 		}
 
+#if !NET_2_1
 		[MonoTODO]
 		void IPolicyExportExtension.ExportPolicy (
 			MetadataExporter exporter,
@@ -201,5 +206,6 @@ namespace System.ServiceModel.Channels
 		{
 			throw new NotImplementedException ();
 		}
+#endif
 	}
 }

+ 4 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpsTransportBindingElement.cs

@@ -69,6 +69,7 @@ namespace System.ServiceModel.Channels
 			throw new NotImplementedException ();
 		}
 
+#if !NET_2_1
 		[MonoTODO]
 		public override IChannelListener<TChannel>
 			BuildChannelListener<TChannel> (
@@ -76,16 +77,19 @@ namespace System.ServiceModel.Channels
 		{
 			throw new NotImplementedException ();
 		}
+#endif
 
 		public override BindingElement Clone ()
 		{
 			return new HttpsTransportBindingElement (this);
 		}
 
+#if !NET_2_1
 		[MonoTODO]
 		public XmlElement GetTransportTokenAssertion ()
 		{
 			throw new NotImplementedException ();
 		}
+#endif
 	}
 }

+ 8 - 1
mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs

@@ -138,7 +138,7 @@ namespace System.ServiceModel.Channels
 		void WriteXsiNil (XmlDictionaryWriter writer)
 		{
 			writer.WriteStartElement ("z", "anyType", Constants.MSSerialization);
-			writer.WriteAttributeString ("i", "nil", XmlSchema.InstanceNamespace, "true");
+			writer.WriteAttributeString ("i", "nil", "http://www.w3.org/2001/XMLSchema-instance", "true");
 			writer.WriteEndElement ();
 		}
 
@@ -217,10 +217,17 @@ namespace System.ServiceModel.Channels
 		protected virtual MessageBuffer OnCreateBufferedCopy (
 			int maxBufferSize)
 		{
+#if NET_2_1
+			StringWriter sw = new StringWriter ();
+			XmlDictionaryWriter w = XmlDictionaryWriter.CreateDictionaryWriter (XmlWriter.Create (sw));
+			WriteMessage (w);
+			return new DefaultMessageBuffer (Headers, Properties, new XmlReaderBodyWriter (XmlDictionaryReader.CreateDictionaryReader (XmlReader.Create (new StringReader (sw.ToString ())))), false);
+#else
 			DTMXPathDocumentWriter2 pw = new DTMXPathDocumentWriter2 (new NameTable (), 100);
 			XmlDictionaryWriter w = XmlDictionaryWriter.CreateDictionaryWriter (pw);
 			WriteMessage (w);
 			return new XPathMessageBuffer (pw.CreateDocument (), Version, Headers.Count, this.Properties);
+#endif
 		}
 
 		protected virtual string OnGetBodyAttribute (

+ 3 - 1
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageBufferImpl.cs

@@ -82,6 +82,7 @@ namespace System.ServiceModel.Channels
 		}
 	}
 
+#if !NET_2_1
 	internal class XPathMessageBuffer : MessageBuffer
 	{
 		IXPathNavigable source;
@@ -114,4 +115,5 @@ namespace System.ServiceModel.Channels
 			get { return 0; }
 		}
 	}
-}
+#endif
+}

+ 2 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageEncodingBindingElement.cs

@@ -50,6 +50,7 @@ namespace System.ServiceModel.Channels
 
 		public abstract MessageVersion MessageVersion { get; set; }
 
+#if !NET_2_1
 		[MonoTODO]
 		protected virtual void OnImportPolicy (XmlElement assertion,
 			MessageVersion messageVersion,
@@ -58,5 +59,6 @@ namespace System.ServiceModel.Channels
 		{
 			throw new NotImplementedException ();
 		}
+#endif
 	}
 }

+ 4 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeader.cs

@@ -54,10 +54,12 @@ namespace System.ServiceModel.Channels
 		static bool default_relay = false;
 		static Type [] knownTypes = new Type [1] {typeof (EndpointAddress10)};
 
+#if !NET_2_1 // FIXME: eliminate XmlElement
 		internal static MessageHeader CreateInternalHeader (XmlElement el, string soap_ns)
 		{
 			return new RawMessageHeader (el, soap_ns);
 		}
+#endif
 
 		public static MessageHeader CreateHeader (string name, string ns, object value)
 		{
@@ -203,6 +205,7 @@ namespace System.ServiceModel.Channels
 
 		public override bool Relay { get { return default_relay; }}
 
+#if !NET_2_1 // FIXME: this should be rewritten to eliminate XmlElement
 		internal class RawMessageHeader : MessageHeader
 		{
 			XmlElement source;
@@ -249,6 +252,7 @@ namespace System.ServiceModel.Channels
 
 			public override bool Relay { get { return relay; }}
 		}
+#endif
 
 		internal class DefaultMessageHeader : MessageHeader
 		{

+ 6 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeaders.cs

@@ -207,8 +207,10 @@ namespace System.ServiceModel.Channels
 			MessageHeader item = (MessageHeader) l [index];
 
 			XmlReader reader =
+#if !NET_2_1 // FIXME: implement RawMessageHeader
 				item is MessageHeader.RawMessageHeader ?
 				((MessageHeader.RawMessageHeader) item).CreateReader () :
+#endif
 				XmlReader.Create (
 					new StringReader (item.ToString ()),
 					reader_settings);
@@ -318,6 +320,7 @@ namespace System.ServiceModel.Channels
 			get { return l.Count; }
 		}
 
+#if !NET_2_1
 		public EndpointAddress FaultTo {
 			get {
 				int idx = FindHeader ("FaultTo", Constants.WSA1);
@@ -351,6 +354,7 @@ namespace System.ServiceModel.Channels
 						EndpointAddress10.FromEndpointAddress (value)));
 			}
 		}
+#endif
 
 		public MessageHeaderInfo this [int index] {
 			get { return l [index]; }
@@ -393,6 +397,7 @@ namespace System.ServiceModel.Channels
 
 		}
 
+#if !NET_2_1
 		public EndpointAddress ReplyTo {
 			get {
 				int idx = FindHeader ("ReplyTo", Constants.WSA1);
@@ -409,6 +414,7 @@ namespace System.ServiceModel.Channels
 						EndpointAddress10.FromEndpointAddress (value)));
 			}
 		}
+#endif
 
 		public Uri To {
 			get {

+ 4 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs

@@ -150,6 +150,9 @@ namespace System.ServiceModel.Channels
 			if (isEmptyHeader)
 				return;
 
+#if NET_2_1 // FIXME: implement CreateInternalHeader() without XmlElement
+			throw new NotImplementedException ();
+#else
 			XmlDocument doc = null;
 			while (!reader.EOF && reader.NodeType != XmlNodeType.EndElement) {
 				if (doc == null)
@@ -160,6 +163,7 @@ namespace System.ServiceModel.Channels
 				// FIXME: handle UnderstoodHeaders as well.
 				reader.MoveToContent ();
 			}
+#endif
 			reader.ReadEndElement ();
 			reader.MoveToContent ();
 		}

+ 2 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageProperties.cs

@@ -100,10 +100,12 @@ namespace System.ServiceModel.Channels
 			}
 		}
 
+#if !NET_2_1
 		public SecurityMessageProperty Security {
 			get { return (SecurityMessageProperty) this ["Security"]; }
 			set { this ["Security"] = value; }
 		}
+#endif
 
 		public ICollection<object> Values {
 			get { return new ParameterValueCollection (list); }

+ 4 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncodingBindingElement.cs

@@ -104,6 +104,7 @@ namespace System.ServiceModel.Channels
 			return base.BuildChannelFactory<TChannel> (context);
 		}
 
+#if !NET_2_1
 		public override IChannelListener<TChannel> BuildChannelListener<TChannel> (
 			BindingContext context)
 		{
@@ -120,6 +121,7 @@ namespace System.ServiceModel.Channels
 				throw new ArgumentNullException ("context");
 			return context.CanBuildInnerChannelListener<TChannel> ();
 		}
+#endif
 
 		public override BindingElement Clone ()
 		{
@@ -138,6 +140,7 @@ namespace System.ServiceModel.Channels
 			return new TextMessageEncoderFactory (this);
 		}
 
+#if !NET_2_1
 		[MonoTODO]
 		protected override void OnImportPolicy (XmlElement assertion,
 			MessageVersion messageVersion,
@@ -167,5 +170,6 @@ namespace System.ServiceModel.Channels
 		{
 			throw new NotImplementedException ();
 		}
+#endif
 	}
 }

+ 2 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportBindingElement.cs

@@ -82,10 +82,12 @@ namespace System.ServiceModel.Channels
 				q.MaxStringContentLength = (int) MaxReceivedMessageSize;
 				return (T) (object) q;
 			}
+#if !NET_2_1
 			if (typeof (T) == typeof (ChannelProtectionRequirements))
 				// blank one, basically it should not be used
 				// for any secure channels (
 				return (T) (object) new ChannelProtectionRequirements ();
+#endif
 			if (typeof (T) == typeof (MessageVersion))
 				return (T) (object) MessageVersion.Default;
 			return null;

+ 2 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs

@@ -217,8 +217,10 @@ namespace System.ServiceModel.Description
 				foreach (object obj in serviceMethod.GetCustomAttributes (typeof(IOperationBehavior),true))
 					od.Behaviors.Add ((IOperationBehavior) obj);
 			}
+#if !NET_2_1
 			if (od.Behaviors.Find<OperationBehaviorAttribute>() == null)
 				od.Behaviors.Add (new OperationBehaviorAttribute ());
+#endif
 			// FIXME: fill KnownTypes, Behaviors and Faults.
 
 			return od;

+ 2 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceEndpoint.cs

@@ -97,6 +97,7 @@ namespace System.ServiceModel.Description
 		}
 
 		internal void Validate () {
+#if !NET_2_1
 			foreach (IContractBehavior b in Contract.Behaviors)
 				b.Validate (Contract, this);
 			foreach (IEndpointBehavior b in Behaviors)
@@ -105,6 +106,7 @@ namespace System.ServiceModel.Description
 				foreach (IOperationBehavior b in operation.Behaviors)
 					b.Validate (operation);
 			}
+#endif
 		}
 	}
 }

+ 6 - 1
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs

@@ -74,9 +74,12 @@ namespace System.ServiceModel.Dispatcher
 		public static BaseMessagesFormatter Create (OperationDescription desc)
 		{
 			MethodInfo attrProvider = desc.SyncMethod ?? desc.BeginMethod;
-			object [] attrs = attrProvider.GetCustomAttributes (typeof (XmlSerializerFormatAttribute), false);
+			object [] attrs;
+#if !NET_2_1
+			attrs = attrProvider.GetCustomAttributes (typeof (XmlSerializerFormatAttribute), false);
 			if (attrs != null && attrs.Length > 0)
 				return new XmlMessagesFormatter (desc, (XmlSerializerFormatAttribute) attrs [0]);
+#endif
 
 			attrs = attrProvider.GetCustomAttributes (typeof (DataContractFormatAttribute), false);
 			DataContractFormatAttribute dataAttr = null;
@@ -213,6 +216,7 @@ namespace System.ServiceModel.Dispatcher
 		}
 	}
 
+#if !NET_2_1
 	class XmlMessagesFormatter : BaseMessagesFormatter
 	{
 		XmlSerializerFormatAttribute attr;
@@ -303,6 +307,7 @@ namespace System.ServiceModel.Dispatcher
 			}
 		}
 	}
+#endif
 
 	class DataContractMessagesFormatter : BaseMessagesFormatter
 	{

+ 2 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ClientOperation.cs

@@ -96,9 +96,11 @@ namespace System.ServiceModel.Dispatcher
 			set { end_method = value; }
 		}
 
+#if !NET_2_1
 		public SynchronizedCollection<FaultContractInfo> FaultContractInfos {
 			get { throw new NotImplementedException (); }
 		}
+#endif
 
 		public IClientMessageFormatter Formatter {
 			get { return formatter; }

+ 6 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ClientRuntime.cs

@@ -40,7 +40,9 @@ namespace System.ServiceModel.Dispatcher
 			= new SynchronizedCollection<IChannelInitializer> ();
 		SynchronizedCollection<IInteractiveChannelInitializer> interactive_channel_initializers
 			= new SynchronizedCollection<IInteractiveChannelInitializer> ();
+#if !NET_2_1
 		DispatchRuntime dispatch;
+#endif
 		SynchronizedCollection<IClientMessageInspector> inspectors
 			= new SynchronizedCollection<IClientMessageInspector> ();
 		ClientOperation.ClientOperationCollection operations
@@ -51,6 +53,7 @@ namespace System.ServiceModel.Dispatcher
 		string contract_name, contract_ns;
 		int max_fault_size = 0x10000; // FIXME: not verified.
 
+#if !NET_2_1
 		// .ctor() for DispatchRuntime.CallbackClientRuntime
 		internal ClientRuntime (DispatchRuntime parent)
 		{
@@ -59,6 +62,7 @@ namespace System.ServiceModel.Dispatcher
 			contract_name = dispatch.EndpointDispatcher.ContractName;
 			contract_ns = dispatch.EndpointDispatcher.ContractNamespace;
 		}
+#endif
 
 		// .ctor() for Clients
 		internal ClientRuntime (ServiceEndpoint endpoint)
@@ -94,9 +98,11 @@ namespace System.ServiceModel.Dispatcher
 			set { contract = value; }
 		}
 
+#if !NET_2_1
 		public DispatchRuntime CallbackDispatchRuntime {
 			get { return dispatch; }
 		}
+#endif
 
 		public SynchronizedCollection<IClientMessageInspector> MessageInspectors {
 			get { return inspectors; }

+ 8 - 1
mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding.cs

@@ -62,6 +62,7 @@ namespace System.ServiceModel
 		{
 		}
 
+#if !NET_2_1
 		public BasicHttpBinding (string configurationName)
 			: this ()
 		{
@@ -71,6 +72,7 @@ namespace System.ServiceModel
 
 			el.ApplyConfiguration (this);
 		}
+#endif
 
 		public BasicHttpBinding (
 			BasicHttpSecurityMode securityMode)
@@ -174,6 +176,7 @@ namespace System.ServiceModel
 			CreateBindingElements ()
 		{
 			switch (Security.Mode) {
+#if !NET_2_1
 			case BasicHttpSecurityMode.Message:
 			case BasicHttpSecurityMode.TransportWithMessageCredential:
 				if (Security.Message.ClientCredentialType != BasicHttpMessageCredentialType.Certificate)
@@ -183,7 +186,7 @@ namespace System.ServiceModel
 					new AsymmetricSecurityBindingElement (),
 					BuildMessageEncodingBindingElement (),
 					GetTransport ()});
-
+#endif
 			default:
 				return new BindingElementCollection (new BindingElement [] {
 					BuildMessageEncodingBindingElement (),
@@ -201,8 +204,12 @@ namespace System.ServiceModel
 				return tm;
 			}
 			else
+#if NET_2_1
+				throw new SystemException ("INTERNAL ERROR: should not happen");
+#else
 				return new MtomMessageEncodingBindingElement (
 					MessageVersion.CreateVersion (EnvelopeVersion, AddressingVersion.None), TextEncoding);
+#endif
 		}
 
 		TransportBindingElement GetTransport ()

+ 8 - 0
mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs

@@ -51,9 +51,11 @@ namespace System.ServiceModel
 			get { return service_endpoint; }
 		}
 
+#if !NET_2_1
 		public ClientCredentials Credentials {
 			get { return Endpoint.Behaviors.Find<ClientCredentials> (); }
 		}
+#endif
 
 		protected internal override TimeSpan DefaultCloseTimeout {
 			get { return Endpoint.Binding.CloseTimeout; }
@@ -65,6 +67,7 @@ namespace System.ServiceModel
 
 		protected virtual void ApplyConfiguration (string endpointConfig)
 		{
+#if !NET_2_1
 			if (endpointConfig == null)
 				return;
 
@@ -89,8 +92,10 @@ namespace System.ServiceModel
 
 			if (res.BehaviorConfiguration != "")
 				ApplyBehavior (res.BehaviorConfiguration);
+#endif
 		}
 
+#if !NET_2_1
 		private void ApplyBehavior (string behaviorConfig)
 		{
 			BehaviorsSection behaviorsSection = (BehaviorsSection) ConfigurationManager.GetSection ("system.serviceModel/behaviors");
@@ -102,6 +107,7 @@ namespace System.ServiceModel
 				Endpoint.Behaviors.Add (behavior);
 			}
 		}
+#endif
 
 		[MonoTODO]
 		protected virtual IChannelFactory CreateFactory ()
@@ -203,10 +209,12 @@ namespace System.ServiceModel
 		}
 	}
 
+#if obsolete
 	[ServiceContract]
 	interface UninitializedContract
 	{
 		[OperationContract]
 		void ItShouldReallyGone ();
 	}
+#endif
 }

+ 4 - 0
mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory_1.cs

@@ -138,7 +138,9 @@ namespace System.ServiceModel
 		{
 			ContractDescription cd = ContractDescription.GetContract (typeof (TChannel));
 			ServiceEndpoint ep = new ServiceEndpoint (cd);
+#if !NET_2_1
 			ep.Behaviors.Add (new ClientCredentials ());
+#endif
 			return ep;
 		}
 
@@ -151,6 +153,7 @@ namespace System.ServiceModel
 				if (!proxy.Operations.Contains (od.Name))
 					PopulateClientOperation (proxy, od);
 
+#if !NET_2_1
 			foreach (IEndpointBehavior b in se.Behaviors)
 				b.ApplyClientBehavior (se, proxy);
 
@@ -159,6 +162,7 @@ namespace System.ServiceModel
 			foreach (OperationDescription od in se.Contract.Operations)
 				foreach (IOperationBehavior ob in od.Behaviors)
 					ob.ApplyClientBehavior (od, proxy.Operations [od.Name]);
+#endif
 
 			return proxy;
 		}

+ 2 - 0
mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs

@@ -138,9 +138,11 @@ namespace System.ServiceModel
 			get { return factory; }
 		}
 
+#if !NET_2_1
 		public ClientCredentials ClientCredentials {
 			get { return ChannelFactory.Credentials; }
 		}
+#endif
 
 		public ServiceEndpoint Endpoint {
 			get { return factory.Endpoint; }

+ 2 - 0
mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs

@@ -249,10 +249,12 @@ namespace System.ServiceModel
 				new BindingParameterCollection ();
 
 			ContractDescription cd = factory.Endpoint.Contract;
+#if !NET_2_1
 			pl.Add (ChannelProtectionRequirements.CreateFromContract (cd));
 
 			foreach (IEndpointBehavior behavior in factory.Endpoint.Behaviors)
 				behavior.AddBindingParameters (factory.Endpoint, pl);
+#endif
 
 			return pl;
 		}

+ 8 - 1
mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs

@@ -32,7 +32,6 @@ using System.Reflection;
 using System.Resources;
 using System.Runtime.Serialization;
 using System.Security.Cryptography.X509Certificates;
-using System.Security.Cryptography.Xml;
 using System.Xml;
 using System.Xml.Schema;
 using System.Xml.Serialization;
@@ -114,6 +113,7 @@ namespace System.ServiceModel
 			get { return address; }
 		}
 
+#if !NET_2_1
 		internal static XmlSchema Schema {
 			get {
 				if (schema == null) {
@@ -125,6 +125,7 @@ namespace System.ServiceModel
 				return schema;
 			}
 		}
+#endif
 
 		[MonoTODO]
 		public void ApplyTo (Message message)
@@ -183,6 +184,7 @@ namespace System.ServiceModel
 			return ! (address1 == address2);
 		}
 
+#if !NET_2_1
 		[MonoTODO]
 		public static EndpointAddress ReadFrom (
 			XmlDictionaryReader reader)
@@ -313,6 +315,7 @@ namespace System.ServiceModel
 			return new EndpointAddress (uri, identity,
 				AddressHeader.CreateAddressHeader (metadata));
 		}
+#endif
 
 		public override string ToString ()
 		{
@@ -324,11 +327,15 @@ namespace System.ServiceModel
 			AddressingVersion addressingVersion,
 			XmlDictionaryWriter writer)
 		{
+#if NET_2_1
+			writer.WriteString (Uri.AbsoluteUri);
+#else
 			if (addressingVersion == AddressingVersion.WSAddressing10) {
 				((IXmlSerializable) EndpointAddress10.FromEndpointAddress (this)).WriteXml (writer);
 			} else {
 				writer.WriteString (Uri.AbsoluteUri);
 			}
+#endif
 		}
 
 		public void WriteContentsTo (

+ 199 - 0
mcs/class/System.ServiceModel/net_2_1_raw_System.ServiceModel.dll.sources

@@ -0,0 +1,199 @@
+../../build/common/Consts.cs
+../../build/common/Locale.cs
+../../build/common/MonoTODOAttribute.cs
+Assembly/AssemblyInfo.cs
+Mono.CodeGeneration/CodeAdd.cs
+Mono.CodeGeneration/CodeAnd.cs
+Mono.CodeGeneration/CodeArgument.cs
+Mono.CodeGeneration/CodeArgumentReference.cs
+Mono.CodeGeneration/CodeArithmeticOperation.cs
+Mono.CodeGeneration/CodeArrayItem.cs
+Mono.CodeGeneration/CodeArrayLength.cs
+Mono.CodeGeneration/CodeAssignment.cs
+Mono.CodeGeneration/CodeBinaryComparison.cs
+Mono.CodeGeneration/CodeBinaryOperation.cs
+Mono.CodeGeneration/CodeBlock.cs
+Mono.CodeGeneration/CodeBuilder.cs
+Mono.CodeGeneration/CodeCast.cs
+Mono.CodeGeneration/CodeClass.cs
+Mono.CodeGeneration/CodeCustomAttribute.cs
+Mono.CodeGeneration/CodeDecrement.cs
+Mono.CodeGeneration/CodeEquals.cs
+Mono.CodeGeneration/CodeExpression.cs
+Mono.CodeGeneration/CodeFieldReference.cs
+Mono.CodeGeneration/CodeFor.cs
+Mono.CodeGeneration/CodeForeach.cs
+Mono.CodeGeneration/CodeGenerationHelper.cs
+Mono.CodeGeneration/CodeIf.cs
+Mono.CodeGeneration/CodeIncrement.cs
+Mono.CodeGeneration/CodeIs.cs
+Mono.CodeGeneration/CodeItem.cs
+Mono.CodeGeneration/CodeLiteral.cs
+Mono.CodeGeneration/CodeMethod.cs
+Mono.CodeGeneration/CodeMethodCall.cs
+Mono.CodeGeneration/CodeModule.cs
+Mono.CodeGeneration/CodeNew.cs
+Mono.CodeGeneration/CodeNewArray.cs
+Mono.CodeGeneration/CodeNotEquals.cs
+Mono.CodeGeneration/CodeOr.cs
+Mono.CodeGeneration/CodeProperty.cs
+Mono.CodeGeneration/CodePropertyReference.cs
+Mono.CodeGeneration/CodeReturn.cs
+Mono.CodeGeneration/CodeSelect.cs
+Mono.CodeGeneration/CodeSelfIncrement.cs
+Mono.CodeGeneration/CodeUnaryOperation.cs
+Mono.CodeGeneration/CodeValueReference.cs
+Mono.CodeGeneration/CodeVariableDeclaration.cs
+Mono.CodeGeneration/CodeVariableReference.cs
+Mono.CodeGeneration/CodeWhen.cs
+Mono.CodeGeneration/CodeWhile.cs
+Mono.CodeGeneration/CodeWriter.cs
+Mono.CodeGeneration/Exp.cs
+System.Collections.Generic/KeyedByTypeCollection.cs
+System.Collections.Generic/SynchronizedCollection.cs
+System.Collections.Generic/SynchronizedKeyedCollection.cs
+System.Collections.Generic/SynchronizedReadOnlyCollection.cs
+System.ServiceModel.Channels/AddressHeader.cs
+System.ServiceModel.Channels/AddressHeaderCollection.cs
+System.ServiceModel.Channels/AddressingVersion.cs
+System.ServiceModel.Channels/Binding.cs
+System.ServiceModel.Channels/BindingContext.cs
+System.ServiceModel.Channels/BindingElement.cs
+System.ServiceModel.Channels/BindingElementCollection.cs
+System.ServiceModel.Channels/BindingParameterCollection.cs
+System.ServiceModel.Channels/BodyWriter.cs
+System.ServiceModel.Channels/BufferManager.cs
+System.ServiceModel.Channels/ChannelBase.cs
+System.ServiceModel.Channels/ChannelFactoryBase.cs
+System.ServiceModel.Channels/ChannelManagerBase.cs
+System.ServiceModel.Channels/ChannelParameterCollection.cs
+System.ServiceModel.Channels/ChannelPoolSettings.cs
+System.ServiceModel.Channels/CommunicationObject.cs
+System.ServiceModel.Channels/CustomBinding.cs
+System.ServiceModel.Channels/HtmlizedException.cs
+System.ServiceModel.Channels/HttpChannelFactory.cs
+System.ServiceModel.Channels/HttpRequestChannel.cs
+System.ServiceModel.Channels/HttpTransportBindingElement.cs
+System.ServiceModel.Channels/HttpsTransportBindingElement.cs
+System.ServiceModel.Channels/IBindingRuntimePreferences.cs
+System.ServiceModel.Channels/IChannel.cs
+System.ServiceModel.Channels/IChannelFactory.cs
+System.ServiceModel.Channels/IDuplexChannel.cs
+System.ServiceModel.Channels/IDuplexSession.cs
+System.ServiceModel.Channels/IDuplexSessionChannel.cs
+System.ServiceModel.Channels/IInputChannel.cs
+System.ServiceModel.Channels/IInputSession.cs
+System.ServiceModel.Channels/IInputSessionChannel.cs
+System.ServiceModel.Channels/IMessageProperty.cs
+System.ServiceModel.Channels/IOutputChannel.cs
+System.ServiceModel.Channels/IOutputSession.cs
+System.ServiceModel.Channels/IOutputSessionChannel.cs
+System.ServiceModel.Channels/IRequestChannel.cs
+System.ServiceModel.Channels/IRequestSessionChannel.cs
+System.ServiceModel.Channels/ISecurityCapabilities.cs
+System.ServiceModel.Channels/ISession.cs
+System.ServiceModel.Channels/ISessionChannel.cs
+System.ServiceModel.Channels/LayeredCommunicationObject.cs
+System.ServiceModel.Channels/LayeredOutputChannel.cs
+System.ServiceModel.Channels/LayeredRequestChannel.cs
+System.ServiceModel.Channels/Message.cs
+System.ServiceModel.Channels/MessageBuffer_2_1.cs
+System.ServiceModel.Channels/MessageBufferImpl.cs
+System.ServiceModel.Channels/MessageEncoder.cs
+System.ServiceModel.Channels/MessageEncoderFactory.cs
+System.ServiceModel.Channels/MessageEncodingBindingElement.cs
+System.ServiceModel.Channels/MessageFault.cs
+System.ServiceModel.Channels/MessageFaultBodyWriter.cs
+System.ServiceModel.Channels/MessageHeader.cs
+System.ServiceModel.Channels/MessageHeaderInfo.cs
+System.ServiceModel.Channels/MessageHeaders.cs
+System.ServiceModel.Channels/MessageImpl.cs
+System.ServiceModel.Channels/MessageProperties.cs
+System.ServiceModel.Channels/MessageVersion.cs
+System.ServiceModel.Channels/OutputChannelBase.cs
+System.ServiceModel.Channels/RequestChannelBase.cs
+System.ServiceModel.Channels/RequestContext.cs
+System.ServiceModel.Channels/TextMessageEncoder.cs
+System.ServiceModel.Channels/TextMessageEncoderFactory.cs
+System.ServiceModel.Channels/TextMessageEncodingBindingElement.cs
+System.ServiceModel.Channels/TransportBindingElement.cs
+System.ServiceModel.Channels/UnderstoodHeaders.cs
+System.ServiceModel.Channels/XmlObjectSerializerBodyWriter.cs
+System.ServiceModel.Channels/XmlReaderBodyWriter.cs
+System.ServiceModel.Description/ContractDescription.cs
+System.ServiceModel.Description/ContractDescriptionGenerator.cs
+System.ServiceModel.Description/FaultDescription.cs
+System.ServiceModel.Description/FaultDescriptionCollection.cs
+System.ServiceModel.Description/MessageBodyDescription.cs
+System.ServiceModel.Description/MessageDescription.cs
+System.ServiceModel.Description/MessageDescriptionCollection.cs
+System.ServiceModel.Description/MessageHeaderDescription.cs
+System.ServiceModel.Description/MessageHeaderDescriptionCollection.cs
+System.ServiceModel.Description/MessagePartDescription.cs
+System.ServiceModel.Description/MessagePartDescriptionCollection.cs
+System.ServiceModel.Description/MessagePropertyDescription.cs
+System.ServiceModel.Description/MessagePropertyDescriptionCollection.cs
+System.ServiceModel.Description/OperationDescription.cs
+System.ServiceModel.Description/OperationDescriptionCollection.cs
+System.ServiceModel.Description/ServiceEndpoint.cs
+System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs
+System.ServiceModel.Dispatcher/ClientOperation.cs
+System.ServiceModel.Dispatcher/ClientRuntime.cs
+System.ServiceModel.Dispatcher/IChannelInitializer.cs
+System.ServiceModel.Dispatcher/IClientMessageFormatter.cs
+System.ServiceModel.Dispatcher/IClientMessageInspector.cs
+System.ServiceModel.Dispatcher/IClientOperationSelector.cs
+System.ServiceModel.Dispatcher/IInteractiveChannelInitializer.cs
+System.ServiceModel.Dispatcher/IParameterInspector.cs
+System.ServiceModel/ActionNotSupportedException.cs
+System.ServiceModel/AllEnums.cs
+System.ServiceModel/BasicHttpBinding.cs
+System.ServiceModel/BasicHttpSecurity_2_1.cs
+System.ServiceModel/ChannelFactory.cs
+System.ServiceModel/ChannelFactory_1.cs
+System.ServiceModel/ClientBase.cs
+System.ServiceModel/ClientProxyGenerator.cs
+System.ServiceModel/ClientRuntimeChannel.cs
+System.ServiceModel/CommunicationException.cs
+System.ServiceModel/CommunicationObjectFaultedException.cs
+System.ServiceModel/Constants.cs
+System.ServiceModel/DataContractFormatAttribute.cs
+System.ServiceModel/DefaultCommunicationTimeouts.cs
+System.ServiceModel/Dummy.cs
+System.ServiceModel/EndpointAddress.cs
+System.ServiceModel/EndpointNotFoundException.cs
+System.ServiceModel/EnvelopeVersion.cs
+System.ServiceModel/ExceptionDetail.cs
+System.ServiceModel/ExtensionCollection.cs
+System.ServiceModel/FaultCode.cs
+System.ServiceModel/FaultContractAttribute.cs
+System.ServiceModel/FaultException.cs
+System.ServiceModel/FaultException_1.cs
+System.ServiceModel/FaultReason.cs
+System.ServiceModel/FaultReasonText.cs
+System.ServiceModel/IClientChannel.cs
+System.ServiceModel/ICommunicationObject.cs
+System.ServiceModel/IContextChannel.cs
+System.ServiceModel/IDefaultCommunicationTimeouts.cs
+System.ServiceModel/IExtensibleObject.cs
+System.ServiceModel/IExtension.cs
+System.ServiceModel/IExtensionCollection.cs
+System.ServiceModel/InvalidMessageContractException.cs
+System.ServiceModel/MessageBodyAttribute.cs
+System.ServiceModel/MessageContractAttribute.cs
+System.ServiceModel/MessageContractMemberAttribute.cs
+System.ServiceModel/MessageHeaderArrayAttribute.cs
+System.ServiceModel/MessageHeaderAttribute.cs
+System.ServiceModel/MessageHeaderException.cs
+System.ServiceModel/MessageHeader_1.cs
+System.ServiceModel/MessageParameterAttribute.cs
+System.ServiceModel/MessagePropertyAttribute.cs
+System.ServiceModel/OperationContractAttribute.cs
+System.ServiceModel/ProtocolException.cs
+System.ServiceModel/QuotaExceededException.cs
+System.ServiceModel/ServiceContractAttribute.cs
+System.ServiceModel/TransferMode.cs
+System.ServiceModel/UnknownMessageReceivedEventArgs.cs
+System.ServiceModel/UriSchemeKeyedCollection.cs
+System.ServiceModel/XmlSerializerFormatAttribute.cs
+Dummy_2_1.cs