Browse Source

* TypeStubManager.cs: fixed TypeStubInfo ctor, default binding name is wrong, when declared in WebServiceBindingAttribute, but not used. fixes. bug number: #345448

svn path=/trunk/mcs/; revision=105411
Vladimir Krasnov 17 years ago
parent
commit
7cdc3e104c

+ 6 - 0
mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog

@@ -1,3 +1,9 @@
+2008-06-10  Vladimir Krasnov  <[email protected]>
+
+	* TypeStubManager.cs: fixed TypeStubInfo ctor, default binding name is
+        wrong, when declared in WebServiceBindingAttribute, but not used.
+        fixes. bug number: #345448
+
 2008-02-22  Atsushi Enomoto  <[email protected]>
 
 	* TypeStubManager.cs : reverted 2007-12-11 change as it caused

+ 15 - 3
mcs/class/System.Web.Services/System.Web.Services.Protocols/TypeStubManager.cs

@@ -96,12 +96,19 @@ namespace System.Web.Services.Protocols {
 
 			object [] o = Type.GetCustomAttributes (typeof (WebServiceBindingAttribute), false);
 
+			bool isClientSide = typeof (SoapHttpClientProtocol).IsAssignableFrom (Type);
+			bool defaultAdded = false;
+
 			string defaultBindingName = logicalType.WebServiceName + ProtocolName;
 			if (o.Length > 0)
-				foreach (WebServiceBindingAttribute at in o)
+				foreach (WebServiceBindingAttribute at in o) {
 					AddBinding (new BindingInfo (at, defaultBindingName, LogicalType.WebServiceNamespace));
-			else 
-				AddBinding (new BindingInfo (null, defaultBindingName, logicalType.WebServiceNamespace));
+					if ((at.Name == null || at.Name.Length == 0) || (at.Name == defaultBindingName))
+						defaultAdded = true;
+				}
+
+			if (!defaultAdded && !isClientSide)
+				AddBindingAt (0, new BindingInfo (null, defaultBindingName, logicalType.WebServiceNamespace));
 
 #if NET_2_0
 			foreach (Type ifaceType in Type.GetInterfaces ()) {
@@ -228,6 +235,11 @@ namespace System.Web.Services.Protocols {
 		{
 			bindings.Add (info);
 		}
+
+		internal void AddBindingAt (int pos, BindingInfo info)
+		{
+			bindings.Insert (pos, info);
+		}
 		
 		internal BindingInfo GetBinding (string name)
 		{