setCredentials for WMSLayer

2299
1
Jump to solution
05-12-2013 09:43 PM
KellyThomas
New Contributor II
Hi,

I am just starting to explore ArcGIS Runtime SDK for Android (10.1.1)  so please excuse me if i'm missing something really basic.

I am trying to display a layer from a WMS server. I find that if I have no credentials specified I quiet rightly receive an EsriSecurityException telling me "Invalid or missing user credentials".

Next I see that Layer has a credentials field with getCredentials, and setCredentials listed as inherited methods.  However when I attempt to call setCredentials on my WMSLayer I am informed that setCredentials is not visible!?!

What is the established technique for setting WMS credentials?

For what its worth a code snippet follows.

Thanks
Kelly


        mMapView = (MapView)findViewById(R.id.map);                 String url = "https://www.sample.com//wms?";         WMSLayer wmsLayer = new WMSLayer(url);          UserCredentials credentials = new UserCredentials();         credentials.setUserAccount("username", "password");         wmsLayer.setCredentials(credentials); // method not visible          String [] layerNames = {"LAYER-001"};         wmsLayer.setVisibleLayer(layerNames);                  mMapView.addLayer(wmsLayer);
0 Kudos
1 Solution

Accepted Solutions
KellyThomas
New Contributor II
The solution I found was to subclass WMSLayer and implement a public setCredentials method.

From this subclass it is possible to call the protected setCredentials method of WMSLayer.

A further issue to note is that the WMSLayer will fail if the url ends in a question mark.

View solution in original post

0 Kudos
1 Reply
KellyThomas
New Contributor II
The solution I found was to subclass WMSLayer and implement a public setCredentials method.

From this subclass it is possible to call the protected setCredentials method of WMSLayer.

A further issue to note is that the WMSLayer will fail if the url ends in a question mark.
0 Kudos