Просмотр исходного кода

2007-11-09 Atsushi Enomoto <[email protected]>

	* SoapDocumentationHandler.cs : handle 'schema' HTTP parameter like
	  "...blah.asmx?schema=MySchemaID". (Such URL does not work yet.)


svn path=/trunk/mcs/; revision=89317
Atsushi Eno 18 лет назад
Родитель
Сommit
90c51b84d0

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

@@ -1,3 +1,8 @@
+2007-11-09  Atsushi Enomoto  <[email protected]>
+
+	* SoapDocumentationHandler.cs : handle 'schema' HTTP parameter like
+	  "...blah.asmx?schema=MySchemaID". (Such URL does not work yet.)
+
 2007-10-29  Atsushi Enomoto  <[email protected]>
 
 	* SoapException.cs : serialization constructor didn't call base.

+ 16 - 3
mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentationHandler.cs

@@ -189,9 +189,22 @@ namespace System.Web.Services.Protocols
 		
 		void GenerateSchema (HttpContext context, string schemaId)
 		{
-			int di = 0;
-			if (schemaId != null && schemaId != "") di = int.Parse (schemaId);
-			
+			int di = -1;
+			if (schemaId != null && schemaId != "") {
+				try {
+					di = int.Parse (schemaId);
+				} catch {
+					XmlSchemas xss = GetSchemas ();
+					for (int i = 0; i < xss.Count; i++) {
+						if (xss [i].Id == schemaId) {
+							di = i;
+							break;
+						}
+					}
+				}
+				if (di < 0)
+					throw new InvalidOperationException (String.Format ("HTTP parameter 'schema' needs to specify an Id of a schema in the schemas. {0} points to nowhere.", schemaId));
+			}
 			context.Response.ContentType = "text/xml; charset=utf-8";
 			XmlTextWriter xtw = new XmlTextWriter (context.Response.OutputStream, new UTF8Encoding (false));
 			xtw.Formatting = Formatting.Indented;