There are two ways to deploy an already developed Javascript file.
Direct Deployment
Just like a Web server such as Apache, which publishes HTML and other Web content from a local directory to the Web, the 'Javascript Service Hosting' feature takes a .js
file placed in the local directory at location <PRODUCT_HOME>\repository\deployment\server\jsservices
and exposes the functions in the .js
file as Web Service operations.
The product’s Management Console can also be used to upload a Javascript service.
Deployment Using the Management Console
1. Log on to the product's Management Console and select "Upload" under "Mashup Service."
2. The "Upload Javascript Services" window opens. Browse the .zip file and click "Upload." The .zip
file can contain JavaScript, HTML, images and other files related to the service.
3. If the file is successfully uploaded, a message appears.
4. User is navigated to the "Deployed Services" page where the uploaded Javascript file is listed. For example,
- If the service is not displayed immediately, refresh the "Deployed Services" window after a few seconds.
- If the service is not successfully deployed, it should appear as a faulty service. To access faulty services, click the "Faulty Service Groups" link, which appears in red on the "Deployed Services" window.
From the "Deployed Services" window, you can manage your service and access its dashboard. For instructions, refer to section Service Management.
Adding a Service Interface
When a service is deployed, the Carbon server automatically creates a folder to store the resources that belong to the service. This folder is named as "{service javascript file name}.resources". You can install a custom user interface for your service by creating a folder named "www" under the resources folder mentioned before and placing the necessary files under the created "www" folder.
This user interface will appear when you point your browser to the Endpoint Reference of the service: http://<your-machine-ip>:<server port>/services/<service name>.