The information in this guide is only needed if you want to perform your own WFS request, for example a DescribeFeatureType request. The steps described here are not needed when you only want to visualize the data on a GXY or Lightspeed view.

Setting up a WFS client

To set up a connection to a WFS service you first need to create a new WFS client:

String serverURL = "";
TLcdWFSClient wfsClient = TLcdWFSClient.createWFSClient(new URI(serverURL));

You can use one client instance for just one OGC service. Therefore, you must identify the service at construction time.

The client you just created will connect with the WFS service by retrieving its capabilities. As described in the OGC specifications, a version negotiation process will also take place to determine a commonly supported version between the web service and the web client.

When a version has been agreed, the corresponding capabilities document is cached locally. To access the document, you can use the method getCachedCapabilities.

Introduction to OGC requests

Creating and sending OGC requests

Requests are modeled by the interface ILcdOWSRequest, which supports (if applicable):

  • Key-value pair requests

  • XML-encoded requests

  • REST requests

You cannot instantiate these request objects directly. Instead, they are created by factory methods in the client.

The created requests are automatically initialized with the parameters SERVICE, REQUEST and VERSION. The value of the VERSION parameter corresponds to the version agreed during the version negotiation process upon initialization.

Depending on the request, further parameters can or must be defined before sending the request to an OGC service. The OWS transport layer guide contains more information about the use of ILcdOWSRequest instances.

Receiving OGC responses

Each request will have a specific type of response. The LuciadLightspeed OGC Web Client Suite offer a number of predefined response types. The general response type TLcdOWSInputStream is an extension of, which adds the content type and some extra metadata to the result stream.

Creating OGC custom requests

It is also possible to create custom requests. To support custom requests, you must override the appropriate client class, to provide access to the new requests.

Extensions can perform custom ILcdOWSRequest implementations by invoking the protected method performRequest.

Next to the request itself, the name of the operation associated with the request is required. This operation must correspond to an operation defined in the capabilities of the OGC service.

For example, GetCapabilities is a mandatory operation supported by each OGC service. If the operation is not supported, the request will not be performed and an UnsupportedOperationException is thrown.

You can retrieve the list of available operations at an OGC service through the method decodeOperations, which returns a list of TLcdOWSOperation objects.

Requesting WFS data

Creating and sending WFS requests

The default implementations that model the mandatory WFS requests are:

These request objects cannot be instantiated directly. Instead, they are created by factory methods in TLcdWFSClient:

Program: Creating WFS requests
// Create a GetCapabilities request
TLcdWFSGetCapabilitiesRequest getCapabilitiesRequest = wfsClient.createGetCapabilitiesRequest();

// Create a DescribeFeatureType request
TLcdWFSDescribeFeatureTypeRequest describeFeatureTypeRequest =

// Create a GetFeature request
TLcdWFSGetFeatureRequest getFeatureRequest = wfsClient.createGetFeatureRequest();

// Create a Transaction request
TLcdWFSTransactionRequest transactionRequest = wfsClient.createTransactionRequest();

// Create a LockFeature request
TLcdWFSLockFeatureRequest lockFeatureRequest = wfsClient.createLockFeatureRequest();

// Create a GetFeatureWithLock request
TLcdWFSGetFeatureWithLockRequest getFeatureWithLockRequest = wfsClient.createGetFeatureWithLockRequest();

When the request is configured, it is ready for sending to the WFS. For each predefined request, a separate method is defined in TLcdWFSClient that performs the request.

The following code snippet illustrates how to perform the requests:

Program: Sending WFS requests
// Send a GetCapabilities request
TLcdWFSCapabilities capabilities = wfsClient.getCapabilities(getCapabilitiesRequest);

// Send a DescribeFeatureType request
TLcdOWSInputStream describeFeatureTypeResult =

// Send a GetFeature request
TLcdOWSInputStream getFeatureResult = wfsClient.getFeature(getFeatureRequest);

// Send a Transaction request
TLcdWFSTransactionResponse transactionResult = wfsClient.transaction(transactionRequest);

// Send a LockFeature request
TLcdWFSLockFeatureResponse lockFeatureResult = wfsClient.lockFeature(lockFeatureRequest);

// Send a GetFeatureWithLock request
TLcdOWSInputStream getFeatureWithLockResult = wfsClient.getFeatureWithLock(getFeatureWithLockRequest);

Receiving WFS responses

These response types match the pre-defined requests in TLcdWFSClient:

Creating custom WFS requests

The list of available operations at a WFS service can be retrieved through the method decodeOperations, which returns a list of TLcdOWSOperation objects. By default, it reads the operations defined in the 'Capability/Request' section (version 1.0.0) or 'OperationsMetadata' (version 1.1.0 and 2.0.0) of the capabilities. If a WFS service uses other sections to define supplementary operations, in the vendor-specific section for example, you can override this method to take these into account.