I have to pass username/password credentials to my WMS service. How do I pass this information in the WMS layer? At present, when I run a customized version of the sample application (LoadAWmsLayer) I am prompted for a username/password via a popup dialog in IE. Once I supply this information, a series of tiles appears on the web page with the red Xs in each tile.
So, how do I pass username/password to the WMS service?
Next, how can I troubleshoot matters when no images appear in the web page for the WMS layer, only the tiles with the red Xs therein?
To set the credential to WmsRasterLayer, you need to implement ICredentials interface, and set your own credential object to its Credentials property. For example:wmsRasterLayer.Credentials = new MyCredential(); public class MyCredential : ICredentials { public NetworkCredential GetCredential(Uri uri, string authType) { NetworkCredential myCredential = new NetworkCredential("UserName", "Password", "Domain"); return myCredential; } } We don’t have any event to handle the tile faild, but we can change the default pink tile to another color on client-side, please see the code below.var OnMapCreating = function(map) { OpenLayers.onImageLoadErrorColor = "Blue"; } Any questions please let me know.
Sorry, as far as I know, credentials can only be send by Post method while WmsOverlay use simple get method; so currently, it’s impossible to access your wms server with WmsOverlay.
I’ll let you know when I have new ideas, if you have any questions please let me know.
When I use Firefox, I am prompted with a dialog box that asks me for user name and password. When I provide the user name and password, the WMS overlay proceeds to "load" the tiles. A message appears in the status bar on the Firefox browser that reads:
Connecting to <my WMS provider>… Transferring data from <my WMS provider>…
For a few seconds; then the pink "error" tiles load into the web browser. These pink error tiles are then replaced with solid white tiles.
I can zoom in and out, pan the map, etc. and the same behavior repeats, but I do not see the imagery provided by my WMS provider.
I configed a WMS Server to test the credentials with WmsOverlay, when I input my user name and password in the opened dialog, it works fine.
Could you please right click on one of the white tiles and copy its address to a new browser and see if it returns an image. If not, there may be some issue with the credentials.
Currently, we can’t handle much about the credentials with WmsOverlay and we’ll let you know when we have new ideas. Please use WmsRasterLayer instead temporary.
... substituting GetMap for GetCapabilites, and a tile displays in the browser window.
So it seems that the WMS overlay is using the GetCapabilities parameter to request each tile, and not the GetMap parameter.
I am not adding the GetCapabilities parameter to the WMS overlay via the Parameters collection, so I can't fathom why the WMS layer is not switching over to GetMap when it requests an individual tile.
The WMS provider does support the GetMap capability. Here's a snippet from their GetCapabilities XML document:
<Capability>
<Request>
<GetMap>
<form>at>image/jpeg</Format>
<DCPType>
I will try out the WmsRasterLayer approach, since I still have a permissions issue when I browse the tile.
Ha ha! I’ve gotten my WMS layer to work with the raster overlay, but now I need to figure out how to get the traditional roads/satellite/hybrid method working for my WMS provider using the StaticOverlay… Is it possible using the StaticOverlay?
I need to figure out how to get the traditional roads/satellite/hybrid method working for my WMS provider using the StaticOverlay… Is it possible using the StaticOverlay?
It’s possible to add your WmsRasterLayer to StaticOverlay which is actually type of LayerOverlay, and it maintains a Layer collection; WmsRasterLayer inherits from Layer, so you can add it into the StaticOverlay.