 ------------------------
| Soa OI RefClient Notes |
 ------------------------


Purpose
-------
Sample Java Swing application used to demonstrate the use of web services to interact with CCT.
Client uses web services to 1) invoke functionality on CCT and 2) receive notifications/events from CCT.


Prerequisites to running the RefClient
--------------------------------------
JRE 8.x installed as default
Run "java -version" at the command prompt to verify this


Running the RefClient with the default Notification Port
--------------------------------------
Navigate to where the installation and run RefClient.bat at the command prompt as follows:
D:\RefClient>RefClient.bat


Running the RefClient with a user-defined Notification Port
--------------------------------------
As mentioned above, the receipt of events from CCT is facilitated through web services 
i.e. the RefClient publishes a web service which is called by the server when an event
fires that the Client has registered/subscribed for. 

The publication of the Notification service occurs on startup, even before any login has taken place.

By default the application will automatically acquire an unused port to publish the notification service on. 
However, there exists the option for the client to specify a particular port by supplying the port number
as a parameter to the RefClient.bat file as follows:

D:\RefClient>RefClient.bat 1234

...where 1234 is the port number supplied as a parameter

This will result in the following web service being published
(For this example assume client's ip is "47.166.133.63"):
http://47.166.133.63:1234/SOAOICCT/services/NotificationConsumer

Running the RefClient in the https mode
--------------------------------------
The purpose of this section is to explain how to configure the SOA OI RefClient to use TLS. There is 
a section in the document "Avaya Aura Contact Center SIP Commissioning (NN44400-511)" 
named "Certificate Authority" which describes the process of configuring a standalone certificate authority 
and generating certificates. There is also a section in the document "Avaya Aura Contact Center
Commissioning (NN44400-312)" named "Communication Control Toolkit Web service configuration" which 
describes the process of configuring the server side of the Web services to use TLS. The following 
assumes the reader has already configured the Web services with the correct certificate.

Prerequisites:
1. Web services configured to use TLS
2. An exported root certificate of the Certificate Authority

Steps:
1. Copy the root certificate to the folder D:\Avaya\Contact Center\CCT\OI_RefClient\config.soa.client
2. Make sure the file trustedCA.keystore is present in the folder D:\Avaya\Contact Center\CCT\OI_RefClient\config.soa.client
3. Open the command prompt and cd to D:\Avaya\Contact Center\CCT\OI_RefClient\config.soa.client. 
4. Execute the following command "keytool -import -alias root1 -keystore trustedCA.keystore 
-file <name of the root certificate>". Enter 123123 as the passphrase. Enter "yes" to confirm adding 
the root certificate to the trusted certificates. If "keytool" is not recognized as a command find it 
in <JRE folder>\bin and run with the full path.  
5. Run the SOA OI RefClient. At this moment there are two files in the directory config.soa.client SecureClient.cxf 
and SecureClient.cxf_https. Go to Preferences --> Server. Enter the name of the server you are connecting to 
(not the IP, the root certificate is bound to the name) and switch to https. The ref client will exit after 
the change is made. After that there are two files in the folder config.soa.client SecureClient.cxf 
and SecureClient.cxf_http. SecureClient.cxf has been renamed to SecureClient.cxf_http and 
SecureClient.cxf_https has been renamed to SecureClient.cxf. The ref client renames these files automatically 
depending on the mode used http or https.
6. In order to make the SOA OI RefClient accept not only connections with a trusted certificate but also 
from specific computers only (where the Web services are hosted) the file SecureClient.cxf needs to be edited. Find the section 
<http:conduit name="*.http-conduit">
If you want to be able to connect to any host change it to
<http:conduit name=".*">
If you want to make sure you are connected to the right server you can place a restriction on the name 
of the server you are connecting to. In order to do that put the regular expression pattern 
in the name of the conduit for example
<http:conduit name="https://server1/.*"> - with this conduit the client will connect not only to the server 
with a trusted certificate but also with the name "server1". Please note that it is not enough for the pattern 
to contain the actual link the pattern must match the link. If you want to be able to connect 
to two or more servers please add a conduit for every server. 
7. Now the SOA OI RefClient is ready to connect over TLS