Appboard/2.4/builder/data sources/web service
There are several web service data adapters available to choose from in AppBoard: CSV WebService, JSON WebService, and XML XSLT. As each type of data adapter will require different information to connect to AppBoard, this page will assist you in understanding some of the specific options associated with web service data adapters.
CSV WebService
This is a web services adapter that uses CSV to communicate with an application server.
Connecting with CSV WebService
The Data Source Wizard begins with the "Connect" step. Here you must fill in the necessary information to connect AppBoard to your CSV WebService data source. These are the possible elements you will need to provide:
Name | Description |
---|---|
url | Base URL for the web service from which to fetch data. This can also be the complete URL, if you want to include any needed parameters here instead of as separate settings. |
httpAuthUsername | Username to use for HTTP Auth (Basic, Digest, etc.). Ignored if HTTP Auth is not needed. |
httpAuthPassword | Password to use for HTTP Auth (Basic, Digest, etc.). Ignored if HTTP Auth is not needed. |
cacheTimeout | Time limit before reloading results from the database. |
httpHeaders | Optional HTTP headers to set on request. |
httpPostBody | Optional POST body to send with request. If set, the request will be made via a POST; if not, the HTTP request will be a GET request. |
headerLine | Whether the data includes a header to define the columns/field names. |
delimiter.data | Whether the data includes a delimiter to define the columns/field names. |
useQuoteChar | Whether the data fields should be written within quotes. |
proxyurl | Optional URL for web proxy. |
proxyuser | Optional Proxy Username. |
proxypass | Optional Proxy Password. |
proxyntlm | Optional Proxy NT Domain. |
proxydomain | Optional Use NTLM Auth for Proxy. |
JSON WebService
This is a web services adapter that uses Javascript, rather than XML, to communicate with an application server.
Connecting with JSON WebService
The Data Source Wizard begins with the "Connect" step. Here you must fill in the necessary information to connect AppBoard to your JSON WebService data source. These are the possible elements you will need to provide:
Name | Description |
---|---|
url | Base URL for the web service from which to fetch data. This can also be the complete URL, if you want to include any needed parameters here instead of as separate settings. |
httpAuthUsername | Username to use for HTTP Auth (Basic, Digest, etc.). Ignored if HTTP Auth is not needed. |
httpAuthPassword | Password to use for HTTP Auth (Basic, Digest, etc.). Ignored if HTTP Auth is not needed. |
cacheTimeout | Time limit before reloading results from the database. |
httpHeaders | Optional HTTP headers to set on request. |
httpPostBody | Optional POST body to send with request. If set, the request will be made via a POST, if not, the HTTP request will be a GET request. |
proxyurl | Optional URL for web proxy. |
proxyuser | Optional Proxy Username. |
proxypass | Optional Proxy Password. |
proxyntlm | Optional Proxy NT Domain. |
proxydomain | Optional Use NTLM Auth for Proxy. |
Proper JSON File Formatting
In JSON files, square brackets "[]" indicate arrays, curly braces "{}" indicate objects, and fields are defined by "key":value, where value can be a string, number, boolean, array, or object.
The following formats are accepted:
- An array of objects (see the example data.json)
- An object that contains an array of objects (see services.json)
- An object containing a variety of "key":value fields, with the fields consisting of strings, numbers, boolean values, arrays, or objects (see glossary.json, person.json, and widget.json).
If the file is an array of objects (e.g. data.json) or an object that contains an array of objects (e.g. services.json), it is recommended that each object within that array have a consistent set of "keys". Changing the number of keys or using different keys from one object to the next within the array may adversely affect the parsing of the data.
For example, do not do:
{ "people" : [
{ "name" : "John Doe",
"height" : "5ft 11in",
"weight" : "150 lbs",
"age" : 22,
"Job" : "Police Officer" }
{ "name" : "Jane Doe",
"height" : "5ft 6in",
"age" : 19,
"Occupation" : "Student" }
]
}
Notice that "Jane Doe" does not have a "weight" key and has an "Occupation" key instead of "Job". If certain information cannot be provided for a particular object but it can for another, then it is recommended that for the object without said information, include the key but give it an empty value. Remember to keep the keys consistent.
i.e., do the following:
{ "people" : [
{ "name" : "John Doe",
"height" : "5ft 11in",
"weight" : "150 lbs",
"age" : 22,
"Job" : "Police Officer" }
{ "name" : "Jane Doe",
"height" : "5ft 6in",
"weight" : "",
"age" : 19,
"Job" : "Student" }
]
}
Lastly, the following format has been known to cause parsing issues:
{ "key1" : value, (string/number/boolean)
"key2" : value, (string/number/boolean)
...
"keyN" : value, (string/number/boolean)
"arrayOrObjectKey" : [ (or "arrayOrObjectKey" : {)
...
] (or })
...
}
Notice the "key" : value pairs (that are string, number, or boolean) preceding the array or object. The parser is known to have issues with this style of formatting and it is therefore recommended that the "key" : value pairs are encapsulated within a named object.
i.e.:
{ "namedObject" : {
"key1" : value, (string/number/boolean)
"key2" : value, (string/number/boolean)
...
"keyN" : value, (string/number/boolean)
"arrayOrObjectKey" : [ (or "arrayOrObjectKey" : {)
...
] (or })
...
}
}
XML XSLT
This adapter lets you get data from an XML web service and transform it into records that are in a format applicable to AppBoard.
Connecting with XML XSLT
The Data Source Wizard begins with the "Connect" step. Here you must fill in the necessary information to connect AppBoard with your XML XSLT data source. These are the possible elements you will need to provide:
Name | Description |
---|---|
url | This is the location of the information file used for your data source. Included in the distribution are some sample xml files which can be accessed by using the 'file://' url. For example, on windows it would look like 'file://localhost/${application.home}/data/pkg/sample/atlas/atlas.xml' and on UNIX it would look like: 'file://${application.home}/data/pkg/sample/atlas/atlas.xml'. Please see http://en.wikipedia.org/wiki/File_URI_scheme for more details on using file:// urls; although you will normally be using http:// to reference the RESTful WebService. |
stylesheetPath | The path from '${application.home}/stylesheets/' of the XSL stylesheet to be used to convert the data from the web service into the AppBoard internal XML representation. |
httpAuthUsername | Username to use for HTTP Auth (Basic, Digest, etc.). Ignored if HTTP Auth is not required. |
httpAuthPassword | Password to use for HTTP Auth (Basic, Digest, etc.). Ignored if HTTP Auth is not required. |
cacheTimeout | Time limit before re-loading results from the RESTful web service. Note: if a timeout is not specified, it will calculate the timeout based on the timeout specfied by the response header. If the request should be run on every request, then a value of '0' should be specified. |
httpHeaders | Optional HTTP headers to set on request. |
httpPostBody | Optional POST body to send with request. If set, the request will be made via a POST; if not, the HTTP request will be a GET request. |
proxyurl | Optional URL for web proxy. |
proxyuser | Optional Proxy Username. |
proxypass | Optional Proxy Password. |
proxyntlm | Optional Proxy NT Domain. |
proxydomain | Optional Use NTLM Auth for Proxy. |