Custom Services with different url (https)

Services loaded OMS Server share the same base url as specified in appSettings.config.

 

Url access control

It may be necessary to give the running user access to listen on a specific url. This can be done with a command similar to:

netsh http add urlacl url=http://*:$PORT/ user=$domain\$name

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.

system.servicemodel.services.config

Binding

The WSHttpsBinding needs to definied in the corresponding system.servicemodel.bindings.config file.

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.

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.