camptocamp / c2cgeoportal

c2cgeoportal application
http://geomapfish.org
Other
64 stars 46 forks source link

QGIS Layers in GeoMapFish 2.0 mobile not working #2462

Closed eleu closed 8 years ago

eleu commented 8 years ago

When one integrates a QGIS layer in GMF 2.0 (and probably also GMF 2.1), the /themes request shows a UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1053: ordinal not in range(128) error for a _wms_getcap_cached URL get:

image

with the end of the message: image

Probably because of a encoding problem because there is a tag with an Umlaut in the GetCapabilites (example)

Probably reproducible with a QGIS layer in GMF Demo.

ger-benjamin commented 8 years ago

Can we have an url to see the reponse (your images) / configuration by ourselves ? *An url to an active gmf. Or it's not active anymore ?

Forget my demand. I didn't see the "example"

eleu commented 8 years ago

The example is only showing the GetCapabilities. I have now checked the "public" checkbox in the test-Theme in my instance, which makes the error visible on firebox / dev tools for the example instance on (the protected server of) http://78.155.22.98:81/eleu/mobile

ger-benjamin commented 8 years ago

I don't currently know why the execution pass there:

https://github.com/camptocamp/c2cgeoportal/blob/0489db8ee3db1a14dfe951444552510de513f0df/c2cgeoportal/views/entry.py#L160-L161

But it seems that this line cause the error: "GetCapabilities from URL %s returns a wrong Content-Type: %s\n%s" % (url, resp.get("content-type"), content) If I remove it that works (this is currently used to indicate the source of an error, but cause itself an error...)

I search further...

ger-benjamin commented 8 years ago

@eleu If it's possible, you will need to configure the response of the server as application/vnd.ogc.wms_xml and not text/xml, and the problem will be resolved (except for the poor error message if you don't do that). It is possible ? Or perhaps we should accept responses in text/xml (@sbrunner ?).

@sbrunner If message can be in text (text/xml), content should be content.decode('utf-8') (always in the error string substitution, line 161, in the entry.py (see my previous link)). I leave you do that. I don't know enough the code to know if some more adaptation must be done.

Probably you'll do both to resolve this issue.

ger-benjamin commented 8 years ago

(Oh and yes, that in the 2.1 too)

eleu commented 8 years ago

btw, the mapserv_proxy is also returning text/xml

eleu commented 8 years ago

I tried Apache ForceType in apache/qgisserver.conf, but it does not help... http://httpd.apache.org/docs/2.2/mod/core.html#forcetype

eleu commented 8 years ago

In apache/qgisserver.conf.mako, set the following in the tag:

Header set Content-Type "application/vnd.ogc.wms_xml"

I will test now further...

eleu commented 8 years ago

This fixes (at least temporary) the bug.

Thanks for the help @ger-benjamin and @fredj

ger-benjamin commented 8 years ago

Nice catch. That's what is expected by the entry.py code. But please, don't close the issue, I think we need at least a better error message...