Deploying the iHub REST service
The iHub installation includes the iHub REST service, which runs by default. You can deploy the iHub REST service on a separate node or machine from iHub. A web browser can send REST requests to iHub using the separate REST service or the REST service installed with iHub, as shown in Figure 15‑6.
Figure 15‑6 Embedded and separate REST deployments
How to set up the REST service on a separate Windows node or machine
To deploy the iHub REST service on a separate machine, perform the following steps.
1 Copy the RESTAPI directory and its contents from a machine on which iHub is installed to the separate node or machine. This directory is located in the following path:
<iHub installation folder>\modules\BIRTiHub\iHub
2 Update configuration settings in the constants.js configuration file located at:
RESTAPI\server\config
1 Use a text editor to open the constants.js configuration file.
2 Set the values of the following parameters:
*Set the value of the WSDL_PATH parameter to the path to the REST API WSDL definition file:
<RESTAPI deployment folder>/server/wsdl.xml
*Set the value of the HOST_NAME parameter to the host name server where the REST service is deployed.
*Set the value of LOG_FILE to the name of a file to which the REST application has write access.
*Set the value of TMP_DIR to the name of a folder to which the REST application has write access.
*To support HTTPS, set the values of HTTPS_CERT_LOCATION and HTTPS_KEY_LOCATION to the certificate and key files respectively and set the value of USEHTTPS to true.
3 Save and close constants.js. constants.js then looks like the example in the following code:
module.exports = Object.freeze({
WSDL_PATH: "C:/myserver/iHub/RESTAPI/server/wsdl.xml",
HOST_NAME: "myserver.mycompanyname.com",
HTTP_PORT: 5000,
HTTPS_PORT: 5010,
LOG_FILE: 'C:/myserver/iHub/RESTAPI/server/logs/app.log',
HTTPS_CERT_LOCATION: "C:/myserver/shared/config
/credentials/birtihub.crt",
HTTPS_KEY_LOCATION: "C:/myserver/shared/config
/credentials/birtihub.key",
TMP_DIR: "C:/myserver/iHub/RESTAPI/server/tmp/",
...
3 Update configuration settings in the wsdl.xml configuration file located at:
RESTAPI/server
1 Use a text editor to open the wsdl.xml configuration file.
2 Locate the definition of the ActuateAPI service, which starts with the following line:
<service name="ActuateAPI">
3 Set the value of the location attribute for the ActuateSoapPort parameter. Specify the host name of the iHub server to which the REST service connects. Specify the communication port used for HTTP communication, as shown in the following lines:
<port name="ActuateSoapPort" binding="wsdlns:ActuateSoapBinding">
<soap:address
location="http://myserver.mycompanyname.com:8000"/>
4 Set the value of the location attribute for the ActuateSoapSSLPort parameter. Specify the host name of the iHub server to which the REST service connects. Specify the communication port used for HTTPS communication, as shown in the following lines:.
<port name="ActuateSoapSSLPort" binding="wsdlns:ActuateSoapBinding">
<soap:address
location="https://myserver.mycompanyname.com:8001"/>
5 Save and close wsdl.xml. The definition of the ActuateAPI service in wsdl.xml looks like the following code:
<service name="ActuateAPI">
<port name="ActuateSoapPort" binding="wsdlns:ActuateSoapBinding">
<soap:address
location="http://myserver.mycompanyname.com:8000"/>
</port>
<port name="ActuateSoapSSLPort" binding="wsdlns:ActuateSoapBinding">
<soap:address
location="https://myserver.mycompanyname.com:8001"/>
</port>
</service>
How to start the REST service on a separate Windows node or machine
To enable the service to respond to REST requests, start the server component using the node command.
1 Append the folder containing the node executable file to the PATH environment variable:
1 From the Windows Start menu, choose Control Panel.
2 Choose System.
3 In System, choose Advanced System Settings.
4 In System Properties, choose Advanced.
5 Choose Environment Variables.
6 In System Variables, select Path. Choose Edit.
7 In Edit System Variable, at the end of the existing Variable value, type a semi-colon (;) followed by the path to the RESTAPI\NodeJS folder. For example, type the following text:
;C:\myApps\RESTAPI\server\NodeJS
In Edit System Variable, choose OK. In Environment Variables, choose OK.
2 Open a command window and navigate to the RESTAPI\server folder.
3 Type the following command and then press Enter:
node app.js
The REST server starts and receives HTTP requests on TCP port 5000 and HTTPS requests on TCP port 5010. The REST server forwards requests to TCP port 8000 on the iHub server.
4 On Windows, to provide access to the REST API from another system, use the Windows Firewall advanced settings to open the ports 5000 and 5010 to TCP inbound traffic.