MapServer / mapcache

MapCache source code directory. Please submit pull requests to the 'main' branch.
https://mapserver.org/mapcache
Other
137 stars 96 forks source link

Failed to parse dimension values: no <value> children supplied #173

Open sebastic opened 6 years ago

sebastic commented 6 years ago

It looks like the <dimensions> configuration is not actually optional as suggested by comment in the sample configuration.

When the <dimensions> configuration is not present in the mapcache configuration file, or when the sample configuration is used, apache fails to start:

failed to parse dimension values: no <value> children supplied
jmckenna commented 6 years ago

Actually @tchaddad once hit this same error in MS4W about 10 months ago, with mapcache-master, but I could never reproduce the error locally: https://ms4w.com/trac/ticket/105 mapcache-master-error

sebastic commented 6 years ago

My findings are pretty much the same, with the 1.4.1 package from Debian stretch my mapcache configuration (which is a slightly modified default/sample configuration) works as expected, but with the 1.6.1 backport this issue is triggered.

tbonfort commented 6 years ago

@sebastic, I'm unable to reproduce when there is no present for a tileset. I've updated the sample xml config file with the correct syntax.

sebastic commented 6 years ago

Even with the new syntax the error remains the same when using MapCache 1.6.1.

Having dug through the code a little more, I found the following.

In lib/service_wms.c the _configuration_parse_wms_xml() function calls the mapcache_dimension_values_create() function when it finds a <param> child in a <forwarding_rule> element. Which I have in my configuration:

<forwarding_rule name="WFS">
  <param name="SERVICE" type="values">WFS</param>
  <http>
    <url>http://example.com/some-map/wfs</url>
  </http>
  <append_pathinfo>false</append_pathinfo>
</forwarding_rule>

This will need to use the new syntax like <dimension type="values"> elements too, something the MIGRATION_GUIDE.txt does not document (nor does http://mapserver.org/mapcache/proxying.html).

Updating the syntax for the above fixes the issue in my setup.

sebastic commented 6 years ago

While the error at apache startup is resolved, the WMS-C service previously provided by the <service type="wms"> is now no longer working for SERVICE=WMS&REQUEST=GetCabilities requests., logging the following:

failed to validate requested value for dimension (SERVICE)

An explicit <forwarding_rule> for the WMS service needs to be added before the WFS service now:

<forwarding_rule name="WMS">
  <param name="SERVICE" type="values">WMS</param>
  <http>
    <url>http://example.com/some-map/wms</url>
  </http>
  <append_pathinfo>false</append_pathinfo>
</forwarding_rule>

<forwarding_rule name="WFS">
  <param name="SERVICE" type="values">WFS</param>
  <http>
    <url>http://example.com/some-map/wfs</url>
  </http>
  <append_pathinfo>false</append_pathinfo>
</forwarding_rule>

But then the WFS passthrough no longer works because the requested value cannot be validated.

It's unclear to me how WFS passthrough is supposed to be configured now.

tchaddad commented 6 years ago

@sebastic can you share how you altered your forwarding rule to include the dimension syntax? I still have this problem, and have 2 forwarding rules that probably should be updated...

sebastic commented 6 years ago

See my previous comment, that's what I use now. Only the WMS-C works, WFS passthrough doesn't.

tchaddad commented 6 years ago

Ah ok, thanks - my rules were for just for WMS (GetFeatureInfo and GetLegendGraphic), and syntax was already similar to what you had, so I don't think that was my problem.

Unfortunately, adding the syntax from 145a29b to my tilesets is also not solving my problem, so I guess I need to remain at 1.4.1 for now.

tchaddad commented 6 years ago

Just to report back with some good news - I was able to finally get past this issue (started Apache successfully with MapCache 1.6), by altering my forwarding rules as follows:

Old Syntax:

 <forwarding_rule name="GetLegendGraphic rule">
             <append_pathinfo>true</append_pathinfo>
            <param name="SERVICE" type="values">WMS</param>
            <param name="REQUEST" type="values">GetLegendGraphic</param>
            <http>
               <url>http://www.example.com/some-map/wms</url>
            </http>
 </forwarding_rule> 

<forwarding_rule name="GetFeatureInfo rule">
        <append_pathinfo>true</append_pathinfo>
            <param name="SERVICE" type="values">WMS</param>
            <param name="REQUEST" type="values">GetFeatureInfo</param>
            <http>
               <url>http://www.example.com/some-map/wms</url>
            </http>
 </forwarding_rule>

New Syntax:

<forwarding_rule name="GetLegendGraphicRule">
          <append_pathinfo>true</append_pathinfo>
            <param name="SERVICE" type="values">
                <value>WMS</value>
            </param>
            <param name="REQUEST" type="values">
                <value>GetLegendGraphic</value>
            </param>
            <http>
               <url>http://www.example.com/some-map/wms</url>
            </http>
</forwarding_rule> 

<forwarding_rule name="GetFeatureInfoRule">
          <append_pathinfo>true</append_pathinfo>
            <param name="SERVICE" type="values">
                <value>WMS</value>
            </param>
            <param name="REQUEST" type="values">
                <value>GetFeatureInfo</value>
            </param>
            <http>
               <url>http://www.example.com/some-map/wms</url>
            </http>
</forwarding_rule> 

Hopefully this is helpful to others. Perhaps an example can be added to the sample config or other docs too?

jmckenna commented 6 years ago

@tchaddad do you think issue #168 (and its solution) is related? (was that "failed to validate requested value for dimension" your most recent error?)

jmckenna commented 6 years ago

hmm maybe it is not related, but I do wonder if we should go ahead and merge that fix in #168

tchaddad commented 6 years ago

Hmm - no I never got the "failed to validate error", just the "failed to parse" because no child element was supplied. But I suppose I should do some tests to actually use the rule and see if it still works as expected. I'm just glad the first step allows Apache to start!

Another comment - the reason this error was so confusing was that the error message implies missing <value> in <dimensions>, while in this case it was actually missing <value> in the <forwarding_rule>. Without @sebastic pointing in that direction, it would have been very difficult to figure out (thanks!). So differentiating between the 2 problems in the error messages would be helpful to future users.

jmckenna commented 6 years ago

Yes I'm very happy to hear that you can start Apache now (!!), glad you solved that.

jbo-ads commented 4 years ago

I created PR #303 on docs to update syntax discrepancies in Proxying Unsupported Requests document. Hope this solves part of the issue.

I also created PR #227 on MapCache to address misleading "dimension" reference. Hope this solves another part of the issue.