Example #1
0
        public ServiceController(Func <IEnumerable <Type> > resolveServicesFn, ServiceMetadata metadata = null)
        {
            this.Metadata = metadata ?? new ServiceMetadata();

            this.RequestTypeFactoryMap    = new Dictionary <Type, Func <IHttpRequest, object> >();
            this.EnableAccessRestrictions = true;
            this.ResolveServicesFn        = resolveServicesFn;
        }
Example #2
0
        public MetadataPagesConfig(
            ServiceMetadata metadata,
            ServiceEndpointsMetadataConfig metadataConfig,
            HashSet <string> ignoredFormats,
            List <string> contentTypeFormats)
        {
            this.ignoredFormats = ignoredFormats;
            this.metadata       = metadata;

            metadataConfigMap = new Dictionary <string, MetadataConfig> {
                { "xml", metadataConfig.Xml },
                { "json", metadataConfig.Json },
                { "jsv", metadataConfig.Jsv },
                { "soap11", metadataConfig.Soap11 },
                { "soap12", metadataConfig.Soap12 },
            };

            AvailableFormatConfigs = new List <MetadataConfig>();

            var config = GetMetadataConfig("xml");

            if (config != null)
            {
                AvailableFormatConfigs.Add(config);
            }
            config = GetMetadataConfig("json");
            if (config != null)
            {
                AvailableFormatConfigs.Add(config);
            }
            config = GetMetadataConfig("jsv");
            if (config != null)
            {
                AvailableFormatConfigs.Add(config);
            }

            foreach (var format in contentTypeFormats)
            {
                metadataConfigMap[format] = metadataConfig.Custom.Create(format);

                config = GetMetadataConfig(format);
                if (config != null)
                {
                    AvailableFormatConfigs.Add(config);
                }
            }

            config = GetMetadataConfig("soap11");
            if (config != null)
            {
                AvailableFormatConfigs.Add(config);
            }
            config = GetMetadataConfig("soap12");
            if (config != null)
            {
                AvailableFormatConfigs.Add(config);
            }
        }
Example #3
0
		protected override void RenderOperations(HtmlTextWriter writer, IHttpRequest httpReq, ServiceMetadata metadata)
		{
			var defaultPage = new OperationsControl {
				Title = EndpointHost.Config.ServiceName,
                OperationNames = metadata.GetOperationNamesForMetadata(httpReq, Format),
				MetadataOperationPageBodyHtml = EndpointHost.Config.MetadataOperationPageBodyHtml,
			};

			defaultPage.RenderControl(writer);
		}
Example #4
0
        /// <summary>
        /// Inject alternative container and strategy for resolving Service Types
        /// </summary>
        public ServiceManager(Container container, ServiceController serviceController)
        {
            if (serviceController == null)
            {
                throw new ArgumentNullException("serviceController");
            }

            this.Container         = container ?? new Container();
            this.Metadata          = serviceController.Metadata; //always share the same metadata
            this.ServiceController = serviceController;
        }
    	protected override void RenderOperations(HtmlTextWriter writer, IHttpRequest httpReq, ServiceMetadata metadata)
    	{
			var defaultPage = new IndexOperationsControl {
				HttpRequest = httpReq,
                MetadataConfig = EndpointHost.Config.MetadataPagesConfig,                
				Title = EndpointHost.Config.ServiceName,
				Xsds = XsdTypes.Xsds,
				XsdServiceTypesIndex = 1,
                OperationNames = metadata.GetOperationNamesForMetadata(httpReq),
				MetadataPageBodyHtml = EndpointHost.Config.MetadataPageBodyHtml,
			};

			defaultPage.RenderControl(writer);
		}
Example #6
0
        //public ServiceOperations ServiceOperations { get; set; }
        //public ServiceOperations AllServiceOperations { get; set; }

        public ServiceManager(params Assembly[] assembliesWithServices)
        {
            if (assembliesWithServices == null || assembliesWithServices.Length == 0)
            {
                throw new ArgumentException(
                          "No Assemblies provided in your AppHost's base constructor.\n"
                          + "To register your services, please provide the assemblies where your web services are defined.");
            }

            this.Container = new Container {
                DefaultOwner = Owner.External
            };
            this.Metadata          = new ServiceMetadata();
            this.ServiceController = new ServiceController(() => GetAssemblyTypes(assembliesWithServices), this.Metadata);
        }
Example #7
0
        public MetadataPagesConfig(
            ServiceMetadata metadata,
            ServiceEndpointsMetadataConfig metadataConfig,
            HashSet<string> ignoredFormats,
            List<string> contentTypeFormats)
        {
            this.ignoredFormats = ignoredFormats;
            this.metadata = metadata;

            metadataConfigMap = new Dictionary<string, MetadataConfig> {
                {"xml", metadataConfig.Xml},
                {"json", metadataConfig.Json},
                {"jsv", metadataConfig.Jsv},
                {"soap11", metadataConfig.Soap11},
                {"soap12", metadataConfig.Soap12},
            };

            AvailableFormatConfigs = new List<MetadataConfig>();

            var config = GetMetadataConfig("xml");
            if (config != null) AvailableFormatConfigs.Add(config);
            config = GetMetadataConfig("json");
            if (config != null) AvailableFormatConfigs.Add(config);
            config = GetMetadataConfig("jsv");
            if (config != null) AvailableFormatConfigs.Add(config);

            foreach (var format in contentTypeFormats)
            {
                metadataConfigMap[format] = metadataConfig.Custom.Create(format);

                config = GetMetadataConfig(format);
                if (config != null) AvailableFormatConfigs.Add(config);
            }

            config = GetMetadataConfig("soap11");
            if (config != null) AvailableFormatConfigs.Add(config);
            config = GetMetadataConfig("soap12");
            if (config != null) AvailableFormatConfigs.Add(config);
        }
Example #8
0
 public XsdMetadata(ServiceMetadata metadata, bool flash = false)
 {
     Metadata = metadata;
     Flash = flash;
 }
Example #9
0
 public XsdMetadata(ServiceMetadata metadata, bool flash = false)
 {
     Metadata = metadata;
     Flash    = flash;
 }