Services loaded OMS Server share the same base url as specified in appSettings.config.
appSettings.config.
<!-- This is base url that all services will be created on --> <add key="BaseUrl" value="<http://test-app-01:8080/"> />
It is possible to have custom services loaded using other custom urls. This is done by configuring those services in services.json similar to this:
services.json
{ "Definitions": [ { "Id": "AccountServiceHttps", "Url": "https://test-app-01:8081/AccountServiceHttps.svc" } , { "Id": "PortfolioServiceHttps", "Url": "https://test-app-01:8081/PortfolioServiceHttps.svc" } ] }
The services.json file in placed under the the Config/Services folder of the appropriate server.
Service Definitions
The spring definitions can be placed in ServiceDefinitions.config or Services.config or CustomServices.config.
<?xml version="1.0" encoding="utf-8"?> <objects xmlns="http://www.springframework.net" xmlns:db="http://www.springframework.net/database" xmlns:nms="http://www.springframework.net/nms" xmlns:tx="http://www.springframework.net/tx"> <object id="AccountServiceHttps" type="Kodi.Kodiak.Services.AccountService, Kodi.Kodiak.Allocations" singleton="false" scope="session"> <property name="AccountServiceImplementation" ref="AccountServiceImplementation"/> </object> <object id="PortfolioServiceHttps" singleton="false" type="Kodi.Kodiak.Services.PortfolioService, Kodi.Kodiak.Allocations" scope="request"> <property name="PortfolioServiceImplementation" ref="PortfolioServiceImplementation"/> </object> </objects>
app.config (ie: Kodi.Kodiak.WindowsServices.OrderEntryServer.exe.config or similar)
This spring definitions file needs to be defined as a resource in the appropriate app.config file.
<spring> <context> <!--Points to the objects path of the spring config (see below)--> <!-- COMMON --> ... <resource uri="~/Config/ServiceConfig/Services.config" /> <resource uri="~/Config/ServiceConfig/CustomServices.config" /> <resource uri="~/Config/ServiceConfig/ServiceDefinitions.config" />
system.servicemodel.services.config
<service behaviorConfiguration="HttpsBehaviour" name="AccountServiceHttps"> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpsBinding" contract="Kodi.Kodiak.Services.ServiceContracts.IAccountService" /> </service> <service behaviorConfiguration="HttpsBehaviour" name="PortfolioServiceHttps"> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpsBinding" contract="Kodi.Kodiak.Services.ServiceContracts.IPortfolioService" /> </service>
Binding
The WSHttpsBinding needs to definied in the corresponding system.servicemodel.bindings.config file.
..... <wsHttpBinding> .... <binding name="WSHttpsBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"> <readerQuotas maxDepth="2147483646" maxStringContentLength="2147483646" maxArrayLength="2147483646" maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="Transport"> <transport clientCredentialType="Windows" /> </security> </binding> </wsHttpBinding>
Behavior
The certificate hash needs to be difined in the corresponding system.servicemodel.behaviors.config file.
<serviceCertificate storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" findValue="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
Where the value in findValue attribute is the Certificate Hash of the certificate.
<?xml version="1.0" encoding="utf-8" ?> <behaviors> <serviceBehaviors> <behavior name="HttpsBehaviour"> <dataContractSerializer maxItemsInObjectGraph="2147483647" /> <serviceAuthorization principalPermissionMode="Custom"> <authorizationPolicies> <add policyType="Kodi.Kodiak.Security.AuthorizationPolicy, Kodi.Kodiak.Security" /> </authorizationPolicies> </serviceAuthorization> <serviceCredentials> <serviceCertificate storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" findValue="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/> </serviceCredentials> <serviceDebug includeExceptionDetailInFaults="true" /> <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" /> </behavior>
Important:
To enable the use of ssl on the specifed port, in this case 8081 the following script needs to be run as an administrator on the machine.
netsh http add sslcert ipport=0.0.0.0:8081 certhash=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX appid={12345678-1234-1234-1234-123456789013}