Saturday, 29 October 2016

tomcat - Missing 'Spec' Parameter using print.pdf on GeoServer Print Module


I have two configurations of Tomcat with the same version of GeoServer and the print module installed as below.



  • The old configuration is Tomcat 8.0.44/GeoServer 2.11.1

  • The new configuration is Tomcat 9.0.10/GeoServer 2.11.1


Using the old configuration I can POST to localhost:1080/geoserver/pdf/print.pdf in SoapUI with the spec file generated from the Print Module demo in the body and this returns a pdf. An application has been written in C# based around this method of generating a pdf.


Using the new configuration (as Tomcat 8.0.x is now end of life, and also a combination of Tomcat 8.5.32/GeoServer 2.11.1) the same POST returns an error message:



generating PDF:
Missing 'spec' parameter
]]>


If the POST is changed to a GET with ?spec={SPEC} then this works but for our actual application requirements a POST is the only way to ensure that all of the vector data gets sent to the print module.


Does anyone have experience of using Tomcat 8.5 or above with GeoServer's Print Module using a POST to print.pdf?


The default SPEC file that has been used in SOAPUI testing is


{
"units":"degrees",
"srs":"EPSG:4326",

"layout":"A4 portrait",
"dpi":75,
"layers":[
{
"baseURL":"http://localhost:1080/geoserver/wms",
"opacity":1,
"singleTile":false,
"type":"WMS",
"layers":["topp:states"],
"format":"image/jpeg",

"styles":[""],
"customParams":{}
},
{
"type":"Vector",
"styles":
{
"1":
{
"externalGraphic":"http://geoserver.org/img/geoserver-logo.png",

"strokeColor":"red",
"fillColor":"red",
"fillOpacity":0.7,
"strokeWidth":2,
"pointRadius":12
}
},
"styleProperty":"_gx_style",
"geoJson":{
"type":"FeatureCollection",

"features":[{
"type":"Feature",
"id":"OpenLayers.Feature.Vector_52",
"properties":{"_gx_style":1},
"geometry":{
"type":"Polygon",
"coordinates":[[[-97,39],[-98,40],[-96,41],[-97,39]]]
}
},
{

"type":"Feature",
"id":"OpenLayers.Feature.Vector_61",
"properties":{"_gx_style":1},
"geometry":{
"type":"LineString",
"coordinates":[[-97,40],[-98,39],[-99,38]]
}
},
{
"type":"Feature",

"id":"OpenLayers.Feature.Vector_64",
"properties":{"_gx_style":1},
"geometry":{
"type":"Point",
"coordinates":[-98,38]
}
}
]},
"name":"vector",
"opacity":1

}],
"pages":[{
"center":[-98.000000000002,40],
"scale":4000000,
"rotation":"0",
"mapTitle":"A custom title",
"comment":"A custom comment"
}]
}


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...