Bugzilla – Bug 540001
WSDL generation fails in ServiceDebugBehavior
Last modified: 2010-05-20 04:50:53 UTC
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729) Here's the Exception + Stack Trace: Unhandled Exception: System.Xml.Schema.XmlSchemaException: XmlSchema error: name must be a NCName Related schema item SourceUri: , Line 0, Position 0. at System.Xml.Schema.ValidationHandler.RaiseValidationEvent (System.Xml.Schema.ValidationEventHandler handle, System.Exception innerException, System.String message, System.Xml.Schema.XmlSchemaObject xsobj, System.Object sender, System.String sourceUri, XmlSeverityType severity) [0x00000] at System.Xml.Schema.XmlSchemaObject.error (System.Xml.Schema.ValidationEventHandler handle, System.String message, System.Exception innerException, System.Xml.Schema.XmlSchemaObject xsobj, System.Object sender) [0x00000] at System.Xml.Schema.XmlSchemaObject.error (System.Xml.Schema.ValidationEventHandler handle, System.String message) [0x00000] at System.Xml.Schema.XmlSchemaComplexType.Compile (System.Xml.Schema.ValidationEventHandler h, System.Xml.Schema.XmlSchema schema) [0x00000] at System.Xml.Schema.XmlSchema.DoCompile (System.Xml.Schema.ValidationEventHandler handler, System.Collections.Hashtable handledUris, System.Xml.Schema.XmlSchemaSet col, System.Xml.XmlResolver resolver) [0x00000] at System.Xml.Schema.XmlSchema.CompileSubset (System.Xml.Schema.ValidationEventHandler handler, System.Xml.Schema.XmlSchemaSet col, System.Xml.XmlResolver resolver, System.Collections.Hashtable handledUris) [0x00000] at System.Xml.Schema.XmlSchema.CompileSubset (System.Xml.Schema.ValidationEventHandler handler, System.Xml.Schema.XmlSchemaSet col, System.Xml.XmlResolver resolver) [0x00000] at System.Xml.Schema.XmlSchemaSet.Reprocess (System.Xml.Schema.XmlSchema schema) [0x00000] at System.Runtime.Serialization.CollectionTypeMap.GetSchemaType (System.Xml.Schema.XmlSchemaSet schemas, System.Collections.Generic.Dictionary`2 generated_schema_types) [0x00000] at System.Runtime.Serialization.XsdDataContractExporter.Export (System.Type type) [0x00000] at System.ServiceModel.Description.WsdlExporter.GetSchemaElementForPart (System.ServiceModel.Description.MessagePartDescription part, System.Xml.Schema.XmlSchema schema) [0x00000] at System.ServiceModel.Description.WsdlExporter.ExportParameters (System.ServiceModel.Description.MessageBodyDescription msgbody, System.String name, System.String ns) [0x00000] at System.ServiceModel.Description.WsdlExporter.ExportMessageBodyDescription (System.ServiceModel.Description.MessageBodyDescription msgbody, System.String name, System.String ns) [0x00000] at System.ServiceModel.Description.WsdlExporter.ExportContractInternal (System.ServiceModel.Description.ContractDescription contract) [0x00000] at System.ServiceModel.Description.WsdlExporter.ExportEndpoint (System.ServiceModel.Description.ServiceEndpoint endpoint) [0x00000] at System.ServiceModel.Description.ServiceMetadataExtension.get_Metadata () [0x00000] at System.ServiceModel.Description.HttpGetWsdl.GetMetadata (System.ServiceModel.ServiceHostBase host) [0x00000] at System.ServiceModel.Description.HttpGetWsdl..ctor (System.ServiceModel.Description.ServiceMetadataExtension metadata_extn, System.Uri base_uri) [0x00000] at System.ServiceModel.Description.ServiceMetadataExtension.EnsureServiceMetadataDispatcher (System.ServiceModel.Description.ServiceDescription description, System.ServiceModel.ServiceHostBase serviceHostBase, System.ServiceModel.Description.ServiceMetadataExtension sme, System.Uri uri, System.ServiceModel.Channels.Binding binding) [0x00000] at System.ServiceModel.Description.ServiceMetadataExtension.EnsureServiceMetadataHttpChanelDispatcher (System.ServiceModel.Description.ServiceDescription description, System.ServiceModel.ServiceHostBase serviceHostBase, System.ServiceModel.Description.ServiceMetadataExtension sme, System.Uri uri, System.ServiceModel.Channels.Binding binding) [0x00000] at System.ServiceModel.Description.ServiceDebugBehavior.System.ServiceModel.Description.IServiceBehavior.ApplyDispatchBehavior (System.ServiceModel.Description.ServiceDescription description, System.ServiceModel.ServiceHostBase serviceHostBase) [0x00000] at System.ServiceModel.ServiceHostBase.InitializeRuntime () [0x00000] at System.ServiceModel.ServiceHostBase.OnOpen (TimeSpan timeout) [0x00000] at System.ServiceModel.Channels.CommunicationObject.Open (TimeSpan timeout) [0x00000] at System.ServiceModel.Channels.CommunicationObject.Open () [0x00000] at QueryService.Program.Main (System.String[] args) [0x00000] This is generated by ServiceDebugBehavior.*HelpEnabled being set to true by default: The contract looks like this: using System; using System.Collections.Generic; using System.Runtime.Serialization; using System.ServiceModel; namespace QueryService { public static class Constants { public const string QUERY_SERVICE_NS = "http://www.xyz.com/2009/05/QueryService"; } [ServiceContract(Namespace = Constants.QUERY_SERVICE_NS)] interface ICatalogQuery { [OperationContract] BookMetadataList GetBooks(string bookName, string startDate, string endDate, int subIdStart, int subIdEnd, string field); [OperationContract] PublisherMetadataList GetPublishers(); [OperationContract] BookClassMetadataList GetBookClasses(); [OperationContract] int GetOffsetFromUtc(string publisherCode, string date); [OperationContract] List<string> GetBooks(string publisherCode, string bookClassCode); [OperationContract] AdditionalMetadata GetAdditionalMetadata(string bookCode); } [DataContract(Namespace = Constants.QUERY_SERVICE_NS)] public class BookClassMetadata { [DataMember] public string Code; [DataMember] public string Name; } [CollectionDataContract(Name = "{0}List", ItemName = "BookClassMetadata", Namespace = Constants.QUERY_SERVICE_NS)] public class BookClassMetadataList : List<BookClassMetadata> { } [DataContract(Namespace = Constants.QUERY_SERVICE_NS)] public class PublisherMetadata { [DataMember] public string Code; [DataMember] public string Name; [DataMember] public string TimeZone; } [CollectionDataContract(Name = "{0}List", ItemName = "PublisherMetadata", Namespace = Constants.QUERY_SERVICE_NS)] public class PublisherMetadataList : List<PublisherMetadata> { } [DataContract(Namespace = Constants.QUERY_SERVICE_NS)] public class BookMetadata { [DataMember] public string Filename; [DataMember] public int FileIndex; [DataMember] public DateTime Date; [DataMember] public int DateInt; [DataMember] public string Source; [DataMember] public string BookName; [DataMember] public string Field; [DataMember] public int SubId; [DataMember] public string BookType; } [CollectionDataContract(Name = "{0}List", ItemName = "BookMetadata", Namespace = Constants.QUERY_SERVICE_NS)] public class BookMetadataList : List<BookMetadata> { } [DataContract(Namespace = Constants.QUERY_SERVICE_NS)] public class AdditionalMetadata { [DataMember] public string BookName; [DataMember] public double Width; [DataMember] public double Height; [DataMember] public string Currency; [DataMember] public TimeSpan RegularReadTime; [DataMember] public int RegularReadTimeInt; [DataMember] public TimeSpan RegularHoldTime; [DataMember] public int RegularHoldTimeInt; } } Reproducible: Always Steps to Reproduce: 1. Try to generate WSDL for this contract Actual Results: The exception above Expected Results: Should not crash and generate the proper WSDL
Created attachment 326811 [details] correct repro The described repro was incomplete, so I have created a complete one.
The sample repro contains two "GetBooks" operations which looks invalid. It is not about WSDL issue and the actual problem rather likely to happen on .NET too.
I'll close this as INVALID unless a valid test case is provided.