private void RegisterRoutes()
        {
            WebServiceHostFactory factory = new WebServiceHostFactory();

            RouteTable.Routes.Add(new ServiceRoute("Tasks", factory, typeof(TaskService)));
            RouteTable.Routes.Add(new ServiceRoute("Users", factory, typeof(UserService)));
        }
Exemple #2
0
        /// <summary>
        /// Application Start
        /// </summary>
        protected void Application_Start(object sender, EventArgs e)
        {
            WebServiceHostFactory Factory = new WebServiceHostFactory();

            RouteTable.Routes.Add(new ServiceRoute("Properties", Factory, typeof(Properties)));
            RouteTable.Routes.Add(new ServiceRoute("Foo", Factory, typeof(Foo)));
        }
Exemple #3
0
 /// <summary>
 /// 为route增加借口类库的映射
 /// </summary>
 /// <param name="webServiceHostFactory"></param>
 /// <param name="type"></param>
 private void AddRoute(WebServiceHostFactory webServiceHostFactory, Type type)
 {
     if (type.Name.Contains("Service"))
     {
         Route route = new ServiceRoute(type.Name, webServiceHostFactory, type);
         _routelist.Add(route);
     }
 }
        public static void RegisterRoutes()
        {
            var httpsOnlyWebServiceHostFactory = new HttpsOnlyWebServiceHostFactory();
            var webServiceHostFactory          = new WebServiceHostFactory();

            RouteTable.Routes.Add(new ServiceRoute("UserService", httpsOnlyWebServiceHostFactory, typeof(UserService)));
            RouteTable.Routes.Add(new ServiceRoute("ProductService", webServiceHostFactory, typeof(ProductService)));
        }
Exemple #5
0
        private void RegisterRoutes()
        {
            WebServiceHostFactory factory = new WebServiceHostFactory();

            //RouteTable.Routes.Add(new ServiceRoute("ServicePost", factory, typeof(RestService.ServicePost)));
            RouteTable.Routes.Add(new ServiceRoute("DataDictionaryService", factory, typeof(RestService.DataDictionaryService)));
            RouteTable.Routes.Add(new ServiceRoute("FileUploadService", factory, typeof(RestService.FileUploadService)));
        }
Exemple #6
0
        private void RegisterRoutes()
        {
            //RouteTable.Routes.Add(new ServiceRoute("TaskService",
            //    new WebServiceHostFactory(), typeof(TaskService)));

            var securewebServiceHostFactory = new WebServiceHostFactory();

            RouteTable.Routes.Add(new ServiceRoute("api",
                                                   securewebServiceHostFactory, typeof(TaskService)));
        }
        public void should_throw_serviceactivationexception()
        {
            var factory =
                new WebServiceHostFactory();

            Exception exception =
                Catch.Exception(() => factory.CreateServiceHost(typeof(FakeService).FullName, new[] { new Uri("net.tcp://localhost:8080") }));

            exception.ShouldBeOfType<ServiceActivationException>();
        }
        public void should_return_webservicehost_instance()
        {
            var factory =
                new WebServiceHostFactory();

            var host =
                factory.CreateServiceHost(typeof(FakeService).AssemblyQualifiedName, new[] { new Uri("net.tcp://localhost:8080") });

            host.ShouldBeOfType<WebServiceHost>();
        }
Exemple #9
0
#pragma warning restore

        /// <summary>
        /// Adds service routes for every <see cref="IService"/> class found through MEF.
        /// </summary>
        /// <param name="routes">The route collection.</param>
        /// <param name="routePrefix">The route prefix.</param>
        public void AddRoutes(RouteCollection routes, string routePrefix = "")
        {
            container.ComposeParts(this);

            var factory = new WebServiceHostFactory();

            foreach (Lazy <IService, IServiceData> i in services)
            {
                routes.Add(new ServiceRoute(routePrefix + i.Metadata.RouteName, factory, i.Value.GetType()));
            }
        }
Exemple #10
0
 /// <summary>
 /// Builds a web service and route for a WCF service.
 /// </summary>
 /// <param name="webServiceType">The custom web service type.</param>
 /// <param name="serviceRoute">The route to provide. Should end with .svc to work.</param>
 /// <param name="factory">The WebServiceHostFactory, which is by default the Rhyous.WebFramework.Behaviors.RestWebServiceHostFactory.</param>
 /// <param name="routeCollection">The route collection to update. It is RouteTable.Routes static by default.</param>
 public static void BuildWebService(Type webServiceType, string serviceRoute, WebServiceHostFactory factory = null, RouteCollection routeCollection = null)
 {
     if (routeCollection == null)
     {
         routeCollection = RouteTable.Routes;
     }
     if (factory == null)
     {
         factory = new RestWebServiceHostFactory();
     }
     routeCollection.Add(new ServiceRoute(serviceRoute, factory, webServiceType));
 }
Exemple #11
0
        protected void Application_Start(object sender, EventArgs e)
        {
            var fileName = Path.Combine(HostingEnvironment.MapPath("~/"),
                                        "../../Settings/Settings.xml");

            Settings.Init(fileName);

            var factory = new WebServiceHostFactory();

            RouteTable.Routes.Add(
                new ServiceRoute("Users", factory, typeof(UserService)));
        }
Exemple #12
0
        private void RegisterRoutes()
        {
            // Edit the base address of Service1 by replacing the "Service1" string below
            WebServiceHostFactory wsh = new WebServiceHostFactory();

            RouteTable.Routes.Add(new ServiceRoute("Oca/FamilyMemberService.IPhone", new WebServiceHostFactory(), typeof(Oca.FamilyMemberService4IPhone)));
            RouteTable.Routes.Add(new ServiceRoute("Oca/FamilyMemberService.Android", new WebServiceHostFactory(), typeof(Oca.FamilyMemberService4Android)));
            RouteTable.Routes.Add(new ServiceRoute("Oca/CallService.IPhone", new WebServiceHostFactory(), typeof(Oca.CallServiceService4IPhone)));
            RouteTable.Routes.Add(new ServiceRoute("Oca/CallService.Android", new WebServiceHostFactory(), typeof(Oca.CallServiceService4Android)));
            RouteTable.Routes.Add(new ServiceRoute("Oca/WorkOrderService.IPhone", new WebServiceHostFactory(), typeof(Oca.ServiceWorkOrderService4IPhone)));
            RouteTable.Routes.Add(new ServiceRoute("Oca/WorkOrderService.Android", new WebServiceHostFactory(), typeof(Oca.ServiceWorkOrderService4Android)));
        }
Exemple #13
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            var factory = new WebServiceHostFactory();

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.Add(new ServiceRoute("api", factory, typeof(WebApiService)));

            routes.MapRoute(
                name: "Rental Management Console",
                url: "manage/{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                );
        }
Exemple #14
0
        public static void Register(RouteCollection collection)
        {
            RouteTable.Routes.Add(new Route("api/test", new TestHandler()));

            RouteTable.Routes.Add(new Route("api/css", new JSHandler(JSType.CSS)));
            RouteTable.Routes.Add(new Route("api/js/start", new JSHandler(JSType.Start)));
            RouteTable.Routes.Add(new Route("api/js/beforehap", new JSHandler(JSType.BeforeHAP)));
            RouteTable.Routes.Add(new Route("api/js/hap", new JSHandler(JSType.HAP)));
            RouteTable.Routes.Add(new Route("api/js/afterhap", new JSHandler(JSType.AfterHAP)));
            RouteTable.Routes.Add(new Route("api/js/end", new JSHandler(JSType.End)));


            RouteTable.Routes.Add(new Route("api/mypic", new MyPicHandler()));
            RouteTable.Routes.Add(new Route("api/tiles/icons/{width}/{height}/{*path}", new TileIconHandler()));
            RouteTable.Routes.Add(new Route("api/mycomputer/thumb/{*path}", new ThumbsHandler()));
            RouteTable.Routes.Add(new Route("api/mycomputer/{ext}.ico", new IconHandler()));
            RouteTable.Routes.Add(new Route("api/myfiles-upload/{drive}/{*path}", new MyFiles_UploadHandler()));
            RouteTable.Routes.Add(new Route("myfiles/directedit/{drive}/{*path}", new PageRouteHandler("~/myfiles/directedit.aspx")));
            RouteTable.Routes.Add(new Route("api/homework-upload/{teacher}/{name}/{start}/{end}/{drive}/{*path}", new Homework_UploadHandler()));
            RouteTable.Routes.Add(new Route("api/myfiles-permalink/{drive}/{*path}", new MyFiles_PermaLinkHandler()));
            RouteTable.Routes.Add(new Route("api/home-peramlink/{hash}", new Home_PermaLinkHandler()));
            WebServiceHostFactory factory = new WebServiceHostFactory();

            //RouteTable.Routes.Add(new ServiceRoute("api/livetiles", factory, typeof(HAP.Web.LiveTiles.API)));
            RouteTable.Routes.Add(new ServiceRoute("api/setup", factory, typeof(setup)));
            RouteTable.Routes.Add(new ServiceRoute("api/help", factory, typeof(Help)));
            RouteTable.Routes.Add(new ServiceRoute("api/announcement", factory, typeof(Announcement)));


            //load apis in the bin folder
            foreach (FileInfo assembly in new DirectoryInfo(HttpContext.Current.Server.MapPath("~/bin/")).GetFiles("*.dll").Where(fi => fi.Name != "HAP.Web.dll" && fi.Name != "HAP.Web.Configuration.dll" && !fi.Name.StartsWith("Microsoft")))
            {
                Assembly a = Assembly.LoadFrom(assembly.FullName);
                foreach (Type type in a.GetTypes())
                {
                    if (type.GetCustomAttributes(typeof(HAP.Web.Configuration.ServiceAPI), false).Length > 0)
                    {
                        RouteTable.Routes.Add(new ServiceRoute(((HAP.Web.Configuration.ServiceAPI)type.GetCustomAttributes(typeof(HAP.Web.Configuration.ServiceAPI), false)[0]).Name, factory, type));
                    }
                    if (type.GetCustomAttributes(typeof(HAP.Web.Configuration.HandlerAPI), false).Length > 0)
                    {
                        var instance = (IRouteHandler)Activator.CreateInstance(type);
                        RouteTable.Routes.Add(new Route(((HAP.Web.Configuration.HandlerAPI)type.GetCustomAttributes(typeof(HAP.Web.Configuration.HandlerAPI), false)[0]).Name, instance));
                    }
                }
            }

            RouteTable.Routes.Add(new Route("api", new api()));
        }
Exemple #15
0
        /// <summary>
        /// 获取类库下的所有的类名,并为他们增加映射
        /// </summary>
        /// <param name="className"></param>
        private void registerRoutes(string className)
        {
            WebServiceHostFactory webServiceHostFactory = new WebServiceHostFactory();

            try
            {
                var types = Assembly.Load(className).GetTypes();
                foreach (var type in types)
                {
                    AddRoute(webServiceHostFactory, type);
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
Exemple #16
0
        private void RegisterRoutes()
        {
            //RouteTable.Routes.Add(new ServiceRoute("TaskService",
            //    new WebServiceHostFactory(), typeof(TaskService)));

            WebServiceHostFactory securewebServiceHostFactory = new WebServiceHostFactory();

            RouteTable.Routes.Add(new ServiceRoute("api",
                                                   securewebServiceHostFactory, typeof(ExpertService)));

            RouteTable.Routes.Add(new ServiceRoute("distributionApi",
                                                   securewebServiceHostFactory, typeof(DistributionService)));

            RouteTable.Routes.Add(new ServiceRoute("hosApi",
                                                   securewebServiceHostFactory, typeof(HosService)));
        }
Exemple #17
0
        /// <summary>
        /// On Application Start
        /// </summary>
        protected void Application_Start(object sender, EventArgs e)
        {
            WebServiceHostFactory Factory = new WebServiceHostFactory();

            RouteTable.Routes.Add(new ServiceRoute("Services/Balances", Factory, typeof(Balances)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Containers", Factory, typeof(Containers)));
            RouteTable.Routes.Add(new ServiceRoute("Services/ChemCatCentral", Factory, typeof(ChemCatCentral)));
            RouteTable.Routes.Add(new ServiceRoute("Services/CISProNbtMobile", Factory, typeof(CISProNbtMobile)));
            RouteTable.Routes.Add(new ServiceRoute("Services/ConfigurationVariables", Factory, typeof(ConfigurationVariables)));
            RouteTable.Routes.Add(new ServiceRoute("Services/DemoData", Factory, typeof(DemoData)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Import", Factory, typeof(Import)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Inspections", Factory, typeof(Inspections)));
            RouteTable.Routes.Add(new ServiceRoute("Services/KioskMode", Factory, typeof(KioskMode)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Labels", Factory, typeof(Labels)));
            RouteTable.Routes.Add(new ServiceRoute("Services/LegacyMobile", Factory, typeof(LegacyMobile)));
            RouteTable.Routes.Add(new ServiceRoute("Services/LandingPages", Factory, typeof(LandingPages)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Locations", Factory, typeof(Locations)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Materials", Factory, typeof(Materials)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Menus", Factory, typeof(Menus)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Mol", Factory, typeof(Mol)));
            RouteTable.Routes.Add(new ServiceRoute("Services/NbtPublic", Factory, typeof(NbtPublic)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Nodes", Factory, typeof(Nodes)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Query", Factory, typeof(Query)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Quotas", Factory, typeof(Quotas)));
            RouteTable.Routes.Add(new ServiceRoute("Services/RegulatoryReporting", Factory, typeof(RegulatoryReporting)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Reports", Factory, typeof(Reports)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Requests", Factory, typeof(Requests)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Scheduler", Factory, typeof(Scheduler)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Session", Factory, typeof(Session)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Testing", Factory, typeof(Testing)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Trees", Factory, typeof(Trees)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Views", Factory, typeof(Views)));
            RouteTable.Routes.Add(new ServiceRoute("Services/BlobData", Factory, typeof(BlobData)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Modules", Factory, typeof(Modules)));
            RouteTable.Routes.Add(new ServiceRoute("Services/ViewEditor", Factory, typeof(ViewEditor)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Design", Factory, typeof(Design)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Search", Factory, typeof(Search)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Properties", Factory, typeof(Properties)));
            RouteTable.Routes.Add(new ServiceRoute("Services/Explorer", Factory, typeof(Explorer)));
            RouteTable.Routes.Add(new ServiceRoute("Services/ChemWatch", Factory, typeof(ChemWatch)));

            //Proof of concept for REST api:
            RouteTable.Routes.Add(new ServiceRoute("api", Factory, typeof(API)));
        }
        public void Configure()
        {
            var hostFactory = new WebServiceHostFactory();

            // TODO: Review before deployment. This allows for routes to not be added if the service is self hosted.
            if (HttpContext.Current == null)
            {
                return;
            }

            this.routes.Add(new ServiceRoute("broker", hostFactory, typeof(BrokerService)));
            this.routes.Add(new ServiceRoute("counterparty", hostFactory, typeof(CounterpartyService)));
            this.routes.Add(new ServiceRoute("exchange", hostFactory, typeof(ExchangeService)));
            this.routes.Add(new ServiceRoute("legalentity", hostFactory, typeof(LegalEntityService)));
            this.routes.Add(new ServiceRoute("location", hostFactory, typeof(LocationService)));
            this.routes.Add(new ServiceRoute("party", hostFactory, typeof(PartyService)));
            this.routes.Add(new ServiceRoute("partyrole", hostFactory, typeof(PartyRoleService)));
            this.routes.Add(new ServiceRoute("person", hostFactory, typeof(PersonService)));
            this.routes.Add(new ServiceRoute("sourcesystem", hostFactory, typeof(SourceSystemService)));
            this.routes.Add(new ServiceRoute("referencedata", hostFactory, typeof(ReferenceDataService)));
        }
        private void RegisterRoutes()
        {
            WebServiceHostFactory factory = new WebServiceHostFactory();

            RouteTable.Routes.Add(new ServiceRoute("members", factory, typeof(Controllers.Member)));
        }
Exemple #20
0
        private static void RegisterRoutes()
        {
            var factory = new WebServiceHostFactory();

            RouteTable.Routes.Add(new ServiceRoute("PHCSC", factory, typeof(PHCConnectorService)));
        }
Exemple #21
0
        private void RegisterRouters()
        {
            var factory = new WebServiceHostFactory();

            RouteTable.Routes.Add(new ServiceRoute("", factory, typeof(SensorService.Service)));
        }
Exemple #22
0
        private void RegisterRoutes()
        {
            var factory = new WebServiceHostFactory();

            RouteTable.Routes.Add(new ServiceRoute("DataFeed", factory, typeof(DataConnector)));
        }
Exemple #23
0
        private static void RegisterRoutes()
        {
            var factory = new WebServiceHostFactory();

            RouteTable.Routes.Add(new ServiceRoute("LicenceCheck", factory, typeof(BackEndService)));
        }
Exemple #24
0
 /// <summary>
 /// Builds a WebService from from a Custom Web Service Plugin.
 /// </summary>
 /// <param name="webServiceType">The custom web service type.</param>
 /// <param name="attribute">The CustomWebServiceAttribute applied to the custom web service type. Uses CustomWebServiceAttribute.ServiceRoute or CustomWebServiceAttribute.Entity to determine the route.</param>
 /// <param name="factory">The WebServiceHostFactory, which is by default the Rhyous.WebFramework.Behaviors.RestWebServiceHostFactory.</param>
 /// <param name="routeCollection">The route collection to update. It is RouteTable.Routes static by default.</param>
 public static void BuildWebService(Type webServiceType, CustomWebServiceAttribute attribute, WebServiceHostFactory factory = null, RouteCollection routeCollection = null)
 {
     if (!string.IsNullOrWhiteSpace(attribute.ServiceRoute))
     {
         BuildWebService(webServiceType, attribute.ServiceRoute, factory, routeCollection);
     }
     else if (attribute.Entity != null)
     {
         BuildWebService(webServiceType, $"{attribute.Entity.Name}Service.svc", factory, routeCollection);
     }
     else
     {
         throw new Exception("Either CustomWebServiceAttribute.ServiceRoute or CustomWebServiceAttribute.Entity must be set.");
     }
 }
Exemple #25
0
        private void registerRoautes()
        {
            var factory = new WebServiceHostFactory();

            RouteTable.Routes.Add(new ServiceRoute("RestService", factory, typeof(wcfLibrary.service)));
        }
        private void RegisterRoutes()
        {
            WebServiceHostFactory factory = new WebServiceHostFactory();

            RouteTable.Routes.Add(new ServiceRoute("Wsdl", factory, typeof(WsdlService)));
        }