Bug report #3929

404 Error with Qgis Add WMS Layer but valid response in web browser

Added by phil-bertram-clear-net-nz - over 17 years ago. Updated about 14 years ago.

Assignee:Gavin Macaulay -
Category:Web Services clients/WMS
Affected QGIS version: Regression?:No
Operating System:All Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:13953


I am getting a 404 Page not found response from a WMS server when using Qgis
(svn revision 5083) on Debian unstable
However, when I plug the same URL, copied from the Qgis error dialog box into
my web browser(Konqueror) I get a valid response, returning the capabilities xml data.
The problem has also been replicated by Brendan Morley (Firefox)
Below is the debugging output...................

Any ideas why ?

QgisApp::addWmsLayer: about to addRasterLayer
QgsSpatialRefSys::createFromEpsg with 4326
QgsSpatialRefSys::openDb path = /usr/share/qgis/resources/srs.db
Projection has angular units of degree
QgsServerSourceSelect::serverConnect: Connection info:
QgsProviderRegistry::getRasterProvider: Library name
is /usr/lib/qgis/wmsprovider.so
Debug: qgsproviderregistry.cpp:343 getProvider, Loaded data provider library
Debug: qgsproviderregistry.cpp:344 getProvider, Attempting to resolve the
classFactory function
Debug: qgsproviderregistry.cpp:351 getProvider, Getting pointer to a
dataProvider object from the library
QgsWmsProvider: constructing with uri
baseUrl =
QgsWmsProvider: exiting constructor.
Debug: qgsproviderregistry.cpp:363 getProvider, Instantiated the data provider
provider name: 0x81a9d92
QgsWmsProvider::supportedLayers: Entering.
QgsWmsProvider::retrieveServerCapabilities: entering.
QgsHttpTransaction: constructing.
QgsHttpTransaction: exiting constructor.
QgsHttpTransaction::getSynchronously: Entered.
QgsHttpTransaction::getSynchronously: Using
Warning: QgsHttpTransaction::getSynchronously: qurl.host() is
QgsHttpTransaction::getSynchronously: Starting get with id 1.
QgsHttpTransaction::getSynchronously: Setting httpactive = TRUE
QgsHttpTransaction::dataStarted with ID 1.
QgsHttpTransaction::dataStateChanged to 2.
An attempt to connect to the host is in progress.
QgsHttpTransaction::dataStateChanged to 3.
The client is sending its request to the server.
QgsHttpTransaction::dataStateChanged to 4.
The client's request has been sent and the client is reading the server's
QgsHttpTransaction::dataHeaderReceived: statuscode 404, reason 'Not Found',
content type: _.
QgsHttpTransaction::dataStateChanged to 5.
The connection to the host is open, but the client is neither sending a
request, nor waiting for a response.
QgsHttpTransaction::dataFinished with ID 1.
QgsHttpTransaction::dataFinished - no error.
QgsHttpTransaction::getSynchronously: Setting httpactive = FALSE
QgsHttpTransaction::getSynchronously: Response received.
QgsHttpTransaction::getSynchronously: Processing an error 'WMS Server
responded unexpectedly with HTTP Status Code 404 (Not Found)'.
QgsHttpTransaction: deconstructing.
QgsWmsProvider::errorString: returning 'WMS Server responded unexpectedly with
HTTP Status Code 404 (Not Found)
Tried URL:


#1 Updated by phil-bertram-clear-net-nz - over 17 years ago

Response via mailing list - copied here

Hi Phil,

I can reproduce the behaviour - rather odd really. The only thing I can
think of is that that WMS server is only accepting connections from
certain HTTP User-Agents. I could get to the URL via my Firefox.

Do you happen to be friendly with the webmaster of the WMS server?
Perhaps we can see if the URLs (QGIS vs. Firefox) really are coming in
the same to the WMS server.

Also, could you report this issue formally via
http://svn.qgis.org/trac/newticket - This gives me a better chance of
not forgetting about your issue.


#2 Updated by phil-bertram-clear-net-nz - over 17 years ago

Here is a link to the information page for the server[http://www.nztopoonline.linz.govt.nz/technicalusers/webservices.htm]
Unfortuately I do not know the webmaster.


#3 Updated by Tim Sutton over 17 years ago

This is just to confirm the problem could be replicated with SVN b1bc1849 (SVN r5233) here

#4 Updated by Gavin Macaulay - over 17 years ago

If one telnets to www.nztopoonline.linz.govt.nz, port 80 and types:

GET /wmsconnector/com.esri.wms.Esrimap?ServiceName=nztopo_wms&SERVICE=WMS&REQUEST=GetCapabilities

it returns the capability info as expected. tcpdump reports that Qgis is producing pretty much the same thing. I've emailed linz asking for some help...

#5 Updated by Gavin Macaulay - over 17 years ago

  • Status changed from Open to In Progress

#6 Updated by anonymous - over 17 years ago

As a workaround I have installed Mapserver, created a WMS Server using Mapserver.
Qgis happily onnects to the Mapserver WMS server which connects to http://www.nztopoonline.linz.govt.nz/wmsconnector/com.esri.wms.Esrimap?ServiceName=nztopo_wmsx%x% for the map data.


#7 Updated by Gavin Macaulay - over 17 years ago

The same problem has been reported in ticket #102, although with a different wms service. However both of the servers appear to be an esri product.

#8 Updated by Gavin Macaulay - over 17 years ago

Fixed in svn 7141779b (SVN r5356). That commit resolves the immediate 404 error, but I can't seem to get any images from the server.

Problem was that some wms servers only seem to accept url's without the http://web.address.net bit. Firefox appears to strip the host off before sending the request which is why the same URL worked in Firefox but not qgis.

#9 Updated by anonymous - over 17 years ago

With the nztopo wms server, selecting any layer just returns an image that is completely transparent.

The wms server mentioned in ticket #102 works now.

#10 Updated by Gavin Macaulay - over 17 years ago

The problem with qgis viewing data from the nztopo wms server now appears to be with the wms server sending inconsistent srs and bounding box information in response to a GetCapabilities request. However, since mapserver appears to work fine (see message above), there may be a way to work around the problem with nztopo.

Since this is a different problem to the original subject of this ticket, I'm closing this ticket and opening another (#103).

#11 Updated by Gavin Macaulay - over 17 years ago

  • Status changed from In Progress to Closed
  • Resolution set to fixed

#12 Updated by Anonymous about 14 years ago

Milestone Version 0.8 deleted

Also available in: Atom PDF