NASAWorldWind / WorldWindServerKit

The NASA WorldWind Server Kit (WWSK) is an open source Java project that assembles GeoServer for easy distribution and implementation.
91 stars 54 forks source link

Export GeoPackge fails due to mis-matched end-tags in XML #166

Open emxsys opened 6 years ago

emxsys commented 6 years ago

After the upgrade to GeoServer 2.13, the export GeoPackage process generates a valid XML, but somewhere in the process, the XML end-tags end up with ":" chars injected into the end-tags. For example: <layers>...</:layers>

Error text:

<wps:ExecuteResponse xml:lang="en" service="WPS" serviceInstance="http://cobra:8080/geoserver/ows?" version="1.0.0">
  <wps:Process wps:processVersion="1.0.0">
    <ows:Identifier>gs:GeoPackage</ows:Identifier><ows:Title>GeoPackage</ows:Title>
    <ows:Abstract>Geopackage Process</ows:Abstract>
  </wps:Process>
  <wps:Status creationTime="2018-06-26T23:07:14.003Z">
    <wps:ProcessFailed>
      <ows:ExceptionReport version="1.1.0">
        <ows:Exception exceptionCode="NoApplicableCode">
          <ows:ExceptionText>Failed to retrieve value for input contents
The element type &quot;layers&quot; must be terminated by the matching end-tag &quot;&lt;/layers&gt;&quot;.
          </ows:ExceptionText>
        </ows:Exception>
      </ows:ExceptionReport>
    </wps:ProcessFailed>
  </wps:Status>
</wps:ExecuteResponse>
emxsys commented 6 years ago

Example

Here is the XML for exporting a GeoPackage. Note the embedded colon chars in the layers and srs tags.

<?xml version="1.0" encoding="UTF-8"?><wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  <ows:Identifier>gs:GeoPackage</ows:Identifier>
  <wps:DataInputs>
    <wps:Input>
      <ows:Identifier>contents</ows:Identifier>
      <wps:Data>
        <wps:ComplexData mimeType="text/xml; subtype=geoserver/geopackage">
          <geopackage xmlns="http://www.opengis.net/gpkg" name="world">
            <tiles name="world">
              <layers>test:world</layers>
              <styles>raster</styles>
              <transparent>false</transparent>
              <bbox>
                <minx>-180.0</minx>
                <miny>-90.0</miny>
                <maxx>180.0</maxx>
                <maxy>90.0</maxy>
              </bbox>
              <srs>EPSG:4326</srs>
              <coverage>
                <minZoom>0</minZoom>
                <maxZoom>8</maxZoom>
              </coverage>
            </tiles>
          </geopackage>
        </wps:ComplexData>
      </wps:Data>
    </wps:Input>
  </wps:DataInputs>
  <wps:ResponseForm>
    <wps:RawDataOutput>
      <ows:Identifier>geopackage</ows:Identifier>
    </wps:RawDataOutput>
  </wps:ResponseForm>
</wps:Execute>

Problem

GeoPackageProcessRequestPPIO.decode receives the following input (note the ":" in the end-tags after the layers tag.

input = (java.lang.String) "<geopackage name="world" xmlns:wfs='http://www.opengis.net/wfs' xmlns:xml='http://www.w3.org/XML/1998/namespace' xmlns:wcs='http://www.opengis.net/wcs/1.1.1' xmlns:gml='http://www.opengis.net/gml' xmlns:ows='http://www.opengis.net/ows/1.1' xmlns:ogc='http://www.opengis.net/ogc' xmlns:wps='http://www.opengis.net/wps/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xlink='http://www.w3.org/1999/xlink'>
            <tiles name="world">
              <layers>test:world</:layers>
              <styles>raster</:styles>
              <transparent>false</:transparent>
              <bbox>
                <minx>-180.0</:minx>
                <miny>-90.0</:miny>
                <maxx>180.0</:maxx>
                <maxy>90.0</:maxy>
              </:bbox>
              <srs>EPSG:4326</:srs>
              <coverage>
                <minZoom>0</:minZoom>
                <maxZoom>8</:maxZoom>
              </:coverage>
            </:tile...
emxsys commented 6 years ago

More Info

Upon further review, the it seems all the closing end-tags have an embedded colon. In a debugging hack, i simply replaced the </: string with </ in GeoPackageProcessRequestPPIO.decode and that allows the export process to proceed, only to generate this error:

gs:GeoPackageGeoPackageGeopackage ProcessFailed to retrieve value for input contents 
Errors were encountered while parsing GeoPackage contents: 
[org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 422; 
cvc-elt.1: Cannot find the declaration of element &apos;geopackage&apos;.]

I would appear the entity resolver registered in applicationContext.xml cannot be found or was not loaded.