public void ExportEndpointTest () { WsdlExporter we = new WsdlExporter (); ServiceEndpoint se = new ServiceEndpoint (ContractDescription.GetContract (typeof (IEchoService))); se.Binding = new BasicHttpBinding (); se.Address = new EndpointAddress ("http://localhost:8080"); //TEST Invalid name: 5se.Name = "Service#1"; //se.Name = "Service0"; //se.ListenUri = new Uri ("http://localhost:8080/svc"); we.ExportEndpoint (se); MetadataSet ms = we.GetGeneratedMetadata (); Assert.AreEqual (6, ms.MetadataSections.Count); CheckContract_IEchoService (ms, "#eet01"); WSServiceDescription sd = GetServiceDescription (ms, "http://tempuri.org/", "ExportEndpointTest"); CheckServicePort (GetService (sd, "service", "ExportEndpointTest"), "BasicHttpBinding_IEchoService", new XmlQualifiedName ("BasicHttpBinding_IEchoService", "http://tempuri.org/"), "http://localhost:8080/", "#eet02"); CheckBasicHttpBinding (sd, "BasicHttpBinding_IEchoService", new XmlQualifiedName ("IEchoService", "http://myns/echo"), "Echo", "http://myns/echo/IEchoService/Echo", true, true, "#eet03"); }
void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) { WsdlExporter wsdlExporter = new WsdlExporter(); wsdlExporter.ExportEndpoint(endpoint); endpointDispatcher.DispatchRuntime.MessageInspectors.Add( new XsdValidationInspector(wsdlExporter.GeneratedXmlSchemas)); }
/// <summary> /// When ExportContract is called to generate the necessary metadata, we inspect the service /// contract and build a list of parameters that we'll need to adjust the XSD for later. /// </summary> void IWsdlExportExtension.ExportContract(WsdlExporter exporter, WsdlContractConversionContext context) { _requiredParameter = new List<RequiredMessagePart>(); foreach (var operation in context.Contract.Operations) { var inputMessage = operation.Messages.Where(m => m.Direction == MessageDirection.Input).First(); var parameters = operation.SyncMethod.GetParameters(); Debug.Assert(parameters.Length == inputMessage.Body.Parts.Count); for (int i = 0; i < parameters.Length; i++) { object[] attributes = parameters[i].GetCustomAttributes(typeof(OptionalAttribute), false); if (attributes.Length == 0) { // The parameter has no [Optional] attribute, add it to the list of parameters // that we need to adjust the XML schema for later on. _requiredParameter.Add(new RequiredMessagePart() { Namespace = inputMessage.Body.Parts[i].Namespace, Message = operation.Name, Name = inputMessage.Body.Parts[i].Name }); } } } }
public void ExportEndpoint( WsdlExporter exporter, WsdlEndpointConversionContext context ) { }
// // IWsdlExportExtension Implementation // public void ExportContract( WsdlExporter exporter, WsdlContractConversionContext context ) { // never called }
private XmlDocument ExportEndpoints() { WsdlExporter exporter = new WsdlExporter(); foreach (ServiceEndpoint ep in endpoints) { exporter.ExportEndpoint(ep); } MetadataSet metadataSet = exporter.GetGeneratedMetadata(); StringBuilder b = new StringBuilder(); StringWriter sw = new StringWriter(b); XmlTextWriter tw = new XmlTextWriter(sw); foreach (MetadataSection section in metadataSet.MetadataSections) { if (section.Metadata is System.Web.Services.Description.ServiceDescription) { System.Web.Services.Description.ServiceDescription sd = (System.Web.Services.Description.ServiceDescription)section.Metadata; sd.Write(tw); } } string wcfWsdl = b.ToString(); // Read it in to an XmlDocument. XmlDocument wcfWsdlDoc = new XmlDocument(); wcfWsdlDoc.LoadXml(wcfWsdl); return wcfWsdlDoc; }
protected MessageContractExporter(WsdlExporter exporter, WsdlContractConversionContext context, OperationDescription operation, IOperationBehavior extension) { this.exporter = exporter; this.contractContext = context; this.operation = operation; this.extension = extension; }
void IWsdlExportExtension.ExportEndpoint(WsdlExporter exporter, WsdlEndpointConversionContext context) { if (SingleFile) SingleFileExporter.ExportEndpoint(exporter); if (Location != null) { LocationOverrideExporter.ExportEndpoint(exporter, context, Location); } }
static MessageExportContext GetMessageExportContext(WsdlExporter exporter) { object messageExportContext; if (!exporter.State.TryGetValue(typeof(MessageExportContext), out messageExportContext)) { messageExportContext = new MessageExportContext(); exporter.State[typeof(MessageExportContext)] = messageExportContext; } return (MessageExportContext)messageExportContext; }
public static MetadataSet BasicHttp () { var exporter = new WsdlExporter (); var cd = new ContractDescription ("MyContract"); exporter.ExportEndpoint (new ServiceEndpoint ( cd, new BasicHttpBinding (), new EndpointAddress (HttpUri))); return exporter.GetGeneratedMetadata (); }
public void Ctor1 () { WsdlExporter we = new WsdlExporter (); Assert.IsNotNull (we.GetGeneratedMetadata ()); Assert.IsNotNull (we.GeneratedWsdlDocuments, "#c1"); Assert.AreEqual (0, we.GeneratedWsdlDocuments.Count, "#c2"); Assert.IsNotNull (we.GeneratedXmlSchemas, "#c3"); Assert.AreEqual (0, we.GeneratedXmlSchemas.Count, "#c4"); }
void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { WsdlExporter wsdlExporter = new WsdlExporter(); wsdlExporter.ExportEndpoints(serviceDescription.Endpoints, new XmlQualifiedName(serviceDescription.Name, serviceDescription.Namespace)); foreach (ChannelDispatcher cDispatcher in serviceHostBase.ChannelDispatchers) foreach (EndpointDispatcher endpointDispatcher in cDispatcher.Endpoints) endpointDispatcher.DispatchRuntime.MessageInspectors.Add( new XsdValidationInspector(wsdlExporter.GeneratedXmlSchemas)); }
public static Wsdl Generate(Type contract) { var exporter = new WsdlExporter(); exporter.ExportContract(ContractDescription.GetContract(contract)); var metadataSet = exporter.GetGeneratedMetadata(); var schemaStream = new MemoryStream(); metadataSet.WriteTo(new XmlTextWriter(new StreamWriter(schemaStream))); schemaStream.Position = 0; var source = XDocument.Load( new XmlTextReader(schemaStream)); return new Wsdl(source); }
public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, System.ServiceModel.Description.ServiceDescription service) { if (DiagnosticUtility.ShouldTrace(type)) { WsdlExporter exporter = new WsdlExporter(); string ns = "http://tempuri.org/"; XmlQualifiedName wsdlServiceQName = new XmlQualifiedName("comPlusService", ns); exporter.ExportEndpoints(service.Endpoints, wsdlServiceQName); System.Web.Services.Description.ServiceDescription wsdl = exporter.GeneratedWsdlDocuments[ns]; ComPlusServiceHostStartedServiceDetailsSchema schema = new ComPlusServiceHostStartedServiceDetailsSchema(info.AppID, info.Clsid, wsdl); TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord) schema); } }
public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, ServiceDescription service) { if (DiagnosticUtility.ShouldTrace(type)) { WsdlExporter exporter = new WsdlExporter(); string serviceNs = NamingHelper.DefaultNamespace; XmlQualifiedName serviceQName = new XmlQualifiedName("comPlusService", serviceNs); exporter.ExportEndpoints(service.Endpoints, serviceQName); WsdlNS.ServiceDescription wsdl = exporter.GeneratedWsdlDocuments[serviceNs]; ComPlusServiceHostStartedServiceDetailsSchema record = new ComPlusServiceHostStartedServiceDetailsSchema(info.AppID, info.Clsid, wsdl); TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record); } }
public static MetadataSet BasicHttp_TransportSecurity () { var exporter = new WsdlExporter (); var cd = new ContractDescription ("MyContract"); var binding = new BasicHttpBinding (); binding.Security.Mode = BasicHttpSecurityMode.Transport; exporter.ExportEndpoint (new ServiceEndpoint ( cd, binding, new EndpointAddress (HttpUri))); return exporter.GetGeneratedMetadata (); }
public static MetadataSet BasicHttp_MessageSecurity () { var exporter = new WsdlExporter (); var cd = new ContractDescription ("MyContract"); var binding = new BasicHttpBinding (); binding.Security.Mode = BasicHttpSecurityMode.Message; binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.Certificate; exporter.ExportEndpoint (new ServiceEndpoint ( cd, binding, new EndpointAddress (HttpUri))); return exporter.GetGeneratedMetadata (); }
public void SimpleExport () { var label = new TestLabel ("DuplicateContract"); var cd = new ContractDescription ("MyContract"); var endpoint = new ServiceEndpoint ( cd, new BasicHttpBinding (), new EndpointAddress (HttpUri)); var exporter = new WsdlExporter (); exporter.ExportContract (cd); exporter.ExportEndpoint (endpoint); CheckExport ( exporter, new QName ("MyContract", "http://tempuri.org/"), "BasicHttpBinding", 1, label); }
static void Main(string[] args) { ContractDescription contract = ContractDescription.GetContract(typeof(IOrderService)); EndpointAddress address1 = new EndpointAddress("http://127.0.0.1/orderservice"); EndpointAddress address2 = new EndpointAddress("net.tcp://127.0.0.1/orderservice"); ServiceEndpoint endpoint1 = new ServiceEndpoint(contract, new WS2007HttpBinding(), address1); ServiceEndpoint endpoint2 = new ServiceEndpoint(contract, new NetTcpBinding(), address2); XmlQualifiedName serviceName = new XmlQualifiedName("OrderService", "http://www.artech.com/services/"); WsdlExporter exporter = new WsdlExporter(); exporter.ExportEndpoints(new ServiceEndpoint[] { endpoint1, endpoint2 }, serviceName); MetadataSet metadata = exporter.GetGeneratedMetadata(); using (XmlWriter writer = new XmlTextWriter("metadata.xml", Encoding.UTF8)) { metadata.WriteTo(writer); } Process.Start("metadata.xml"); }
void IWsdlExportExtension.ExportContract(WsdlExporter exporter, WsdlContractConversionContext context) { // This is either for a service contract or operation, so set documentation accordingly. if (_contractDescription != null) { // Attribute was applied to a contract. context.WsdlPortType.Documentation = this.Text; } else { // Attribute was applied to an operation. Operation operation = context.GetOperation(_operationDescription); if (operation != null) { operation.Documentation = this.Text; } } }
internal static void ExportEndpoint(WsdlExporter wsdlExporter) { if (wsdlExporter.GeneratedWsdlDocuments.Count > 1) throw new ApplicationException("Single file option is not supported in multiple wsdl files"); ServiceDescription rootDescription = wsdlExporter.GeneratedWsdlDocuments[0]; XmlSchemas imports = new XmlSchemas(); foreach (XmlSchema schema in wsdlExporter.GeneratedXmlSchemas.Schemas()) { imports.Add(schema); } foreach (XmlSchema schema in imports) { schema.Includes.Clear(); } rootDescription.Types.Schemas.Clear(); rootDescription.Types.Schemas.Add(imports); }
public void ExportEndpoint(WsdlExporter exporter, WsdlEndpointConversionContext context) { ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "ExportEndpoint"); try { System.Web.Services.Description.ServiceDescription wsdl = exporter.GeneratedWsdlDocuments[0]; XmlSchemaSet schemaSet = exporter.GeneratedXmlSchemas; XmlSchemas imports = new XmlSchemas(); foreach (XmlSchema schema in exporter.GeneratedXmlSchemas.Schemas()) { imports.Add(schema); } foreach (XmlSchema schema in imports) { schema.Includes.Clear(); } wsdl.Types.Schemas.Clear(); wsdl.Types.Schemas.Add(imports); //List<XmlSchema> importsList = new List<XmlSchema>(); // foreach (XmlSchema schema in wsdl.Types.Schemas) // { // AddImportedSchemas(schema, schemaSet, importsList); // } // wsdl.Types.Schemas.Clear(); // foreach (XmlSchema schema in importsList) // { // RemoveXsdImports(schema); // wsdl.Types.Schemas.Add(schema); // } //} } catch (Exception ex) { Log.Exception(PROC, ex); } }
public void ExportContract(WsdlExporter exporter, WsdlContractConversionContext context) { XsdDataContractExporter xsdInventoryExporter; object dataContractExporter; if (!exporter.State.TryGetValue(typeof(XsdDataContractExporter), out dataContractExporter)) { xsdInventoryExporter = new XsdDataContractExporter(exporter.GeneratedXmlSchemas); exporter.State.Add(typeof(XsdDataContractExporter), xsdInventoryExporter); } else { xsdInventoryExporter = (XsdDataContractExporter)dataContractExporter; } if (xsdInventoryExporter.Options == null) { xsdInventoryExporter.Options = new ExportOptions(); } xsdInventoryExporter.Options.DataContractSurrogate = this.surrogate; }
public void ExportEndpoint(WsdlExporter exporter, WsdlEndpointConversionContext context) { XmlSchemaSet schemaSet = exporter.GeneratedXmlSchemas; foreach (ServiceDescription wsdl in exporter.GeneratedWsdlDocuments) { List<XmlSchema> importsList = new List<XmlSchema>(); foreach (XmlSchema schema in wsdl.Types.Schemas) { AddImportedSchemas(schema, schemaSet, importsList); } wsdl.Types.Schemas.Clear(); foreach (XmlSchema schema in importsList) { //RemoveXsdImports(schema); wsdl.Types.Schemas.Add(schema); } } }
public void ExportContract(WsdlExporter exporter, WsdlContractConversionContext context) { if (exporter == null) throw new ArgumentNullException("exporter"); object dataContractExporter; XsdDataContractExporter xsdDCExporter; if (!exporter.State.TryGetValue(typeof(XsdDataContractExporter), out dataContractExporter)) { xsdDCExporter = new XsdDataContractExporter(exporter.GeneratedXmlSchemas); exporter.State.Add(typeof(XsdDataContractExporter), xsdDCExporter); } else { xsdDCExporter = (XsdDataContractExporter)dataContractExporter; } if (xsdDCExporter.Options == null) xsdDCExporter.Options = new ExportOptions(); if (xsdDCExporter.Options.DataContractSurrogate == null) xsdDCExporter.Options.DataContractSurrogate = new AllowNonSerializableTypesSurrogate(); }
public void ExportEndpoint(WsdlExporter exporter, WsdlEndpointConversionContext context) { foreach (object extension in context.WsdlPort.Extensions) { SoapAddressBinding addr = (extension as SoapAddressBinding); if (addr != null) { addr.Location = this.location.ToString(); } } EnumerateWsdlsAndSchemas(exporter.GeneratedWsdlDocuments, exporter.GeneratedXmlSchemas); foreach (ServiceDescription description in exporter.GeneratedWsdlDocuments) { FixImportAddresses(exporter.GeneratedWsdlDocuments, description, exporter.GeneratedXmlSchemas); } foreach (XmlSchema schema in exporter.GeneratedXmlSchemas.Schemas()) { FixImportAddresses(exporter.GeneratedXmlSchemas, schema); } }
private static MetadataSet GetExportedMetadata(ServiceDescription serviceDescription) { Collection<ServiceEndpoint> endpoints = new Collection<ServiceEndpoint>(); foreach (var endpoint in serviceDescription.Endpoints) { if (endpoint.Contract.ContractType == typeof(IMetadataProvisionService)) { continue; } ServiceEndpoint newEndpoint = new ServiceEndpoint(endpoint.Contract, endpoint.Binding, endpoint.Address); newEndpoint.Name = endpoint.Name; foreach (var behavior in endpoint.Behaviors) { newEndpoint.Behaviors.Add(behavior); } endpoints.Add(newEndpoint); } WsdlExporter exporter = new WsdlExporter(); XmlQualifiedName wsdlServiceQName = new XmlQualifiedName(serviceDescription.Name, serviceDescription.Namespace); exporter.ExportEndpoints(endpoints, wsdlServiceQName); MetadataSet metadata = exporter.GetGeneratedMetadata(); return metadata; }
/// <summary> /// Writes custom Web Services Description Language (WSDL) elements into /// the generated WSDL for an endpoint. /// </summary> public void ExportEndpoint(WsdlExporter exporter, WsdlEndpointConversionContext context) { // We don't support more than one WSDL. if (exporter.GeneratedWsdlDocuments.Count > 1) { Trace.TraceError(Resources.ExInconsistantXmlNamespaces); throw new InvalidOperationException(Resources.ExInconsistantXmlNamespaces); } ServiceDescription wsdl = exporter.GeneratedWsdlDocuments[0]; XmlSchemaSet schemaSet = exporter.GeneratedXmlSchemas; Collection<XmlSchema> importsList = new Collection<XmlSchema>(); for (int i = 0; i < wsdl.Types.Schemas.Count; i++) { XmlSchema schema = wsdl.Types.Schemas[i]; ResolveImportedSchemas(schema, schemaSet, importsList); // If we don't have anything else (e.g. inlined types) // in this schema, we can remove it. if (schema.Includes.Count == 0 && schema.Items.Count == 0) { wsdl.Types.Schemas.RemoveAt(i--); } } // Finally, add each of the real schemas we extracted in the above step. while(importsList.Count != 0) { int l = importsList.Count - 1; wsdl.Types.Schemas.Add(importsList[l]); importsList.RemoveAt(l); } }
internal static void ExportMessageBinding(WsdlExporter exporter, WsdlEndpointConversionContext endpointContext, Type messageContractExporterType, OperationDescription operation) { new MessageBindingExporter(exporter, endpointContext).ExportMessageBinding(operation, messageContractExporterType); }
void IWsdlExportExtension.ExportEndpoint(WsdlExporter exporter, WsdlEndpointConversionContext context) { throw new NotImplementedException(); }
void System.ServiceModel.Description.IWsdlExportExtension.ExportEndpoint(WsdlExporter exporter, WsdlEndpointConversionContext endpointContext) { }
void System.ServiceModel.Description.IWsdlExportExtension.ExportContract(WsdlExporter exporter, WsdlContractConversionContext contractContext) { }
void IWsdlExportExtension.ExportEndpoint(WsdlExporter exporter, WsdlEndpointConversionContext context) { }
//IWsdlExportExtension void IWsdlExportExtension.ExportContract(WsdlExporter exporter, WsdlContractConversionContext context) { }
internal XmlSerializerMessageContractExporter(WsdlExporter exporter, WsdlContractConversionContext context, OperationDescription operation, IOperationBehavior extension) : base(exporter, context, operation, extension) { }
void IWsdlExportExtension.ExportEndpoint (WsdlExporter exporter, WsdlEndpointConversionContext context) { }
internal static void SetSoapVersion(WsdlEndpointConversionContext endpointContext, WsdlExporter exporter, EnvelopeVersion version) { SetSoapVersionState(endpointContext.WsdlBinding, exporter, version); //Convert all SOAP extensions to the right version. if (endpointContext.WsdlPort != null) { SoapConverter.ConvertExtensions(endpointContext.WsdlPort.Extensions, version, SoapConverter.ConvertSoapAddressBinding); } SoapConverter.ConvertExtensions(endpointContext.WsdlBinding.Extensions, version, SoapConverter.ConvertSoapBinding); foreach (WsdlNS.OperationBinding operationBinding in endpointContext.WsdlBinding.Operations) { SoapConverter.ConvertExtensions(operationBinding.Extensions, version, SoapConverter.ConvertSoapOperationBinding); //Messages { if (operationBinding.Input != null) { SoapConverter.ConvertExtensions(operationBinding.Input.Extensions, version, SoapConverter.ConvertSoapMessageBinding); } if (operationBinding.Output != null) { SoapConverter.ConvertExtensions(operationBinding.Output.Extensions, version, SoapConverter.ConvertSoapMessageBinding); } foreach (WsdlNS.MessageBinding faultBinding in operationBinding.Faults) { SoapConverter.ConvertExtensions(faultBinding.Extensions, version, SoapConverter.ConvertSoapMessageBinding); } } } }
private static EnvelopeVersion GetSoapVersionState(WsdlNS.Binding wsdlBinding, WsdlExporter exporter) { object versions = null; if (exporter.State.TryGetValue(SoapVersionStateKey, out versions)) { if (versions != null && ((Dictionary <WsdlNS.Binding, EnvelopeVersion>)versions).ContainsKey(wsdlBinding)) { return(((Dictionary <WsdlNS.Binding, EnvelopeVersion>)versions)[wsdlBinding]); } } return(null); }
// ----------------------------------------------------------------------------------------------------------------------- // Developers Note: We go through a little song an dance here to Get or Create an exsisting SoapBinding from the WSDL // Extensions for a number of reasons: // 1. Multiple Extensions may contribute to the settings in the soap binding and so to make this work without // relying on ordering, we need the GetOrCreate method. // 2. There are diffrent classes for diffrent SOAP versions and the extensions that determines the version is // also un-ordered so when we finally figure out the version we may need to recreate the BindingExtension and // clone it. internal static WsdlNS.SoapAddressBinding GetOrCreateSoapAddressBinding(WsdlNS.Binding wsdlBinding, WsdlNS.Port wsdlPort, WsdlExporter exporter) { if (GetSoapVersionState(wsdlBinding, exporter) == EnvelopeVersion.None) { return(null); } WsdlNS.SoapAddressBinding existingSoapAddressBinding = GetSoapAddressBinding(wsdlPort); EnvelopeVersion version = GetSoapVersion(wsdlBinding); if (existingSoapAddressBinding != null) { return(existingSoapAddressBinding); } WsdlNS.SoapAddressBinding soapAddressBinding = CreateSoapAddressBinding(version, wsdlPort); return(soapAddressBinding); }
internal static WsdlNS.SoapBinding GetOrCreateSoapBinding(WsdlEndpointConversionContext endpointContext, WsdlExporter exporter) { if (GetSoapVersionState(endpointContext.WsdlBinding, exporter) == EnvelopeVersion.None) { return(null); } WsdlNS.SoapBinding existingSoapBinding = GetSoapBinding(endpointContext); if (existingSoapBinding != null) { return(existingSoapBinding); } EnvelopeVersion version = GetSoapVersion(endpointContext.WsdlBinding); WsdlNS.SoapBinding soapBinding = CreateSoapBinding(version, endpointContext.WsdlBinding); return(soapBinding); }
internal static WsdlNS.SoapOperationBinding GetOrCreateSoapOperationBinding(WsdlEndpointConversionContext endpointContext, OperationDescription operation, WsdlExporter exporter) { if (GetSoapVersionState(endpointContext.WsdlBinding, exporter) == EnvelopeVersion.None) { return(null); } WsdlNS.SoapOperationBinding existingSoapOperationBinding = GetSoapOperationBinding(endpointContext, operation); WsdlNS.OperationBinding wsdlOperationBinding = endpointContext.GetOperationBinding(operation); EnvelopeVersion version = GetSoapVersion(endpointContext.WsdlBinding); if (existingSoapOperationBinding != null) { return(existingSoapOperationBinding); } WsdlNS.SoapOperationBinding soapOperationBinding = CreateSoapOperationBinding(version, wsdlOperationBinding); return(soapOperationBinding); }
internal DataContractSerializerMessageContractExporter(WsdlExporter exporter, WsdlContractConversionContext context, OperationDescription operation, IOperationBehavior extension) : base(exporter, context, operation, extension) { }
internal MetadataSet GenerateMetadata() { if ((this.behavior.ExternalMetadataLocation == null) || (this.behavior.ExternalMetadataLocation.ToString() == string.Empty)) { if (this.metadataGenerationException != null) { throw this.metadataGenerationException; } try { MetadataExporter metadataExporter = this.behavior.MetadataExporter; XmlQualifiedName wsdlServiceQName = new XmlQualifiedName(this.description.Name, this.description.Namespace); Collection <ServiceEndpoint> endpoints = new Collection <ServiceEndpoint>(); foreach (ServiceEndpoint endpoint in this.description.Endpoints) { ServiceMetadataContractBehavior behavior = endpoint.Contract.Behaviors.Find <ServiceMetadataContractBehavior>(); if (((behavior != null) && !behavior.MetadataGenerationDisabled) || ((behavior == null) && !endpoint.IsSystemEndpoint)) { EndpointAddress endpointAddress = null; EndpointDispatcher listenerByID = ServiceMetadataBehavior.GetListenerByID(this.host.ChannelDispatchers, endpoint.Id); if (listenerByID != null) { endpointAddress = listenerByID.EndpointAddress; } ServiceEndpoint item = new ServiceEndpoint(endpoint.Contract) { Binding = endpoint.Binding, Name = endpoint.Name, Address = endpointAddress }; foreach (IEndpointBehavior behavior2 in endpoint.Behaviors) { item.Behaviors.Add(behavior2); } endpoints.Add(item); } } WsdlExporter exporter2 = metadataExporter as WsdlExporter; if (exporter2 != null) { exporter2.ExportEndpoints(endpoints, wsdlServiceQName); } else { foreach (ServiceEndpoint endpoint3 in endpoints) { metadataExporter.ExportEndpoint(endpoint3); } } if ((metadataExporter.Errors.Count > 0) && DiagnosticUtility.ShouldTraceWarning) { TraceWsdlExportErrors(metadataExporter); } return(metadataExporter.GetGeneratedMetadata()); } catch (Exception exception) { this.metadataGenerationException = exception; throw; } } return(null); }