WPS Execute Request URL Encoding

geoprocessing.info

Home  |  Terms of use

Encoding GET Execute Requests


Due to their complexity, the DataInputs, ResponseDocument, and RawDataOutput parameters require special encoding in order to be constructed into an HTTP GET request.


Encoding Rules

Encoding of the DataInputs, ResponseDocument, and RawDataOutput value fields for HTTP GET Execute requests shall be as follows:

  1. A semicolon (;) shall be used to separate one input from the next
  2. An equal sign (=) shall be used to separate an input name from its value and attributes, and an attribute name from its value
  3. An at symbol (@) shall be used to separate an input value from its attributes and one attribute from another.
  4. Field names and attribute names are case sensitive. Incorrect field names and attribute names shall raise an InvalidParameterException.
  5. Missing mandatory field names shall raise a MissingParameterValue.
  6. All field values and attribute values shall be encoded using the standard Internet practice for encoding URLs [IETF RFC 1738].
  7. References using HTTP POST shall not be supported in the KVP encoding.

Rule 6 has the effect of double-encoding attribute values that are embedded in the DataInputs and ResponseDocument/RawDataOutput fields.


Example

Consider a WPS Execute request intended to pass the following parameters:

Version = 1.0.0
Language = en-CA
Request = Execute
Identifier = Buffer
DataInputs
InputPolygon
xlink:href = http://foo.bar/some_WFS_request.xml
method = POST
mimeType = text/xml
encoding = UTF-8
schema = http://foo.bar/gml_polygon_schema.xsd
BufferDistance = 400
uom = feet
ResponseDocument
BufferedPolygon
asReference = true
storeExecuteResponse = true
lineage = true
status = true

The content of the DataInputs and ResponseDocument elements above is represented in the table below.

Parameter NameInput/Output IdentifierAttribute NameValue
DataInputsInputPolygon  
xlink:hrefhttp://foo.bar/some_WFS_request.xml
methodPOST
mimeTypetext/xml
encodingUTF-8
schemahttp://foo.bar/gml_polygon_schema.xsd
BufferDistance400
uomfeet
ResponseDocumentBufferedPolygon 
asReferencetrue

This information is encoded into a URL request as follows.

Step 1

Create URL-encoded representations for all Input and Output values as well as their associated attribute values.

Parameter NameInput/Output IdentifierAttribute NameEncoded Value
DataInputsInputPolygon  
xlink:hrefhttp%3A%2F%2Ffoo.bar%2Fsome_WFS_request.xml
methodPOST
mimeTypetext%2Fxml
encodingUTF-8
schemahttp%3A%2F%2Ffoo.bar%2Fgml_polygon_schema.xsd
BufferDistance400
uomfeet
ResponseDocumentBufferedPolygon 
asReferencetrue

Step 2

For each Input/Output Identifier, concatenate its encoded value, an "@" character, the name of the first attribute, an "=" character, and the encoded value of that attribute. Append additional attributes as necessary by repeating from the "@" character.

Parameter NameInput/Output IdentifierConcatenated Encoded Value
DataInputsInputPolygon@xlink:href=http%3A%2F%2Ffoo.bar%2Fsome_WFS
_request.xml@method=POST@mimeType=text%2Fxml
@encoding=UTF-8@schema=http%3A%2F%2Ffoo.bar
%2Fgml_polygon_schema.xsd
BufferDistance400@uom=feet
ResponseDocumentBufferedPolygon@asReference=true

Step 3

Create the value for each parameter by concatenating the first Input/Output identifier, an "=" character, and its concatenated value from step 2 above. Add inputs/outputs as required, separated by a ";" character.

Parameter NameValue
DataInputsInputPolygon=@xlink:href=http%3A%2F%2Ffoo.bar%2Fsome_WFS
_request.xml@method=POST@mimeType=text%2Fxml@encoding=UTF-
8@schema=http%3A%2F%2Ffoo.bar%2Fgml_polygon_schema.xsd;BufferDistance=400@uom=feet
ResponseDocumentBufferedPolygon=@asReference=true

Step 4

URL-encode the concatenated values resulting from step 3 above as part of the conventional practice of encoding the values of all parameters that form part of a URL.

Parameter NameEncoded Value
DataInputsInputPolygon%3D%40xlink%3Ahref%3Dhttp%253A%252F%252Ffoo.bar%252F
some_WFS_request.xml%40method%3DPOST%40mimeType%3Dtext%252Fxml%40encoding
%3DUTF-8%40schema%3Dhttp%253A%252F%252Ffoo.bar%252Fgml_polygon_schema.xsd
%3B%20BufferDistance%3D400%40uom%3Dfeet
ResponseDocumentBufferedPolygon%3D%40asReference%3Dtrue

Complete the construction of the HTTP request in the conventional fashion by appending the "?" character to the base URL, followed by all required parameter names and values, using the "&" character to identify the separation of one parameter from the next, and the "=" character to identify the separation of a parameter name from its value. This could result in the following URL.

http://foo.bar/foo?
   Request=Execute&
   Service=WPS&
   Version=1.0.0&
   Language=en-CA&
   Identifier=Buffer&
   DataInputs=InputPolygon%3D%40xlink%3Ahref%3Dhttp%253A%252F%252Ffoo.bar%252F
      some_WFS_request.xml%40method%3DPOST%40mimeType%3Dtext%252Fxml%40encoding
      %3DUTF-8%40schema%3Dhttp%253A%252F%252Ffoo.bar%252Fgml_polygon_schema.xsd
      %3B%20BufferDistance%3D400%40uom%3Dfeet&
   ResponseDocument=BufferedPolygon%3D%40asReference%3Dtrue&
   storeExecuteResponse=true&
   lineage=true&
   status=true



See also: Decoding of Execute requests received via HTTP GET