2

I am attempting to configure our internal GeoServer to cascade an external WMS server. The external server has some custom properties which need to be passed when making a call to that WMS.

http://externalwms.com/?VERSION=1.3.0&REQUEST=GetMap&LAYERS=ENC&CRS=EPSG:4326&BBOX=53.8,8.4,54.1,9.2&CSBOOL=384&CSVALUE=,,,,,3&WIDTH=1280&HEIGHT=800&FORMAT=image/png

as you can see, the custom properties are

&CSBOOL=384
&CSVALUE=,,,,,3

I am unsure how to configure our WMS service with these parameters so the remote service is called with them.

I tried adding them to the service definition / GetCapabilities without luck. it appears to ignore the additional parameters.

cascade PWM GetCapabilities with custom parameter does not work

I then tried to configure in the layers but there is no clear place to add custom parameters.

How can I achieve this?

4

There is currently no way to add custom parameters from the user interface.

I can think of a couple of ways to work around it, but have not tried either of them in practice, it's just speculation.

If you have any control on the remote server, then you can probably force the parameters to be added by adding them in the GetMap/GetFeatureInfo backlinks contained in the capabilities document... I hope the WMS cascading code would honor them when put there.

In a similar way, maybe you can manually download once the capabilities document of the remote server, edit it to add the extra parameters in the backlinks, and then point GeoServer to a local copy of such document. The client should honor the links for GetMap/GetFeatureInfo and talk to the remote server, even if the caps document is local.

As a final solution, the source code for the WMS cascading is in the gt-wms GeoTools module, while the configuration UI is in GeoServer. If you or someone in your organization is proficient with Java, you can modify the code to allow injection of vendor parameters. If not, but have funds, you can contact a commercial support provider and have that functionality developed for you.

  • unfortunately, I do not have access to the remote server. I have manually downloaded the capabilities document and attempted to modify the 'getmap' backlink as follows: – Paul Kennedy Nov 21 '20 at 11:39
  • '<GetMap> <Format>image/jpg</Format> <Format>image/png</Format> <DCPType> <HTTP> <Get> <!-- The URL here for invoking GetMap using HTTP GET is only a prefix to which a query string is appended. --> <OnlineResource xmlns:xlink="w3.org/1999/xlink" xlink:type="simple" xlink:href="remotewmsservice/?&CSBOOL=183&CSVALUE=8,,,8,,2,1"> </Get> </HTTP> </DCPType> </GetMap>' – Paul Kennedy Nov 21 '20 at 11:41
  • this is not accepted by geoserver. it throws "Connection test failed: Error while parsing XML." this happens when I attempt to define a new store inside geoserver – Paul Kennedy Nov 21 '20 at 11:43
  • Cannot blame it, that's not valid XML anymore, & needs to be escaped: <OnlineResource xmlns:xlink="w3.org/1999/xlink" xlink:type="simple" xlink:href="remotewmsservice/?CSBOOL=183&amp;CSVALUE=8,,,8,,2,1"> – Andrea Aime Nov 21 '20 at 16:15
0

I figured it out. in the getcapabilities XML file I had to replace the '&' characters with ASCII as follows:

            <GetMap>
            <DCPType>
                <HTTP>
                    <Get>
                        <!-- The URL here for invoking GetMap using HTTP GET is only a prefix to which a query string is appended. -->
                        <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
                        xlink:type="simple"
                        xlink:href="https://remotewms.com/?%26CSBOOL%3D5184%26CSVALUE%3D8,,,8,,2,1"/>
                    </Get>
                </HTTP>
            </DCPType>
        </GetMap>

it now works a treat.
I have discovered that Geoserver stores the getmap URL somewhere internally as it does not respond to any changes I make to the getcapabilities file. to reflect a change I need to make a new store each time

hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.