I'm trying to convince Geoserver that it returns JSON after creating a feature in WFS:

POST http://localhost/ows?outputFormat=application/json&exceptions=application/json


<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
        <feature:GEOIP_NETWORKS xmlns:feature="http://edit.tmb.cat">
                <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
                <gml:pos>2.167296 41.381919</gml:pos></gml:Point>

However it seems to ignore outputFormat parameter and keeps returning XML:

<?xml version="1.0" encoding="UTF-8"?>
<wfs:TransactionResponse xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://tmbapi.tmb.cat:80/geoserver/schemas/wfs/1.1.0/wfs.xsd">
            <ogc:FeatureId fid="GEOIP_NETWORKS.19"/>

The exceptions work fine though, does return JSON.

Is it just not implemented yet?

I'm using Geoserver 2.11.1.

  • 1
    XML is the native language of WFS. As far as I know in version 1.1.1 the outputformat parameter affects only GetFeature. – user30184 Aug 22 '17 at 12:08
  • Yeah I know, however the docs does not distinguish clearly where is outputFormat accepted and where not. docs.geoserver.org/2.11.1/user/services/wfs/outputformats.html – elkarel Aug 22 '17 at 12:11
  • as that link contains shapefiles and gml it looks pretty obvious that it is about features – Ian Turton Aug 22 '17 at 12:26

A WFS service will always expect (and require) requests and responses to be in XML. There is no alternative provided by the specification as interoperability between systems and client languages was a requirement there was no need to support niche formats like JSON.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.