Browse Source

* ProtocolReflector.cs: fixed ImportBinding method, ports with the same name declaration when non-default binding used, #345449
* TypeStubManager.cs: fixed TypeStubInfo ctor, default binding name is wrong, when declared in WebServiceBindingAttribute, but not used. fixes #345448

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

Vladimir Krasnov 18 years ago
parent
commit
3a71efc83c

+ 5 - 0
mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog

@@ -1,3 +1,8 @@
+2007-12-11  Vladimir Krasnov <[email protected]>
+
+	* ProtocolReflector.cs: fixed ImportBinding method, ports with the same
+	name declaration when non-default binding used, #345449 
+
 2007-11-01  Gert Driesen  <[email protected]>
 
 	* SoapProtocolImporter.cs: Only output Required argument for

+ 12 - 0
mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolReflector.cs

@@ -278,6 +278,18 @@ namespace System.Web.Services.Description {
 			if (bindingFull)
 			{
 				port.Binding = new XmlQualifiedName (binding.Name, binfo.Namespace);
+				
+				int n = 0;
+				string name = binfo.Name; 
+				bool found;
+				do {
+
+					found = false;
+					foreach (Port p in service.Ports)
+						if (p.Name == name) { found = true; n++; name = binfo.Name + n; break; }
+				}
+				while (found);
+				port.Name = name;
 				service.Ports.Add (port);
 			}
 

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

@@ -1,3 +1,9 @@
+2007-12-11  Vladimir Krasnov  <[email protected]>
+
+	* TypeStubManager.cs: fixed TypeStubInfo ctor, default binding name is
+	wrong, when declared in WebServiceBindingAttribute, but not used.
+	fixes #345448 
+
 2007-11-12  Atsushi Enomoto  <[email protected]>
 
 	* SoapHttpClientProtocol.cs : compare content-type in case-

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

@@ -96,12 +96,18 @@ namespace System.Web.Services.Protocols {
 
 			object [] o = Type.GetCustomAttributes (typeof (WebServiceBindingAttribute), false);
 
+			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)
+				AddBindingAt (0, new BindingInfo (null, defaultBindingName, logicalType.WebServiceNamespace));
 
 #if NET_2_0
 			foreach (Type ifaceType in Type.GetInterfaces ()) {
@@ -228,6 +234,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)
 		{