Hi Stefano,

Thank you - that has actually worked fine for me (using my whole sld file)
which is available here for your tests; (
http://www.ordnancesurvey.co.uk/docs/styled-layer-descriptors/topography-sld.zip
)

Full commands are now;

curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d
"<style><name>topoarea</name><filename>topoarea.sld</filename></style><languageVersion><version>1.1.0</version></languageVersion>"
http://localhost:8080/geoserver/rest/styles

curl -v -u admin:geoserver -XPUT -H "Content-type: application/vnd.ogc.se+xml"
-d @styles/topoarea.sld http://localhost:8080/geoserver/rest/styles/topoarea

Thanks for your help.

Toby


On 3 June 2015 at 10:29, Stefano Costa <[email protected]>
wrote:

>  Hi Toby,
> I believe you're using the wrong Content-type in your second request (PUT
> method), see:
> http://docs.geoserver.org/2.6.x/en/user/rest/api/styles.html#rest-api-styles-post-put
> <http://docs.geoserver.org/2.6.x/en/user/rest/api/styles.html#rest-api-styles-post-put;>
> Since you're clearly posting an SLD 1.1 / SE 1.1 document, you should:
> 1. specify the SLD version in the first request by adding
> <languageVersion><version>1.1.0</version></languageVersion> to the content
> (POST)
> 2. set the Content-type header to application/vnd.ogc.se+xml in the
> second request (PUT)
>
> However, I tried to issue your requests with the correct SLD version /
> mime type against GS version 2.6.2, 2.7.1 and 2.8-SNAPSHOT (nightly build
> dated June 6th), and the most I could get inside the topoarea.sld file is:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <sld:StyledLayerDescriptor xmlns:xs="http://www.w3.org/2001/XMLSchema";
> xmlns:se="http://www.opengis.net/se"; xmlns:gml="http://www.opengis.net/gml";
> xmlns:ogc="http://www.opengis.net/ogc"; xmlns:sld="http://www.opengis.net/sld";>
>       org.geotools.styling.StyledLayerDescriptorImpl@1b07e3fb
> </sld:StyledLayerDescriptor>
>
>
> So, xmlns attributes are no longer stripped out, but there is likely a bug
> in the serialization of the created StyledLayerDescriptorImpl instance.
> The problem seems to occur only if the style is created through the REST
> interface.
>
>
> Has anybody else had any success creating SLD 1.1 / SE 1.1 via REST?
>
>
>
> Il giorno lun, 01/06/2015 alle 11.27 +0100, Tobias Reinicke ha scritto:
>
> Hello All,
>
>
>
>  I am doing a fairly simple thing but it doesn't quite seem to work as
> expected.
>
>  I am creating a new empty style and then uploading a local sld into it
> (all via the rest api).
>
>
>
>  The problem I am seeing is that there are certain xmlns objects being
> stripped out - and thus breaking the sld.
>
>
>
>  The commands I am using;
>
>
> curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d
> "<style><name>topoarea</name><filename>topoarea.sld</filename></style>"
> http://localhost:8080/geoserver/rest/styles
>
>
>  curl -v -u admin:geoserver -XPUT -H "Content-type:
> application/vnd.ogc.sld+xml" -d @styles/topoareamin.sld
> http://localhost:8080/geoserver/rest/styles/topoarea
>
>
>
>  The sld in questions is below and the bit that gets stripped out is the
> se bit (in bold).
>
>
>
>  If I copy and paste this into the geoserver gui it works fine.
>
>
>
>  Any help would be much appreciated.
>
>
>
>  Toby
>
>
>
>
>
>  <?xml version="1.0" encoding="UTF-8"?>
>                         <StyledLayerDescriptor xmlns="
> http://www.opengis.net/sld"; xmlns:ogc="http://www.opengis.net/ogc";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="1.1.0"
> xmlns:xlink="http://www.w3.org/1999/xlink"; xsi:schemaLocation="
> http://www.opengis.net/sld
> http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd"; 
> *xmlns:se="http://www.opengis.net/se
> <http://www.opengis.net/se>"*>
>                           <NamedLayer>
>                             <se:Name>topographicarea</se:Name>
>                             <UserStyle>
>                               <se:Name>topographicarea</se:Name>
>                               <se:FeatureTypeStyle>
>                                 <se:Rule>
>                                   <se:Name></se:Name>
>                                   <se:PolygonSymbolizer>
>                                     <se:Fill>
>                                       <se:SvgParameter
> name="fill">#ccff99</se:SvgParameter>
>                                     </se:Fill>
>                                   </se:PolygonSymbolizer>
>                                 </se:Rule>
>                                 <se:Rule>
>                                   <se:Name>Building</se:Name>
>                                   <se:Description>
>                                     <se:Title>Building</se:Title>
>                                     <se:Abstract>Buildings</se:Abstract>
>                                   </se:Description>
>                                   <ogc:Filter xmlns:ogc="
> http://www.opengis.net/ogc";>
>                                     <ogc:PropertyIsEqualTo>
>
> <ogc:PropertyName>featurecode</ogc:PropertyName>
>                                       <ogc:Literal>10021</ogc:Literal>
>                                     </ogc:PropertyIsEqualTo>
>                                   </ogc:Filter>
>                                   <se:PolygonSymbolizer>
>                                     <se:Fill>
>                                       <se:SvgParameter
> name="fill">#ffd8b0</se:SvgParameter>
>                                     </se:Fill>
>                                   </se:PolygonSymbolizer>
>                                 </se:Rule>
>                               </se:FeatureTypeStyle>
>                             </UserStyle>
>                           </NamedLayer>
>                         </StyledLayerDescriptor>
>
>  
> ------------------------------------------------------------------------------
> _______________________________________________
> Geoserver-users mailing 
> [email protected]https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>
>   --
>
> Best regards,
> Stefano Costa
>
> ==
> GeoServer Professional Services from the experts! Visithttp://goo.gl/it488V 
> for more information.
> ==
> Dott. Stefano Costa
> Senior Software Engineer
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054  Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax:     +39 0584 1660272
> http://www.geo-solutions.ithttp://twitter.com/geosolutions_it
>
> -------------------------------------------------------
> AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
> Le informazioni contenute in questo messaggio di posta elettronica e/o
> nel/i file/s allegato/i sono da considerarsi strettamente riservate.
> Il loro utilizzo è consentito esclusivamente al destinatario del
> messaggio, per le finalità indicate nel messaggio stesso. Qualora
> riceviate questo messaggio senza esserne il destinatario, Vi preghiamo
> cortesemente di darcene notizia via e-mail e di procedere alla
> distruzione del messaggio stesso, cancellandolo dal Vostro sistema.
> Conservare il messaggio stesso, divulgarlo anche in parte,
> distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità
> diverse, costituisce comportamento contrario ai principi dettati dal
> D.Lgs. 196/2003.
>
> The information in this message and/or attachments, is intended solely
> for the attention and use of the named addressee(s) and may be
> confidential or proprietary in nature or covered by the provisions of
> privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New
> Data Protection Code).Any use not in accord with its purpose, any
> disclosure, reproduction, copying, distribution, or either
> dissemination, either whole or partial, is strictly forbidden except
> previous formal approval of the named addressee(s). If you are not the
> intended recipient, please contact immediately the sender by
> telephone, fax or e-mail and delete the information in this message
> that has been received in error. The sender does not give any warranty
> or accept liability as the content, accuracy or completeness of sent
> messages and accepts no responsibility  for changes made after they
> were sent or for other risks which arise as a result of e-mail
> transmission, viruses, etc.
>
>
>
>
------------------------------------------------------------------------------
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to