Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Posts: 108
Registered: ‎07-07-2016

Example of WMS Façade for changing content of capabilties

[ Edited ]

We need to change capabilities service of a WMS in order to provide a legend graphic representation of a gorup layer.

Is there any example on how to do it with WMS Façade.?  Customer has Geospatial SDI product adquired.


Technical Evangelist
Posts: 1,281
Registered: ‎09-11-2015

Re: Example of WMS Façade for changing content of capabilties

Hi Josep,

By using the custom pipe DLL implementation, you can modify the Capabilities XML during runtime. Sample:

[SDIMethodHandler("GetCapabilities", "1.1.1", "wms")]
[SDIMethodHandler("GetCapabilities", "1.3.0", "wms")]
public IResponseBase GetCapabilitiesHandler(SDIMethodParameters parameters,
                               AdditionalParametersCollection additionalParameters,
                               IUserContext userContext)
   var response = InvokeOnNextPipe(parameters, additionalParameters, userContext);
   response = ProcessResponse(response);
   return response;

bool ShouldChangeLegendUrl(XElement legendURL)
   // determine if this is the legendurl to change
   // choose your own determining logic
   return true;

IResponseBase ProcessResponse(IResponseBase response)
   var xdoc = XDocument.Load(response.ResponseStream);
   foreach (var legendURL in xdoc.Descendants().Where(x => x.Name.LocalName == "LegendURL"))
       if (ShouldChangeLegendUrl(legendURL))
           legendURL.Descendants().Where(x => x.Name.LocalName == "OnlineResource").Attributes().First(x => x.Name.LocalName == "href").Value = "whatever";
   var resultResponse = new XMLResponse(xdoc, response.MimeType);
   resultResponse.HttpCode = response.HttpCode;
   return resultResponse;
Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial