Dear Andreas,
Thank you very much.
I have just done a test to compare the two objects. The object returned by the 
OpenLayers API contains some attributes that the actual json object returned by 
the DescribeFeatureType service doesn't contain. In my opinion it is correct to 
adapt the DescribeFeatureType output to the OpenLayers output.
Thanks a lot.

Best Regards
Francesca


-----Original Message-----
From: Andreas Hocevar [mailto:ahoce...@opengeo.org]
Sent: 07 September 2012 5:09 PM
To: Vigetti, Francesca (CIOK)
Cc: Carlo Cancellieri; chol...@opengeo.org; alessio.fabi...@geo-solutions.it; 
geoserver-devel@lists.sourceforge.net
Subject: Re: [Geoserver-devel] GSIP 79 - Json support and WFS and WMS 
ExceptionHandler‏s

@Carlo: unfortunately there is no good documentation of the format.
For now the best source is looking at the unit tests - see 
https://github.com/openlayers/openlayers/blob/master/tests/Format/WFSDescribeFeatureType.html
and
https://github.com/openlayers/openlayers/blob/master/tests/Format/WMSDescribeLayer.html.

@Francesca: the proper way to read a responseXML is as follows:

new OpenLayers.Format.WFSDescribeFeatureType().read(xml /*XmlDoc or string*/); 
new OpenLayers.Format.WFSDescribeLayer().read(xml /*XmlDoc or string*/);

For the XML you provided, OpenLayers would expect the following:

{
    "elementFormDefault": "qualified",
    "targetNamespace": "http://www.fao.org/aquastat";,
    "featureTypes": [
        {
            "typeName": "major_hydrobasins",
            "properties": [
                {
                    "maxOccurs": "1",
                    "minOccurs": "0",
                    "name": "the_geom",
                    "nillable": "true",
                    "type": "gml:MultiSurfacePropertyType",
                    "localType": "MultiSurfacePropertyType"
                },
                {
                    "maxOccurs": "1",
                    "minOccurs": "0",
                    "name": "MAJ_BAS",
                    "nillable": "true",
                    "type": "xsd:long",
                    "localType": "long"
                },
                {
                    "maxOccurs": "1",
                    "minOccurs": "0",
                    "name": "MAJ_NAME",
                    "nillable": "true",
                    "type": "xsd:string",
                    "localType": "string"
                },
                {
                    "maxOccurs": "1",
                    "minOccurs": "0",
                    "name": "MAJ_AREA",
                    "nillable": "true",
                    "type": "xsd:int",
                    "localType": "int"
                }
            ]
        }
    ],
    "targetPrefix": "AQUASTAT"
}

I hope this helps,
Andreas

On Fri, Sep 7, 2012 at 4:34 PM, Vigetti, Francesca (CIOK) 
<francesca.vige...@fao.org> wrote:
>
> Dear All,
>
> Since I am involved in this task, I was trying to test the 
> OpenLayers.Format.XML with the output of a describeFeatureType call, but I 
> haven’t found a method to read the whole xml document at a time.
>
> Looking for a solution I found the OpenLayers.Format.XML.VersionedOGC that 
> has a read method. I have just applied this to my situation but I receive the 
> following error:
>
>
>
> 1.  Uncaught TypeError: Cannot call method 'replace' of null
> OpenLayers.js:275
>
> 1.
> OpenLayers.Format.XML.VersionedOGC.OpenLayers.Class.getParserOpenLayer
> s.js:275
>
> 2.
> OpenLayers.Format.XML.VersionedOGC.OpenLayers.Class.readOpenLayers.js:
> 276
>
>
>
> The xml document I receive from my request is the following:
>
>
>
> <xsd:schema xmlns:AQUAMAPS="http://www.fao.org/aquamaps";
> xmlns:AQUASTAT="http://www.fao.org/aquastat";
> xmlns:COMMON="http://www.fao.org/common";
> xmlns:COUNTRYPROFILES="http://www.fao.org/countryprofiles"xmlns:FSATMI
> S="http://www.fao.org/fsatmis"; xmlns:GAEZ="http://www.fao.org/gaez";
> xmlns:GEONETWORK="http://www.fao.org/geonetwork";
> xmlns:SFS_LOCAL="http://www.fao.org/sfs_local"xmlns:SFS_REMOTE="http:/
> /www.fao.org/sfs_remote" xmlns:SOLAW="http://www.fao.org/solaw";
> xmlns:TEMP="http://www.fao.org/TEMP";
> xmlns:gml="http://www.opengis.net/gml"xmlns:xsd="http://www.w3.org/200
> 1/XMLSchema" elementFormDefault="qualified"
> targetNamespace="http://www.fao.org/aquastat";>
>
> <xsd:import namespace="http://www.opengis.net/gml";
> schemaLocation="http://hqlqatcdrgeo2.hq.un.fao.org:8081/geoserver/sche
> mas/gml/3.1.1/base/gml.xsd"/>
>
> <xsd:complexType name="major_hydrobasinsType">
>
> <xsd:complexContent>
>
> <xsd:extension base="gml:AbstractFeatureType">
>
> <xsd:sequence>
>
> <xsd:element maxOccurs="1" minOccurs="0" name="the_geom"
> nillable="true" type="gml:MultiSurfacePropertyType"/>
>
> <xsd:element maxOccurs="1" minOccurs="0" name="MAJ_BAS"
> nillable="true" type="xsd:long"/>
>
> <xsd:element maxOccurs="1" minOccurs="0" name="MAJ_NAME"
> nillable="true" type="xsd:string"/>
>
> <xsd:element maxOccurs="1" minOccurs="0" name="MAJ_AREA"
> nillable="true" type="xsd:int"/>
>
> </xsd:sequence>
>
> </xsd:extension>
>
> </xsd:complexContent>
>
> </xsd:complexType>
>
> <xsd:element name="major_hydrobasins" substitutionGroup="gml:_Feature"
> type="AQUASTAT:major_hydrobasinsType"/>
>
> </xsd:schema>
>
>
>
> If I use the jsonp format I receive the following object, that contains all 
> the information of the xml:
>
>
>
> getLayerFeatures_1347026036729_856536([ {
>
>       name : "AQUASTAT:major_hydrobasins",
>
>       description : "major_hydrobasins",
>
>       type : "object",
>
>       extends : "Feature",
>
>       properties : {
>
>             geometry : {
>
>                   type : "MultiPolygon",
>
>                   minimum : 0
>
>             },
>
>             properties : {
>
>                   type : "object",
>
>                   properties : {
>
>                         MAJ_BAS : {
>
>                               type : "integer",
>
>                               minimum : 0,
>
>                               maxLength : 10
>
>                         },
>
>                         MAJ_NAME : {
>
>                               type : "string",
>
>                               minimum : 0,
>
>                               maxLength : 75
>
>                         },
>
>                         MAJ_AREA : {
>
>                               type : "integer",
>
>                               minimum : 0,
>
>                               maxLength : 9
>
>                         }
>
>                   }
>
>             }
>
>       }
>
> } ])
>
>
>
> Could you kindly provide a working example that returns the OpenLayers 
> converted json object? So we can compare it with the one returned from 
> Geoserver.
>
> Thanks in advance.
>
>
>
> Best Regards
>
> Francesca Vigetti
>
>
>
> From: Carlo Cancellieri [mailto:ccancelli...@hotmail.com]
> Sent: 07 September 2012 4:18 PM
> To: chol...@opengeo.org; alessio.fabi...@geo-solutions.it; Vigetti,
> Francesca (CIOK)
> Cc: geoserver-devel@lists.sourceforge.net; ahoce...@opengeo.org
> Subject: RE: [Geoserver-devel] GSIP 79 - Json support and WFS and WMS
> ExceptionHandler‏s
>
>
>
> Andreas,
>
>  I know that the OL is a very common and widely used client but my intention 
> was to map 1 to 1 the XML as a Json object.
>
> Where I can find documentation on the JSON format you are using?
>
> Carlo
>
> ________________________________
>
> Date: Fri, 7 Sep 2012 08:40:00 -0400
> From: chol...@opengeo.org
> To: alessio.fabi...@geo-solutions.it
> CC: geoserver-devel@lists.sourceforge.net; ahoce...@opengeo.org
> Subject: Re: [Geoserver-devel] GSIP 79 - Json support and WFS and WMS
> ExceptionHandler‏s
>
> Me too.
>
>
>
> Andreas - is there somewhere that this object structure is documented? And is 
> that structure going to remain the same for OL 3?
>
> On Fri, Sep 7, 2012 at 5:08 AM, Alessio Fabiani 
> <alessio.fabi...@geo-solutions.it> wrote:
>
> Agree with Andreas observations about Describe operations compliance w/ OL.
>
>
> ==
>
> Our support, Your Success! Visit http://opensdi.geo-solutions.it for more 
> information.
>
> ==
>
>
>
> Ing. Alessio Fabiani
>
> @alfa7691
>
> Founder/Technical Lead
>
>
>
> GeoSolutions S.A.S.
>
> Via Poggio alle Viti 1187
>
> 55054  Massarosa (LU)
>
> Italy
>
> phone: +39 0584 962313
>
> fax:   +39 0584 962313
>
> mob:   +39  331 6233686
>
>
>
> http://www.geo-solutions.it
>
> http://twitter.com/geosolutions_it
>
>
>
> -------------------------------------------------------
>
>
>
> On Thu, Sep 6, 2012 at 3:59 PM, Justin Deoliveira <jdeol...@opengeo.org> 
> wrote:
>
> Hi Carlo,
>
>
>
> I forward this proposal on to some of our javascript devs and here is some 
> feedback that Andreas, one of the core OpenLayers developers had.
>
>
>
> <quote>
>
> I like the idea of having JSONP output, but it would be nice if the
> JavaScript payload would be in a structure that we can use out of the
> box. For WMS GetFeatureInfo, the job is well done - it returns
> GeoJSON. For the other requests (WFS DescribeFeatureType, WMS
> DescribeLayer), OpenLayers has Format classes that read the XML into a
> JavaScript object, but the GeoServer output is much different from
> that object so applications would need heavy modifications when
> switching from XML + OpenLayers.Format parsing to JSONP.
>
> tl;dr: My suggestion would be to have GeoServer return the same object
> structure that OpenLayers.Format.WMSDescribeLayer and
> OpenLayers.Format.WFSDescribeFeatureType generate.
>
> </quote>
>
>
>
> On Thu, Sep 6, 2012 at 6:37 AM, Carlo Cancellieri <ccancelli...@hotmail.com> 
> wrote:
>
>
> Hi Justin,
>
>
>
> ________________________________
>
> Date: Wed, 5 Sep 2012 20:53:32 -0400
>
>
> Subject: Re: [Geoserver-devel] GSIP 79 - Json support and WFS and WMS
> ExceptionHandler‏s
> From: jdeol...@opengeo.org
> To: ccancelli...@hotmail.com
> CC: geoserver-devel@lists.sourceforge.net
>
> > Thanks for laying that out Carlo.
>
>
>
> > In the wms doc noticed a small typo in the last table in the DescribeLayer 
> > section, both formats are listed as "JSONP" ,i believe the first one should 
> > be just JSON?
>
>
>
> Oops... yes, I'll fix it.
>
>
>
> > Also a question, does the default callback function name "paddingOutput" 
> > come from anywhere? Like is it a convention? The wikipedia page uses 
> > "parseResponse" as an example which sort of makes sense.
>
>
>
> Don't think there's a standard/convention, about this, it simply comes out 
> from "padding()" +output. We could define a better one commenting the GSIP.
>
> No strong opinion here. If there was something of a convention to follow i 
> would say go with that but if not no worries.
>
>
>
> Carlo
>
>
>
>
>
> On Wed, Sep 5, 2012 at 2:25 PM, Carlo Cancellieri <ccancelli...@hotmail.com> 
> wrote:
>
> Hi Justing,
> response inline:
>
> ________________________________
>
> Date: Wed, 5 Sep 2012 12:35:46 -0400
> Subject: Re: [Geoserver-devel] GSIP 79 - Json support and WFS and WMS
> ExceptionHandler‏s
> From: jdeol...@opengeo.org
> To: ccancelli...@hotmail.com
> CC: geoserver-devel@lists.sourceforge.net
>
>
>
> Thanks Carlo.
>
>
>
> It seems thsi proposal encompasses GEOS-5246 as well, be nice is there was 
> some links there and also a bit of a description in the proposal itself 
> rather than having to go into the issues and try to determine what the high 
> level changes are.
>
>
>
> OK, i'll do it.
>
>
>
>
>
> That said, i have questions about mime types used. I see both 
> application/json and text/javascript used for both output format and 
> exceptions. Can you provide a bit of clarity there? Is text/javascript used 
> to suppor the jsonp callback? In conjunction with the "callback" format 
> option?
>
> Let's say f.e. in a request like this:
>
> http://localhost:8080/geoserver/wms?
>
> &INFO_FORMAT=text/javascript
>
> &REQUEST=GetFeatureInfo
>
> &EXCEPTIONS=application/vnd.ogc.se_xml
>
> &SERVICE=WMS
>
> &INFO_FORMAT=text/javascript
>
> &VERSION=1.1.1
>
> &WIDTH=970&HEIGHT=485&X=486&Y=165&BBOX=-180,-90,180,90
>
> &LAYERS=COUNTRYPROFILES:grp_administrative_map
>
> &QUERY_LAYERS=COUNTRYPROFILES:grp_administrative_map
>
> &TYPENAME=COUNTRYPROFILES:grp_administrative_map
>
> &format_options=callback:getLayerFeatures
>
> You can specify the desired 'output_format':
>
> &INFO_FORMAT=text/javascript
>
> and also the desired exception format:
>
> &EXCEPTIONS=application/vnd.ogc.se_xml
>
> In this case you'll get:
> case 1:
> - the response in a jsonP format with the callback function called
> getLayerFeatures case 2:
> - the exception in an xml format (as default)
>
> Now if you change that request in:
>
> http://localhost:8080/geoserver/wms?
>
> &INFO_FORMAT=text/javascript
>
> &REQUEST=GetFeatureInfo
>
> &EXCEPTIONS=text/javascript
>
> &SERVICE=WMS
>
> &INFO_FORMAT=text/javascript
>
> &VERSION=1.1.1
>
> &WIDTH=970&HEIGHT=485&X=486&Y=165&BBOX=-180,-90,180,90
>
> &LAYERS=COUNTRYPROFILES:grp_administrative_map
>
> &QUERY_LAYERS=COUNTRYPROFILES:grp_administrative_map
>
> &TYPENAME=COUNTRYPROFILES:grp_administrative_map
>
> &format_options=callback:getLayerFeatures
>
> You'll get:
> case 1:
> - the response in a jsonP format with the callback function called
> getLayerFeatures case 2:
> - the exception in a jsonP format with the callback function called
> getLayerFeatures
>
> NOTE:
> 1. I don't added a specific format_option for exception callback right now, 
> do we really need one?
> 2. The format_options callback parameter is NOT mandatory in that case (JSONP 
> for response or exception) the default one is used paddingOutput (see 
> JSONType).
>
> Same things can be obtained when you use application/json.
> In that case you are simply asking for a json without the callback function 
> (which is ignored if specified).
>
> Json and JsonP
> http://en.wikipedia.org/wiki/JSONP
>
> Take also a look to examples here:
> http://docs.geoserver.org/latest/en/user/services/wms/reference.html
>
>
> Hope that this answers your questions.
>
> Cheers,
> Carlo
>
>
>
> Thanks.
>
>
>
> -Justin
>
>
>
> On Wed, Sep 5, 2012 at 12:16 PM, Carlo Cancellieri <ccancelli...@hotmail.com> 
> wrote:
>
> Hi all,
>
>  the GSIP 79 (about Json ExceptionHandlers) is here:
>
> http://geoserver.org/pages/viewpage.action?pageId=49938445
>
> It is already committed on the master branch and it would be nice to discuss 
> about its backport to the stable release 2.2.2.
>
>
>
> Cheers,
>
> Carlo
>
> ________________________________
>
> Date: Mon, 3 Sep 2012 11:31:21 -0500
> From: j...@codehaus.org
> To: ccancelli...@hotmail.com
> Subject: [jira] (GEOS-5247) Json[p] WFS and WMS exceptionHandler
>
> Justin Deoliveira commented on GEOS-5247
>
> Json[p] WFS and WMS exceptionHandler
>
> Any chance we can get a short GSIP before the work is backported. Maybe at 
> least just summarizing all the info placed into the various tickets. It would 
> be nice to get some more javascript developers eyes on this on before it's 
> set in stone on the stable branch.
>
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA administrators.
> For more information on JIRA, see:
> http://www.atlassian.com/software/jira
>
>
> ----------------------------------------------------------------------
> --------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond.
> Discussions will include endpoint security, mobile security and the
> latest in malware threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Geoserver-devel mailing list
> Geoserver-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>
>
>
>
>
> --
> Justin Deoliveira
>
> OpenGeo - http://opengeo.org
>
> Enterprise support for open source geospatial.
>
>
>
>
>
>
>
> --
> Justin Deoliveira
>
> OpenGeo - http://opengeo.org
>
> Enterprise support for open source geospatial.
>
>
>
>
>
>
>
> --
> Justin Deoliveira
>
> OpenGeo - http://opengeo.org
>
> Enterprise support for open source geospatial.
>
>
>
>
> ----------------------------------------------------------------------
> --------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond.
> Discussions will include endpoint security, mobile security and the
> latest in malware threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Geoserver-devel mailing list
> Geoserver-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>
>
>
>
> ----------------------------------------------------------------------
> --------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond.
> Discussions will include endpoint security, mobile security and the
> latest in malware threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Geoserver-devel mailing list
> Geoserver-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>
>
>
>
> ----------------------------------------------------------------------
> -------- Live Security Virtual Conference Exclusive live event will
> cover all the ways today's security and threat landscape has changed
> and how IT managers can respond. Discussions will include endpoint
> security, mobile security and the latest in malware threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________ Geoserver-devel
> mailing list Geoserver-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel




--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to