Beispiel #1
0
 /// <summary>Hosts a Basic HTTP service</summary>
 /// <param name="serviceType">Type of the service.</param>
 /// <param name="contractType">Type of the contract.</param>
 /// <param name="serviceId">The service id.</param>
 /// <param name="messageSize">Size of the message.</param>
 /// <param name="exposeWsdl">if set to <c>true</c> a WSDL endpoint is exposed.</param>
 /// <param name="baseAddress">The base address.</param>
 /// <param name="basePath">The base path.</param>
 /// <param name="extension">The extension.</param>
 /// <param name="useHttps">Indicates whether HTTPS should be used</param>
 public void AddServiceHostBasicHttp(Type serviceType, Type contractType = null, string serviceId = null, MessageSize messageSize = MessageSize.Undefined, bool exposeWsdl = false, string baseAddress = null, string basePath = null, string extension = null, bool useHttps = false)
 {
     Execute(
         () => ServiceGarden.AddServiceHostBasicHttp(serviceType, contractType, serviceId, messageSize, exposeWsdl, baseAddress, basePath, extension, useHttps),
         url => AddServiceInfo(serviceType, contractType, url, "Basic HTTP", ServiceGarden.GetHostByEndpointAddress(url))
         );
 }
Beispiel #2
0
 /// <summary>
 /// Adds another service to the list of hosted services
 /// </summary>
 /// <param name="serviceType">Type of the service.</param>
 /// <param name="contractType">Type of the contract.</param>
 /// <param name="serviceId">The service id.</param>
 /// <param name="exposeWsdl">if set to <c>true</c> [expose WSDL].</param>
 public void AddServiceHostBasicHttp(Type serviceType, Type contractType, string serviceId, bool exposeWsdl)
 {
     Execute(
         () => ServiceGarden.AddServiceHostBasicHttp(serviceType, contractType, serviceId, exposeWsdl),
         url => AddServiceInfo(serviceType, contractType, url, "Basic HTTP", ServiceGarden.GetHostByEndpointAddress(url))
         );
 }
Beispiel #3
0
 /// <summary>
 /// Adds another service to the list of hosted services
 /// </summary>
 /// <param name="serviceType">Type of the service.</param>
 /// <param name="exposeWsdl">if set to <c>true</c> [expose WSDL].</param>
 public void AddServiceHostBasicHttp(Type serviceType, bool exposeWsdl)
 {
     Execute(
         () => ServiceGarden.AddServiceHostBasicHttp(serviceType, exposeWsdl),
         url => AddServiceInfo(serviceType, serviceType.GetInterfaces()[0], url, "Basic HTTP", ServiceGarden.GetHostByEndpointAddress(url))
         );
 }
Beispiel #4
0
 /// <summary>Adds a new REST service using JSON data format</summary>
 /// <param name="serviceType">Type of the service.</param>
 /// <param name="contractType">Type of the contract.</param>
 /// <param name="serviceId">The service id.</param>
 /// <param name="messageSize">Size of the message.</param>
 /// <param name="baseAddress">The base address.</param>
 /// <param name="basePath">The base path.</param>
 /// <param name="extension">The extension.</param>
 /// <param name="useHttps">Indicates whether HTTPS should be used</param>
 public void AddServiceHostRestJson(Type serviceType, Type contractType = null, string serviceId = null, MessageSize messageSize = MessageSize.Undefined, string baseAddress = null, string basePath = null, string extension = null, bool useHttps = false)
 {
     Execute(
         () => ServiceGarden.AddServiceHostRestJson(serviceType, contractType, serviceId, messageSize, baseAddress, basePath, extension, useHttps),
         url => AddServiceInfo(serviceType, contractType, url, "REST HTTP (JSON)", ServiceGarden.GetHostByEndpointAddress(url))
         );
 }
Beispiel #5
0
        /// <summary>Adds a TCP/IP (net.tcp) service host</summary>
        /// <param name="serviceType">Type of the service.</param>
        /// <param name="contractType">Type of the contract.</param>
        /// <param name="serviceId">The service id.</param>
        /// <param name="messageSize">Size of the message.</param>
        public void AddServiceHostNetTcp(Type serviceType, Type contractType = null, string serviceId = null, MessageSize messageSize = MessageSize.Undefined)
        {
            var port = _basePort;

            _basePort++;
            Execute(
                () => ServiceGarden.AddServiceHostNetTcp(serviceType, contractType, serviceId, messageSize, port),
                url => AddServiceInfo(serviceType, contractType, url, "Net.Tcp", ServiceGarden.GetHostByEndpointAddress(url))
                );
        }
Beispiel #6
0
        /// <summary>
        /// Enables cross-domain service access
        /// </summary>
        /// <param name="domain">The root domain the call is valid for.</param>
        /// <param name="allowedCallers">Allowed caller domains (URLs).</param>
        /// <returns>URL of the hosted policy</returns>
        /// <remarks>
        /// Cross-access domain calling is of particular importance for Silverlight clients.
        /// Note that the allowed callers are shared across all root domains if this method is called multiple times
        /// to enable different root domains. (This means that the service garden hosts service calls who's endpoints
        /// are on different domains, which rarely happens).
        /// </remarks>
        /// <example>
        /// // Enables all cross domain calls to the specified domain
        /// // from the specified domains
        /// var host = new TestServiceHost();
        /// host.AllowCrossDomainCalls(
        ///     new Uri("www.epsservices.net"),
        ///     new Uri[] {new Uri("www.eps-software.com"), new Uri("www.Microsoft.com")}
        ///     );
        /// </example>
        public void AllowSilverlightCrossDomainCalls(Uri domain, Uri[] allowedCallers)
        {
            var policyUrl = ServiceGarden.AllowSilverlightCrossDomainCalls(domain, allowedCallers);

            listView1.Items.Add(new ListViewItem(new[] { "Cross-Domain Access Policy", "Started", policyUrl, "HTTP-GET", "n/a", "n/a" })
            {
                ImageIndex = 0,
                Tag        = new ServiceInfoWrapper
                {
                    Protocol = "HTTP-GET",
                    Url      = policyUrl,
                    Port     = 80
                }
            });
        }
Beispiel #7
0
 /// <summary>Enables cross-domain service access for HTTP-based callers (such as JavaScript)</summary>
 /// <param name="allowedCallers">Allowed caller domains (URLs or *).</param>
 /// <returns>True if successful</returns>
 /// <remarks>
 /// This works by adding a cross-domain call HTTP header to service responses, which is used by browsers to check if these calls should be allowed.
 /// Note that this is for JavaScript clients and this is different from the Silverlight cross domain calls (AllowCrossDomainCalls)
 /// </remarks>
 /// <example>
 /// // Enables all cross domain calls to the specified domain
 /// // from the specified domains
 /// host.AllowHttpCrossDomainCalls("www.eps-software.com");
 /// </example>
 public bool AllowHttpCrossDomainCalls(string allowedCallers)
 {
     return(ServiceGarden.AllowHttpCrossDomainCalls(allowedCallers));
 }