[Geoserver-users] WPS - gs:import - Can we embed Base64 encoded shapefile into execute request?

Here's what my current request looks like (I shortened the base64 encoding):

<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0&quot; xmlns:ows="http://www.opengis.net/ows/1.1&quot; xmlns:xlink="http://www.w3.org/1999/xlink&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd&quot;&gt;
  <ows:Identifier>gs:Import</ows:Identifier>
  <wps:DataInputs>
    <wps:Input>
      <ows:Identifier>features</ows:Identifier>
      <wps:Data>
      <wps:ComplexData mimeType="application/zip" encoding="Base64"><![CDATA[UEsDBBQAAA...AAA==]]></wps:ComplexData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>workspace</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>upload</wps:LiteralData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>store</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>test</wps:LiteralData>
      </wps:Data>
    </wps:Input>
  </wps:DataInputs>
  <wps:ResponseForm>
    <wps:ResponseDocument>
      <wps:Output>
        <ows:Identifier>layerName</ows:Identifier>
      </wps:Output>
    </wps:ResponseDocument>
  </wps:ResponseForm>
</wps:Execute>

The result I see is:
<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.1.0"
  xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://localhost:8081/geoserver/schemas/ows/1.1.0/owsAll.xsd&quot;
  xmlns:ows="http://www.opengis.net/ows/1.1&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  <ows:Exception exceptionCode="NoApplicableCode">
    <ows:ExceptionText>Process returned with an exception
    Could not convert (encoded data block) to target type org.geotools.data.simple.SimpleFeatureCollection</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>

The request does work when I take the file that created the base64 encoding and reference it like so:
<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0&quot; xmlns:ows="http://www.opengis.net/ows/1.1&quot; xmlns:xlink="http://www.w3.org/1999/xlink&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd&quot;&gt;
  <ows:Identifier>gs:Import</ows:Identifier>
  <wps:DataInputs>
    <wps:Input>
      <ows:Identifier>features</ows:Identifier>
      <wps:Reference xlink:href="///path/to/my/file/testShapes.zip" mimeType="application/zip"/>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>workspace</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>upload</wps:LiteralData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>store</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>test</wps:LiteralData>
      </wps:Data>
    </wps:Input>
  </wps:DataInputs>
  <wps:ResponseForm>
    <wps:ResponseDocument>
      <wps:Output>
        <ows:Identifier>layerName</ows:Identifier>
      </wps:Output>
    </wps:ResponseDocument>
  </wps:ResponseForm>
</wps:Execute>

---------------------------------------------------------------------------
Ivan Suftin - Applications Developer - isuftin@anonymised.com
Center for Integrated Data Analytics (CIDA)
U.S. Geological Survey
8505 Research Way, Middleton, WI 53562
Office: (608) 821-3825 - Cell : (608) 345-8963

On Wed, Aug 17, 2011 at 4:04 PM, Ivan Suftin <isuftin@anonymised.com> wrote:

Here's what my current request looks like (I shortened the base64 encoding):

<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0&quot; xmlns:ows="http://www.opengis.net/ows/1.1&quot; xmlns:xlink="http://www.w3.org/1999/xlink&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd&quot;&gt;
<ows:Identifier>gs:Import</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>features</ows:Identifier>
<wps:Data>
<wps:ComplexData mimeType="application/zip" encoding="Base64"><![CDATA[UEsDBBQAAA...AAA==]]></wps:ComplexData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>workspace</ows:Identifier>
<wps:Data>
<wps:LiteralData>upload</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>store</ows:Identifier>
<wps:Data>
<wps:LiteralData>test</wps:LiteralData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:ResponseDocument>
<wps:Output>
<ows:Identifier>layerName</ows:Identifier>
</wps:Output>
</wps:ResponseDocument>
</wps:ResponseForm>
</wps:Execute>

The result I see is:
<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.1.0"
xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://localhost:8081/geoserver/schemas/ows/1.1.0/owsAll.xsd&quot;
xmlns:ows="http://www.opengis.net/ows/1.1&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>Process returned with an exception
Could not convert (encoded data block) to target type org.geotools.data.simple.SimpleFeatureCollection</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>

I actually never tried to do base64 encoding of the zipped files, it
may be that the code handling that case is not
working as expected.
Another possibility is that the POST request has grown so large that
the container refuses to handle it

Cheers
Andrea

--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------