public ServiceDescriptionReflector() { Type[] protocolReflectorTypes = WebServicesSection.Current.ProtocolReflectorTypes; this.reflectors = new ProtocolReflector[protocolReflectorTypes.Length]; for (int i = 0; i < this.reflectors.Length; i++) { ProtocolReflector reflector = (ProtocolReflector)Activator.CreateInstance(protocolReflectorTypes[i]); reflector.Initialize(this); this.reflectors[i] = reflector; } WebServiceProtocols enabledProtocols = WebServicesSection.Current.EnabledProtocols; if (((enabledProtocols & WebServiceProtocols.HttpPost) == WebServiceProtocols.Unknown) && ((enabledProtocols & WebServiceProtocols.HttpPostLocalhost) != WebServiceProtocols.Unknown)) { this.reflectorsWithPost = new ProtocolReflector[this.reflectors.Length + 1]; for (int j = 0; j < (this.reflectorsWithPost.Length - 1); j++) { ProtocolReflector reflector2 = (ProtocolReflector)Activator.CreateInstance(protocolReflectorTypes[j]); reflector2.Initialize(this); this.reflectorsWithPost[j] = reflector2; } ProtocolReflector reflector3 = new HttpPostProtocolReflector(); reflector3.Initialize(this); this.reflectorsWithPost[this.reflectorsWithPost.Length - 1] = reflector3; } }
/// <include file='doc\ServiceDescriptionReflector.uex' path='docs/doc[@for="ServiceDescriptionReflector.ServiceDescriptionReflector"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public ServiceDescriptionReflector() { Type[] reflectorTypes = WebServicesSection.Current.ProtocolReflectorTypes; reflectors = new ProtocolReflector[reflectorTypes.Length]; for (int i = 0; i < reflectors.Length; i++) { ProtocolReflector reflector = (ProtocolReflector)Activator.CreateInstance(reflectorTypes[i]); reflector.Initialize(this); reflectors[i] = reflector; } WebServiceProtocols enabledProtocols = WebServicesSection.Current.EnabledProtocols; if ((enabledProtocols & WebServiceProtocols.HttpPost) == 0 && (enabledProtocols & WebServiceProtocols.HttpPostLocalhost) != 0) { reflectorsWithPost = new ProtocolReflector[reflectors.Length + 1]; for (int i = 0; i < reflectorsWithPost.Length - 1; i++) { ProtocolReflector reflector = (ProtocolReflector)Activator.CreateInstance(reflectorTypes[i]); reflector.Initialize(this); reflectorsWithPost[i] = reflector; } ProtocolReflector reflectorWithPost = new HttpPostProtocolReflector(); reflectorWithPost.Initialize(this); reflectorsWithPost[reflectorsWithPost.Length - 1] = reflectorWithPost; } }
public void Reflect(Type type, string url) { XmlSchemaExporter schemaExporter = new XmlSchemaExporter(Schemas); SoapSchemaExporter soapSchemaExporter = new SoapSchemaExporter(Schemas); if (WSConfig.IsSupported(WSProtocol.HttpSoap)) { new Soap11ProtocolReflector().Reflect(this, type, url, schemaExporter, soapSchemaExporter); } #if NET_2_0 if (WSConfig.IsSupported(WSProtocol.HttpSoap12)) { new Soap12ProtocolReflector().Reflect(this, type, url, schemaExporter, soapSchemaExporter); } #endif if (WSConfig.IsSupported(WSProtocol.HttpGet)) { new HttpGetProtocolReflector().Reflect(this, type, url, schemaExporter, soapSchemaExporter); } #if ONLY_1_1 if (WSConfig.IsSupported(WSProtocol.HttpPost) || WSConfig.IsSupported(WSProtocol.HttpPostLocalhost)) #else if (WSConfig.IsSupported(WSProtocol.HttpPost)) #endif { new HttpPostProtocolReflector().Reflect(this, type, url, schemaExporter, soapSchemaExporter); } int i = 0; while (i < types.Schemas.Count) { if (types.Schemas[i].Items.Count == 0) { types.Schemas.RemoveAt(i); } else { i++; } } if (serviceDescriptions.Count == 1) { serviceDescriptions[0].Types = types; } else { foreach (ServiceDescription d in serviceDescriptions) { d.Types = new Types(); for (int n = 0; n < types.Schemas.Count; n++) { ProtocolReflector.AddImport(d, types.Schemas[n].TargetNamespace, GetSchemaUrl(url, n)); } } } }
private void ReflectInternal(ProtocolReflector[] reflectors) { this.description = new System.Web.Services.Description.ServiceDescription(); this.description.TargetNamespace = this.serviceAttr.Namespace; this.ServiceDescriptions.Add(this.description); this.service = new System.Web.Services.Description.Service(); string name = this.serviceAttr.Name; if ((name == null) || (name.Length == 0)) { name = this.serviceType.Name; } this.service.Name = XmlConvert.EncodeLocalName(name); if ((this.serviceAttr.Description != null) && (this.serviceAttr.Description.Length > 0)) { this.service.Documentation = this.serviceAttr.Description; } this.description.Services.Add(this.service); this.reflectionContext = new Hashtable(); this.exporter = new XmlSchemaExporter(this.description.Types.Schemas); this.importer = SoapReflector.CreateXmlImporter(this.serviceAttr.Namespace, SoapReflector.ServiceDefaultIsEncoded(this.serviceType)); WebMethodReflector.IncludeTypes(this.methods, this.importer); for (int i = 0; i < reflectors.Length; i++) { reflectors[i].Reflect(); } }
private void ReflectInternal(ProtocolReflector[] reflectors) { description = new ServiceDescription(); description.TargetNamespace = serviceAttr.Namespace; ServiceDescriptions.Add(description); service = new Service(); string name = serviceAttr.Name; if (name == null || name.Length == 0) name = serviceType.Name; service.Name = XmlConvert.EncodeLocalName(name); if (serviceAttr.Description != null && serviceAttr.Description.Length > 0) service.Documentation = serviceAttr.Description; description.Services.Add(service); reflectionContext = new Hashtable(); exporter = new XmlSchemaExporter(description.Types.Schemas); importer = SoapReflector.CreateXmlImporter(serviceAttr.Namespace, SoapReflector.ServiceDefaultIsEncoded(serviceType)); WebMethodReflector.IncludeTypes(methods, importer); for (int i = 0; i < reflectors.Length; i++) { reflectors[i].Reflect(); } }
/// <include file='doc\ServiceDescriptionReflector.uex' path='docs/doc[@for="ServiceDescriptionReflector.ServiceDescriptionReflector"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public ServiceDescriptionReflector() { Type[] reflectorTypes = WebServicesSection.Current.ProtocolReflectorTypes; reflectors = new ProtocolReflector[reflectorTypes.Length]; for (int i = 0; i < reflectors.Length; i++) { ProtocolReflector reflector = (ProtocolReflector)Activator.CreateInstance(reflectorTypes[i]); reflector.Initialize(this); reflectors[i] = reflector; } WebServiceProtocols enabledProtocols = WebServicesSection.Current.EnabledProtocols; if ((enabledProtocols & WebServiceProtocols.HttpPost) == 0 && (enabledProtocols & WebServiceProtocols.HttpPostLocalhost) != 0) { reflectorsWithPost = new ProtocolReflector[reflectors.Length + 1]; for (int i = 0; i < reflectorsWithPost.Length - 1; i++) { ProtocolReflector reflector = (ProtocolReflector) Activator.CreateInstance(reflectorTypes[i]); reflector.Initialize(this); reflectorsWithPost[i] = reflector; } ProtocolReflector reflectorWithPost = new HttpPostProtocolReflector(); reflectorWithPost.Initialize(this); reflectorsWithPost[reflectorsWithPost.Length - 1] = reflectorWithPost; } }