Module: wpsPayload

The wpsPayload module is using the Hogan.js templating engine to generate XML requests to be sent to a WPS Server. In the ZOO-Client API, the Hogan.js templates have to be compiled before you can use them from you application. Please refer to the ZOO-Client installation documentation for more information.

Requires

  • module:payloads
  • module:jquery
  • module:utils

Methods


<static> getPayload(params)

The getPayload function uses the mustache templates and the parameters provided to generate a valid WPS XML request.
Parameters:
Name Type Description
params Object The object representing the request.
Returns:
- The corresponding XML request
Type
string
Examples
// GetCapabilities
var request_params = {
    request: 'GetCapabilities',
    language: 'en-US'
};
console.wpsPayload.getPayload(request_params));
// DescribeProcess with Identifier value set to "all".
var request_params = {
    request: 'DescribeProcess',
    identifier: ["all"]
};
console.log(wpsPayload.getPayload(request_params));
//
var request_params = {
    request: 'Execute',
    Identifier: "Buffer",
    DataInputs: [{"identifier":"InputPolygon","href":"http://features.org/toto.xml","mimeType":"text/xml"}],
    DataOutputs: [{"identifier":"Result","mimeType":"application/json"}], 
    language: 'en-US'
};
console.log(wpsPayload.getPayload(request_params));

<static> getPayload_DescribeProcess(params)

The getPayload_DescribeProcess function is used to generate a valid WPS XML DescribeProcess request using the payload_DescribeProcess.mustache template.
Parameters:
Name Type Description
params Object The object representing the request.
Returns:
- The corresponding XML request
Type
string
Example
// log the XML request in console
var request_params = {
    Identifier: ["Buffer","Centroid"],
    language: 'en-US'
};
console.log(wpsPayload.getPayload_DescribeProcess(request_params));

<static> getPayload_Dismiss(params)

The getPayload_Dismiss function is used to generate a valid WPS XML Dimiss request using the payload_Dismiss.mustache template.
Parameters:
Name Type Description
params Object The object representing the request.
Returns:
- The corresponding XML request
Type
string
Example
// log the XML request in console
var request_params = {
    jobId: ["XXXX","XXX"]
};
console.log(wpsPayload.getPayload_DescribeProcess(request_params));

<static> getPayload_Execute(params)

The getPayload_Execute function is used to generate a valid WPS XML Excute request using the payload_Execute.mustache template.
Parameters:
Name Type Description
params Object The object representing the request.
Returns:
- The corresponding XML request
Type
string
Example
// log the XML request in console
var request_params = {
    Identifier: "Buffer",
    DataInputs: [{"identifier":"InputPolygon","href":"http://features.org/toto.xml","mimeType":"text/xml"}],
    DataOutputs: [{"identifier":"Result","mimeType":"application/json"}], 
    language: 'en-US'
};
console.log(wpsPayload.getPayload_Execute(request_params));

<static> getPayload_GetCapabilities(params)

The getPayload_GetCapabilities function is used to generate a valid WPS XML GetCapabilities request using the payload_GetCapabilities.mustache template.
Parameters:
Name Type Description
params Object The object representing the request.
Returns:
- The corresponding XML request
Type
string
Example
// log the XML request in console
var request_params = {
    language: 'en-US'
};
console.log(wpsPayload.getPayload_GetCapabilities(request_params));