5

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

BODY:

<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">
    <wfs:Insert>
        <feature:GEOIP_NETWORKS xmlns:feature="http://edit.tmb.cat">
            <feature:GEOMETRY>
                <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
                <gml:pos>2.167296 41.381919</gml:pos></gml:Point>
            </feature:GEOMETRY>
            <feature:NETWORK>AAA</feature:NETWORK>
            <feature:DESC_NETWORK>asdasd</feature:DESC_NETWORK>
       </feature:GEOIP_NETWORKS>
    </wfs:Insert>
</wfs:Transaction>

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">
    <wfs:TransactionSummary>
        <wfs:totalInserted>1</wfs:totalInserted>
        <wfs:totalUpdated>0</wfs:totalUpdated>
        <wfs:totalDeleted>0</wfs:totalDeleted>
    </wfs:TransactionSummary>
    <wfs:TransactionResults/>
    <wfs:InsertResults>
        <wfs:Feature>
            <ogc:FeatureId fid="GEOIP_NETWORKS.19"/>
        </wfs:Feature>
    </wfs:InsertResults>
</wfs:TransactionResponse>

The exceptions work fine though, does return JSON.

Is it just not implemented yet?

I'm using Geoserver 2.11.1.

3
  • 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, 2017 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, 2017 at 12:11
  • as that link contains shapefiles and gml it looks pretty obvious that it is about features
    – Ian Turton
    Aug 22, 2017 at 12:26

1 Answer 1

4

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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