The WebServiceRequest tool
The WebServiceRequest tool is designed to generate the HTTP payload and initiate requests to a web service. For GET requests, it consists of the KVP encoded URL, and for POST it generates the XML endoded document to be posted as the request body. Support for SOAP web services is not yet implemented but will follow a similar pattern.
Web services are typically described by some metadata (capabilities documents for OGC web services, or WSDL documents for SOAP services) therefore WebServiceRequests are considered a tool of the web service metadata. The metadata contains all the information required to properly bind the the service and therefore XSL stylesheets are the ideal way to create the HTTP payload. The payload is generated by processing selected nodes from the service metadata (e.g. a WMS Layer node or WFS FeatureType nodes in a capabilities document) with an XSL stylesheet. The resulting response is contained by the Model object specified by the targetModel property in config.
The request to be handled is specified in the config file using the requestName poperty, which allows this tool to handle many types of requests. The OGC request name is prepended with the service type so request names are like "wfs:GetFeature" or "wms:GetFeatureInfo". For example:
This implements a DescribeFeatureType tool for that WfsCapabilities document. When the request is executed, the model with an ID of featureTypeTemplate will be populated. To invoke the web service request, simply call the eventName listener with the selected node name as a paramter. For example:
The tool is implemented as a listener for "requestName" events, so other widgets and tools can also register with "requestName" events. The stylesheets used by the tool are contained in the tool/xsl directory however the naming convention is such that the colon ":" in the requestName is replaced by an underscore.
Any additional request parameters can be coded as tool properties in the config file and they will automatically be set as stylesheet parameters. For example, to set the maxFeatures value for a WFS GetFeature request:
For OGC services, any request can add an OGC filter expression by using the filterEspression property:
The filter expression is a model itself and descibribed more fully in the Using OGC Filter models tutorial.
AOI and BBOX values are set automatically for the WebServiceRequest stylesheets as parameters.