[Geoserver-devel] [JIRA] (GEOS-10220) Publish SLD with InlineContent via REST API fails

meggsimum created an issue

GeoServer / BugGEOS-10220

Publish SLD with InlineContent via REST API fails

Issue Type:

BugBug

Affects Versions:

2.19.1, 2.19.2

Assignee:

Unassigned

Components:

REST

Created:

31/Aug/21 1:49 PM

Priority:

MediumMedium

Reporter:

meggsimum

Using the GeoServer REST-API to publish a SLD with InlineContent (e.g. a base64 png image) fails.
The request fails with the message an HTTP 500 “Error writing style”.

The REST call works quite well with a “normal” SLD, such as the simple “point” example. So the problem seems to be related to the InlineContent element. When publishing the SLD with the InlineContent element via GeoServer web GUI it works without any issues and even the validator says “No validation errors.”.

Here a cURL for an example of such a failing REST API call:

{{ curl -X POST \

http://localhost:8080/geoserver/rest/workspaces/test-cm/styles?name=foo
-H ‘Authorization: Basic YWRtaW46Z2Vvc2VydmVy’
-H ‘Content-Type: application/vnd.ogc.sld+xml’
-H ‘cache-control: no-cache’
-d ‘<?xml version=“1.0” encoding=“UTF-8”?>
<StyledLayerDescriptor
xmlns:xsi=’'‘http://www.w3.org/2001/XMLSchema-instance’\'
xmlns=“http://www.opengis.net/sld
xmlns:sld=“http://www.opengis.net/sld
xmlns:se=“http://www.opengis.net/se
xsi:schemaLocation=“http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd
http://www.opengis.net/se
http://schemas.opengis.net/se/1.1.0/FeatureStyle.xsd
version=“1.1.0”
>
<UserLayer>
<se:Name>sauber_stations</se:Name>
<UserStyle>
<se:FeatureTypeStyle>
<se:Rule>
<se:Name>sauber_stations_rule_1</se:Name>
<se:PointSymbolizer>
<se:Graphic>
<se:ExternalGraphic>
<se:InlineContent
encoding=“base64”>iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABgAAAAYADwa0LPAAABhklEQVRYw+3XMUscURAH8J854QJ2EUzSpZWENCcqGNATvC9gII3kI5jS9iy1EPEz2PgVDCQpDBgSGxtBC0vBMiGaI4ak2HfccZ7Hure7d4H9w8C8eftm/m/mveEtBQr0h5GM/E6igokwvsQRTvLcXBnvcIa/d8gZVsO3mWZoGnt4hl/4gI+4CPNPUcUiHuIcb/A1i8zM4Bq/saVVJigFaeIxtsO3V2Ft6ihhB/Nh/ASbOMVNkFNsBEKwENaU7hMoCV7jh+i8fMchvgS9aVvu5eBByoSei8q3gnHMisoyjrdo4EXWWenEo4Rzw4msGiO8wlzQP+Ng0JutazXEetxFaR/qvlEQ+u8IjfaYq+Gl5O19rkNfC/ofHGP/Ps523f2ESEt245Kp5UCmKUudwbudoUrCEiXBVBxC5RiO0sKtWHFv2UibNFFts30KtvU223oShkN37YeOUDfU5XfL6nEy1Mhx87didSP0LUdCsWMNrFP3ejEuiR7pYyln5afob+R9yn4LFAD/AABxpFl+H1QlAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIxLTA4LTI2VDA4OjMzOjMwKzAwOjAwM+HvGAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0wOC0yNlQwODozMzozMCswMDowMEK8V6QAAAAASUVORK5CYII=</se:InlineContent>
<se:Format>image/png</se:Format>
</se:ExternalGraphic>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>
</se:FeatureTypeStyle>
</UserStyle>
</UserLayer>
</StyledLayerDescriptor>’ }}

The logfiles states the follwong error:

{{ ERROR [geoserver.rest] - Error writing style
org.geoserver.rest.RestException 500 INTERNAL_SERVER_ERROR: Error writing style
at org.geoserver.rest.catalog.StyleController.styleSLDPost(StyleController.java:242)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:207)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:901)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) }}

The problem was initially posted to the Users Mailing List: https://sourceforge.net/p/geoserver/mailman/message/37341643/

Add Comment

Add Comment

Get Jira notifications on your phone! Download the Jira Cloud app for Android or iOS


This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100175-sha1:92848a8)

Atlassian logo