Tutorial

Using the WPS application included in Weaver

Install Weaver (see: Installation) and make sure all required components are started and running (see: Configuration).

Then, execute the desired WPS or OGC API - Processes (WPS-REST bindings) request according to desired operation mode and version.

For all following examples, ${WEAVER_URL} is used to specify your application URL endpoint configuration. By default, this value should be localhost:4001.

Note

This tutorial section is a minimal introduction to available requests and endpoints. Please refer to processes for further details, such as detailed request payload contents, types of processes and additional operations that compose a typical process execution workflow. Similarly, refer to Application Package for further details about the definition of the reference application executed by the deployed processes.

WPS-1/2 requests

Specifying the appropriate version=<1.0.0|2.0.0> parameter in the URL as required.

Run a WPS-1/WPS-2 GetCapabilities request:

$ curl -k "${WEAVER_URL}/ows/wps?service=wps&request=getcapabilities"

You should receive an XML response listing service details and available processes.

Run a WPS-1/WPS-2 DescribeProcess request (built-in process jsonarray2netcdf):

$ curl -k "${WEAVER_URL}/ows/wps?service=wps&request=describeprocess&identifier=jsonarray2netcdf&version=1.0.0"

This will provide you with an XML response listing the specific process details such and inputs/outputs and description.

We can now use the process to execute a WPS request. To do so, we will need some input data files to call it. First, let’s create a JSON file with some dummy NetCDF file reference for demonstration purpose.

$ echo 'Test WPS' > /tmp/test.nc
$ echo '["file:///tmp/test.nc"]' > /tmp/test.json

Then, run the WPS-1/WPS-2 Execute request (built-in process jsonarray2netcdf) as follow:

$ curl -k "${WEAVER_URL}/ows/wps?service=wps&request=execute&identifier=jsonarray2netcdf&version=1.0.0 \
    &DataInputs=input=file:///tmp/test.json"

The execution of the process should read the JSON list with our dummy NetCDF file and make it available (as a copy) on the output parameter named output with a path matching the configured output WPS path of the application.

Note

All above WPS-1/2 requests suppose that configuration setting weaver.wps_path /ows/wps (default value). The request URL have to be adjusted accordingly if this parameter is modified.

Also, the provided file reference is relative where Weaver application is running. If you want to employ a remote server instance, you will have to either place the file on this server file system at a location Weaver has access to, or provide the file through an HTTP URL.

WPS-3 requests

All previous operations for listing available processes (GetCapabilities), describing or executing a WPS-1/2 process can also be accomplished using the WPS-3 REST JSON interface. For instance, listing processes is done like so:

$ curl -k "${WEAVER_URL}/processes"

Individual process details (DescribeProcess) can be obtained with the following method (e.g.: built-in process jsonarray2netcdf in this case):

$ curl -k "${WEAVER_URL}/processes/jsonarray2netcdf"

And execution of this process can be accomplished with the following request:

$ curl -X POST "${WEAVER_URL}/processes/jsonarray2netcdf/jobs" \
       -H "Content-Type: application/json" \
       -d '{"inputs": [{"id": "input", "href": "file:///tmp/test.json"}],
            "outputs": [{"id": "output", "transmissionMode": "reference"}],
            "response": "document",
            "mode": "async"}'

The JSON response should provide a location field specifying where the job status can be verified. Upon successful job completion, an output reference URL should have been generated just as with the WPS-1/2 example.

The WPS-3 interface allows further operations such as job monitoring, specific output listing, log reporting, etc. For all available operations and specific details about them, please refer to OpenAPI schemas (they will also be rendered on route ${WEAVER_URL}/api when running Weaver application).

Endpoint Content-Type

Todo

wps-1/2 xml default, json supported wps-2

Todo

wps-rest json only (for now, xml also if implemented) https://github.com/crim-ca/weaver/issues/125 https://github.com/crim-ca/weaver/issues/126

Next Steps

Have a look to the Processes, Application Package and FAQ sections.

The full OpenAPI Specification is also available for request details to target a Running Weaver service. Alternatively, the Weaver CLI and Client can also be employed to facilitate interactions with a Weaver service.