| 1 | .. _client-what: |
|---|
| 2 | |
|---|
| 3 | What is ZOO-Client ? |
|---|
| 4 | ========================= |
|---|
| 5 | |
|---|
| 6 | ZOO-Client is a client-side JavaScript API which provides simple methods |
|---|
| 7 | for interacting with `WPS <http://www.opengeospatial.org/standards/wps/>`__ server from web |
|---|
| 8 | applications. It is helpful for sending requests to any WPS compliant |
|---|
| 9 | server (such as :ref:`kernel_index`) and to parse the output responses |
|---|
| 10 | using simple JavaScript. |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | JavaScript |
|---|
| 14 | ------------------------------- |
|---|
| 15 | |
|---|
| 16 | ZOO-Client relies on modern JavaScript libraries and can be seamlessly |
|---|
| 17 | integrated in new or existing web platforms or applications. ZOO-Client works by expanding the tags available in WPS specific |
|---|
| 18 | templates using values provided by a JavaScript hash or object. It |
|---|
| 19 | allows to build valid WPS requests and to send them to a WPS server. It |
|---|
| 20 | also provides functions to easily parse and reuse the output XML |
|---|
| 21 | responses. Read the :ref:`next section <client-howto>` to get started. |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | Templates |
|---|
| 25 | ------------------------------- |
|---|
| 26 | |
|---|
| 27 | ZOO-Client uses logic-less `Mustache <http://mustache.github.io/>`__ |
|---|
| 28 | templates for creating well-formed WPS requests. Templates are called |
|---|
| 29 | *logic-less* because they do not contain any *if* statements, *else* |
|---|
| 30 | clauses, or *for* loops, but only **tags**. Some tags are dynamically replaced by a |
|---|
| 31 | value or a series of values. |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | GetCapabilities |
|---|
| 35 | .......................................................... |
|---|
| 36 | |
|---|
| 37 | *GetCapabilities* requests are created using the following template: |
|---|
| 38 | |
|---|
| 39 | :: |
|---|
| 40 | |
|---|
| 41 | <wps:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 ../wpsGetCapabilities_request.xsd" language="{{language}}" service="WPS"> |
|---|
| 42 | <wps:AcceptVersions> |
|---|
| 43 | <ows:Version>1.0.0</ows:Version> |
|---|
| 44 | </wps:AcceptVersions> |
|---|
| 45 | </wps:GetCapabilities> |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | DescribeProcess |
|---|
| 49 | .......................................................... |
|---|
| 50 | |
|---|
| 51 | *DescribeProcess* requests are created using the following template: |
|---|
| 52 | |
|---|
| 53 | :: |
|---|
| 54 | |
|---|
| 55 | <DescribeProcess xmlns="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 ../wpsDescribeProcess_request.xsd" service="WPS" version="1.0.0" language="{{language}}"> |
|---|
| 56 | {{#identifiers}} |
|---|
| 57 | <ows:Identifier>{{.}}</ows:Identifier> |
|---|
| 58 | {{/identifiers}} |
|---|
| 59 | </DescribeProcess> |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | Execute |
|---|
| 63 | .......................................................... |
|---|
| 64 | |
|---|
| 65 | *Execute* requests are created using a more complex template, as shown bellow: |
|---|
| 66 | |
|---|
| 67 | :: |
|---|
| 68 | |
|---|
| 69 | <wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0../wpsExecute_request.xsd" language="{{language}}"> |
|---|
| 70 | <!-- template-version: 0.21 --> |
|---|
| 71 | <ows:Identifier>{{Identifier}}</ows:Identifier> |
|---|
| 72 | <wps:DataInputs> |
|---|
| 73 | {{#DataInputs}} |
|---|
| 74 | {{#is_literal}} |
|---|
| 75 | <wps:Input> |
|---|
| 76 | <ows:Identifier>{{identifier}}</ows:Identifier> |
|---|
| 77 | <wps:Data> |
|---|
| 78 | <wps:LiteralData{{#dataType}} dataType="{{dataType}}"{{/dataType}}>{{value}}</wps:LiteralData> |
|---|
| 79 | </wps:Data> |
|---|
| 80 | </wps:Input> |
|---|
| 81 | {{/is_literal}} |
|---|
| 82 | {{#is_bbox}} |
|---|
| 83 | <wps:Input> |
|---|
| 84 | <ows:Identifier>{{identifier}}</ows:Identifier> |
|---|
| 85 | <wps:Data> |
|---|
| 86 | <wps:BoundingBoxData ows:crs="{{crs}}" ows:dimensions="{{dimension}}"> |
|---|
| 87 | <ows:LowerCorner>{{lowerCorner}}</ows:LowerCorner> |
|---|
| 88 | <ows:UpperCorner>{{upperCorner}}</ows:UpperCorner> |
|---|
| 89 | </wps:BoundingBoxData> |
|---|
| 90 | </wps:Data> |
|---|
| 91 | </wps:Input> |
|---|
| 92 | {{/is_bbox}} |
|---|
| 93 | {{#is_complex}} |
|---|
| 94 | {{#is_reference}} |
|---|
| 95 | {{#is_get}} |
|---|
| 96 | <wps:Input> |
|---|
| 97 | <ows:Identifier>{{identifier}}</ows:Identifier> |
|---|
| 98 | <wps:Reference xlink:href="{{href}}"{{#schema}} schema="{{shema}}"{{/schema}}{{#mimeType}} mimeType="{{mimeType}}"{{/mimeType}}{{#encoding}} encoding="{{encoding}}"{{/encoding}}/> |
|---|
| 99 | </wps:Input> |
|---|
| 100 | {{/is_get}} |
|---|
| 101 | {{#is_post}} |
|---|
| 102 | <wps:Input> |
|---|
| 103 | <ows:Identifier>{{identifier}}</ows:Identifier> |
|---|
| 104 | <wps:Reference xlink:href="{{href}}" method="{{method}}"> |
|---|
| 105 | {{#headers}} |
|---|
| 106 | <wps:Header key="{{key}}" value="{{value}}" /> |
|---|
| 107 | {{/headers}} |
|---|
| 108 | <wps:Body>{{{value}}}</wps:Body> |
|---|
| 109 | </wps:Reference> |
|---|
| 110 | </wps:Input> |
|---|
| 111 | {{/is_post}} |
|---|
| 112 | {{/is_reference}} |
|---|
| 113 | {{^is_reference}} |
|---|
| 114 | <wps:Input> |
|---|
| 115 | <ows:Identifier>{{identifier}}</ows:Identifier> |
|---|
| 116 | <wps:Data> |
|---|
| 117 | <wps:ComplexData{{#schema}} schema="{{shema}}"{{/schema}}{{#mimeType}} mimeType="{{mimeType}}"{{/mimeType}}{{#encoding}} encoding="{{encoding}}"{{/encoding}}>{{#is_XML}} |
|---|
| 118 | {{{value}}}{{/is_XML}}{{^is_XML}}<![CDATA[{{{value}}}]]>{{/is_XML}} |
|---|
| 119 | </wps:ComplexData> |
|---|
| 120 | </wps:Data> |
|---|
| 121 | </wps:Input> |
|---|
| 122 | {{/is_reference}} |
|---|
| 123 | {{/is_complex}} |
|---|
| 124 | {{/DataInputs}} |
|---|
| 125 | </wps:DataInputs> |
|---|
| 126 | <wps:ResponseForm> |
|---|
| 127 | {{#RawDataOutput}} |
|---|
| 128 | {{#DataOutputs}} |
|---|
| 129 | <wps:RawDataOutput mimeType="{{mimeType}}"> |
|---|
| 130 | <ows:Identifier>{{identifier}}</ows:Identifier> |
|---|
| 131 | </wps:RawDataOutput> |
|---|
| 132 | {{/DataOutputs}} |
|---|
| 133 | {{/RawDataOutput}} |
|---|
| 134 | {{^RawDataOutput}} |
|---|
| 135 | <wps:ResponseDocument{{#storeExecuteResponse}} storeExecuteResponse="{{storeExecuteResponse}}"{{/storeExecuteResponse}}{{#lineage}} lineage="{{lineage}}"{{/lineage}}{{#status}} status="{{status}}"{{/status}}> |
|---|
| 136 | {{#DataOutputs}} |
|---|
| 137 | {{#is_literal}} |
|---|
| 138 | <wps:Output{{#dataType}} dataType="{{dataType}}"{{/dataType}}{{#uom}} uom="{{uom}}"{{/uom}}> |
|---|
| 139 | <ows:Identifier>{{identifier}}</ows:Identifier> |
|---|
| 140 | </wps:Output> |
|---|
| 141 | {{/is_literal}} |
|---|
| 142 | {{^is_literal}} |
|---|
| 143 | <wps:Output{{#asReference}} asReference="{{asReference}}"{{/asReference}}{{#schema}} schema="{{schema}}"{{/schema}}{{#mimeType}} mimeType="{{mimeType}}"{{/mimeType}}{{#encoding}} encoding="{{encoding}}"{{/encoding}}> |
|---|
| 144 | <ows:Identifier>{{identifier}}</ows:Identifier> |
|---|
| 145 | </wps:Output> |
|---|
| 146 | {{/is_literal}} |
|---|
| 147 | {{/DataOutputs}} |
|---|
| 148 | </wps:ResponseDocument> |
|---|
| 149 | {{/RawDataOutput}} |
|---|
| 150 | </wps:ResponseForm> |
|---|
| 151 | </wps:Execute> |
|---|