Hello everyone,

 

I'm a newbie of geotools. I'm trying to build a simple WFS server.

 

I have found an example of using org.geotools.xml.DocumentWriter to create an XML file to describe the Query. Like this:

Map hints = new HashMap();

File f = new File(“query.xml”);

hints.put(DocumentWriter.BASE_ELEMENT, WFSSchema.getInstance().getElements()[2]);      

 

try {

      DocumentWriter.writeDocument(query, WFSSchema.getInstance(), f, hints);

   }

catch (OperationNotSupportedException e) { }

 

 

I'm wondering if I could use to use DocumentWriter to generate the "WFS_capabilities" xml document.  I have tried the following:

 

WFSCapabilities capabilities =   //First I get a WFSCapabilities object from MyWFSDataStore which extends from WFSDataStore

 

Map hints = new HashMap();

File f = new File(“capabilities.xml”);

hints.put(DocumentWriter.BASE_ELEMENT, WFSSchema.getInstance().getElements()[18]); //which is “WFS_Capabilities      

hints.put(DocumentWriter.SCHEMA_ORDER,new String[] {"http://www.opengis.net/wfs",”http://www.openplans.org/topp”});

 

try {

      DocumentWriter.writeDocument(capabilities, WFSSchema.getInstance(), f, hints);

   }

catch (OperationNotSupportedException e) { }

 

 

 

But the code doesn’t work. The error said

javax.naming.OperationNotSupportedException: Could not find an appropriate Element to use for encoding of a org.geotools.data.ows.WFSCapabilities

      at org.geotools.xml.DocumentWriter.writeFragment(DocumentWriter.java:312)

      at org.geotools.xml.DocumentWriter.writeDocument(DocumentWriter.java:209)

      at org.geotools.xml.DocumentWriter.writeDocument(DocumentWriter.java:163)

 

Can anyone help me out what the capabilities object should be, and how to set the hints??

 

Thanks in advancing.

 

Jack

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to