The Dialog starter application in Java is a sample that demonstrates how the IBM Watson Dialog service works in a specific context.
**This application requires a dialog file to be preloaded. You can use the** [dialog-tool](https://github.com/watson-developer-cloud/dialog-tool) **to create a dialog.**Give it a try! Click the button below to fork into IBM DevOps Services and deploy your own copy of this application on Bluemix.
-
Create a Bluemix account. Sign up in Bluemix or use an existing account. Watson services in beta are free to use.
-
Download and install the Cloud-foundry CLI tool.
-
Edit the
manifest.yml
file and replace<application-name>
with a unique name for your copy of the application. The name that you specify determines the application's URL, such as<application-name>.mybluemix.net
.
```none
applications:
- services:
- dialog-service
name: <application-name>
path: webApp.war
memory: 512M
```
- Connect to Bluemix by running the following commands in the command-line tool:
```sh
$ cf api https://api.ng.bluemix.net
$ cf login -u <your-Bluemix-ID>
```
- Create the Dialog service in Bluemix by running the following command:
```sh
$ cf create-service dialog standard dialog-service
```
-
Download and install the ant compiler.
-
Build the project by running the following command:
```sh
$ ant
```
You must use the Apache `ant` compiler to build the Java application. For information about the `ant` compiler and to download a copy for your operating system, visit ant.apache.org.
- Push it live by running the following command:
```sh
$ cf push -p output/webApp.war
```
- Add your
DIALOG_ID
and restage the app:
```sh
$ cf se <application-name> DIALOG_ID <dialog-id>
$ cf restage <application-name>
```
The application uses the WebSphere Liberty profile runtime as its server, so you must download and install the profile as part of the following steps.
- Copy the
username
,password
, andurl
credentials from yourdialog-service
service in Bluemix toDemoServlet.java
. To see the credentials, run the following command, where<application-name>
is the unique name you specified:
```sh
$ cf env <application-name>
```
The following example shows credentials for the Dialog service:
```sh
System-Provided:
{
"VCAP_SERVICES": {
"dialog": [{
"credentials": {
"url": "<url>",
"password": "<password>",
"username": "<username>"
},
"label": "dialog",
"name": "dialog-service",
"plan": "standard"
}]
}
}
```
-
Install the Liberty profile runtime (If you are using Mac OS X, see this guide).
-
Create a Liberty profile server in Eclipse.
-
Add the application to the server.
-
Start the server.
-
Open
http://localhost:9080/app/
to see the running application.
To troubleshoot your Bluemix application, the most useful source of information is the log files. To see them, run the following command:
$ cf logs <application-name> --recent
This sample code is licensed under Apache 2.0. Full license text is available in LICENSE.
This sample uses jQuery which is licensed under MIT.
See CONTRIBUTING.
Find more open source projects on the IBM Github Page.