[mapserver-users] tinyows

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Tue Nov 13 01:41:03 PST 2012


Hi,

On this page there are some WFS calls which do work against my TinyOWS server http://188.64.1.61/cgi-bin/tinyows.  Feel free to use it for testing.
http://latuviitta.org/Http-POST-ja-Filter.php

A very easy to use tool for testing POST requests is the Poster Firefox extension. This image shows how to use it. It is so simple that it should not matter that the texts I have added are in Finnish http://latuviitta.org/documents/WFS_POST_Poster.png.

-Jukka Rahkonen-

aho wrote:

> Hi Alexandre,
> 
> ok, I changed to '<wfs:...', removed the Filter and got this in my -O test.txt
> file:
> 
> <?xml version='1.0' encoding='UTF-8'?>
> <ows:ExceptionReport
>   xmlns='http://www.opengis.net/ows'
>   xmlns:ows='http://www.opengis.net/ows'
>   xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
>   xsi:schemaLocation='http://www.opengis.net/ows
> http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd'
>   version='1.1.0' language='en'>
>   <ows:Exception exceptionCode='InvalidParameterValue' locator='request'>
>    <ows:ExceptionText>xml isn't valid</ows:ExceptionText>
>   </ows:Exception>
> </ows:ExceptionReport>
> 
> This is always the same actually.
> 
> This was the result and the adjusted wget command:
> 
> C:\Users\Anna>wget "http://localhost/cgi-bin/tinyows.exe
> --post-data='<wfs:GetFe
> ature xmlns:wfs="http://www.opengis.net/wfs" service="WFS"
> version="1.1.0" xsi:s
> chemaLocation="http://www.opengis.net/wfs
> http://schemas.opengis.net/wfs/1.1.0/w
> fs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
> instance"><wfs:Query
> typeNam
> e="feature:frida" srsName="EPSG:31467"
> xmlns:feature="http://127.0.0.1/"></wfs:Q
> uery></wfs:GetFeature>' --header="Content-Type: application/xml;
> charset=UTF-8"
> -O C:\test.txt
> 
> SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc syswgetrc =
> C:\OSGeo4W\GnuWin32/etc/wgetrc
> --2012-11-13 10:07:35--
> http://localhost/cgi-bin/tinyows.exe%20--post-data='%3C
> wfs:GetFeature%20xmlns:wfs=http://www.opengis.net/wfs%20service=WF
> S%20version=1.
> 1.0%20xsi:schemaLocation=http://www.opengis.net/wfs
> Resolving localhost... 127.0.0.1, ::1
> Connecting to localhost|127.0.0.1|:80... connected.
> HTTP request sent, awaiting response... 404 Not Found
> 2012-11-13 10:07:35 ERROR 404: Not Found.
> 
> --2012-11-13 10:07:35--
> http://schemas.opengis.net/wfs/1.1.0/wfs.xsd%20xmlns:xs
> i=http://www.w3.org/2001/XMLSchema-
> instance%3E%3Cwfs:Query%20typeName=feature:fr
> ida%20srsName=EPSG:31467%20xmlns:feature=http://127.0.0.1/%3E%3C/wf
> s:Query%3E%3C
> /wfs:GetFeature%3E'%20--header=Content-Type:
> Resolving schemas.opengis.net... 66.244.86.52 Connecting to
> schemas.opengis.net|66.244.86.52|:80... connected.
> HTTP request sent, awaiting response... 404 Not Found
> 2012-11-13 10:07:35 ERROR 404: Not Found.
> 
> --2012-11-13 10:07:35--  http://application/xml; Resolving application... failed:
> No data record of requested type.
> wget: unable to resolve host address `application'
> --2012-11-13 10:07:38--  ftp://charset=utf-8%20-o%20c/%5Ctest.txt
>             => `%5Ctest.txt'
> Resolving charset=utf-8 -o c... failed: No data record of requested type.
> wget: unable to resolve host address `charset=utf-8 -o c'
> 
> Something is wrong with the host - maybe there is something missing in the
> tinyows configuration. Because now wget takes the application as the
> address instead of the coordinates of the bounding box!?
> I took the same ns_prefix: feature because its also defined like that in my
> xml -- I changed it, because i read that recommendation somewhere - made
> no difference.
> 
> 
> 
> 
> Am 11/12/2012 5:05 PM, schrieb Alexandre Dubé:
> > Anna,
> >
> >   What does your C:\ms4w\Apache\logs\tinows.log file contain ?
> >
> >   Also yeah you should use --post-data='<wfs:GetFeature...' and not
> > --post-data="<wfs:GetFeature...".  If your dataset isn't too big, you
> > could remove the <ogc:Filter> node.  Also, try replacing
> > xmlns:feature="http://127.0.0.1/" by xmlns:tows="http://127.0.0.1/".
> >
> > HTH,
> >
> > Alexandre
> >
> >
> > On 12-11-12 10:31 AM, aho wrote:
> >> Hi Alexandre,
> >>
> >> I already reinstalled pyhton and made the configuration of the apache
> >> server again. At least one thing I can exclude - specially because
> >> sooner or later I have to include it in another project which needs
> >> to run on a certain port. Anyhow... I also installed the wget and you
> >> are right, it helps a lot.
> >> I took the GetFeature xml from chrome and constructed the following
> >> line:
> >>
> >> wget "http://localhost/cgi-bin/tinyows.exe" --post-data="<wfs:GetF
> >> eature xmlns:wfs="http://www.opengis.net/wfs" service="WFS"
> >> version="1.0.0" outp
> >> utFormat="application/json"
> >> xsi:schemaLocation="http://schemas.opengis.net/wfs/1
> >> .0.0/WFS-transaction.xsd"
> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> >> <wfs:Query typeName="feature:frida"
> >> xmlns:feature="http://127.0.0.1/"><ogc:Filte
> >> r
> >>
> xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName
> >th
> >> e_geom</o gc:PropertyName><gml:Box
> >> xmlns:gml="http://www.opengis.net/gml"
> >> srsName="EPSG:31
> >> 467"><gml:coordinates decimal="." cs="," ts=" ">3413084,5782000
> >> 3457916,5806000<
> >>
> /gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter></wfs:Query></wfs:
> >> GetFeature>
> >>
> >> " --header="Content-Type: application/xml; charset=UTF-8" -O
> >> C:/test.txt
> >>
> >> wget returned:
> >>
> >> SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc syswgetrc =
> >> C:\OSGeo4W\GnuWin32/etc/wgetrc
> >> --2012-11-12 16:17:16--  http://localhost/cgi-bin/tinyows.exe
> >> Resolving localhost... 127.0.0.1, ::1 Connecting to
> >> localhost|127.0.0.1|:80... connected.
> >> HTTP request sent, awaiting response... 200 OK
> >> Length: unspecified [application/xml] Saving to: `C:/test.txt'
> >>     [ <=>                                   ] 503 --.-K/s in 0s
> >>
> >> 2012-11-12 16:17:16 (11.4 MB/s) - `C:/test.txt' saved [503]
> >> --2012-11-12 16:17:16--
> >> http://%3E3413084,5782000%203457916,5806000%3C/gml:coor
> >>
> dinates%3E%3C/gml:Box%3E%3C/ogc:BBOX%3E%3C/ogc:Filter%3E%3C/wfs:
> Query%3E%3C/wfs:
> >>
> >> GetFeature%3E
> >> Resolving >3413084,5782000 3457916,5806000<... failed: No data record
> >> of request ed type.
> >> wget: unable to resolve host address `>3413084,5782000
> 3457916,5806000<'
> >> FINISHED --2012-11-12 16:17:17--
> >> Downloaded: 1 files, 503 in 0s (11.4 MB/s)
> >>
> >>
> >> I have really no idea why it is using the coordinates of the bounding
> >> box for the host?! I thought it would be a problem of wget and the
> >> quotation marks... but changing that to ' did not solve the problem.
> >> In my test.txt is still the same response: invalid xml. Nothing else
> >> unfortunately. I think its a problem in my openlayers configuration -
> >> I check the spatial reference again; maybe I can also set the bbox or
> >> something. I will see...
> >>
> >> If you or anyone else has an idea I will be very happy!
> >> Anna
> >>
> >> Am 11/12/2012 2:42 PM, schrieb Alexandre Dubé:
> >>> Hi Anna,
> >>>
> >>>   While working locally, you don't need to set an
> >>> OpenLayers.ProxyHost.  Put comments // in front of it for now.
> >>>
> >>>   tinyows-1.0.0-weather-sites.fcgi -> copy your tinyows.exe file
> >>> giving it the name you want.  In Linux, you could use a symbolic
> >>> link, like I did.  Here's the apache config for it. It does 2 things
> >>> : it enables FastCgi and set the TINYOWS_CONFIG_FILE env variable
> >>> for this link to use a specific .xml config file.
> >>>
> >>> ###
> >>> FastCgiServer /usr/lib/cgi-bin/tinyows-1.0.0-weather-sites.fcgi
> >>> -initial-env
> >>> TINYOWS_CONFIG_FILE=/opt/labs/weather-
> sites/etc/tinyows/config.xml
> >>> ScriptAlias "/weather-sites-tinyows-1.0.0.fcgi"
> >>> "/usr/lib/cgi-bin/tinyows-1.0.0-weather-sites.fcgi"
> >>> ###
> >>>
> >>> Once you start using wget, the idea is to edit the xml GetFeature
> >>> request sent and/or the config.xml file as you try it to quickly see
> >>> what causes things to not work.  Point to tinyows for now, you your
> >>> proxy (yet), i.e. make your tinyows work first.
> >>>
> >>> Best regards,
> >>>
> >>> Alexandre
> >>>
> >>>
> >>> On 12-11-12 04:05 AM, aho wrote:
> >>>> Hi Alexandre,
> >>>>
> >>>> thanks for the good hints! This is really great! I think its not my
> >>>> tinyows.xml or the Openlayers... but the error message tells
> >>>> something else somehow... :(...  I changed it to the following:
> >>>> xml configuration of tinyows:
> >>>>
> >>>> <tinyows online_resource="http://127.0.0.1/cgi-bin/tinyows.exe"
> >>>>        schema_dir="C:\ms4w\apps\tinyows\schema\"
> >>>>        log="C:\ms4w\Apache\logs\tinows.log" log_level="15">
> >>>> <pg host="127.0.0.1" user="postgres" password="postgres"
> >>>> dbname="tinyows" port="5432"/>
> >>>> <metadata name="TinyOWS Server"
> >>>>           title="TinyOWS Server - WFS-T Frida Service" />
> >>>> <contact name="TinyOWS Server"
> >>>>          site="http://www.tinyows.org/"
> >>>>          email="tinyows-users at lists.maptools.org" />
> >>>> <layer retrievable="1"
> >>>>         writable="1"
> >>>>        ns_prefix="tows"
> >>>>        ns_uri="http://127.0.0.1/"
> >>>>        name="frida"
> >>>>        title="Frida Parks" />
> >>>> </tinyows>
> >>>>
> >>>> and the OpenLayers code:
> >>>>
> >>>>   map = new OpenLayers.Map('map', {
> >>>>       projection: new OpenLayers.Projection("EPSG:31467"),
> >>>>       units: "m",
> >>>>       maxResolution: "auto",
> >>>>       maxExtent: new
> >>>> OpenLayers.Bounds(3427000,5788000,3444000,5800000),
> >>>>       controls: [
> >>>>           new OpenLayers.Control.PanZoom()
> >>>>       ]
> >>>>   });
> >>>>   var osm = new OpenLayers.Layer.WMS(
> >>>>       "OSM by Omniscale WMS",
> >>>>       "http://osm.omniscale.net/proxy/service",
> >>>>       {layers: 'osm', format: 'image/jpeg'},
> >>>>       {projection:"EPSG:31467",  units: "m", maxResolution: "auto",
> >>>> maxExtent: new
> OpenLayers.Bounds(3427000,5788000,3444000,5800000)}
> >>>>   );
> >>>>   var saveStrategy = new OpenLayers.Strategy.Save();
> >>>>   saveStrategy.events.register("success", '', showSuccessMsg);
> >>>>   saveStrategy.events.register("fail", '', showFailureMsg);
> >>>>   var wfs = new OpenLayers.Layer.Vector("Editable Features", {
> >>>>       strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
> >>>>       projection: new OpenLayers.Projection("EPSG:31467"),
> >>>>       protocol: new OpenLayers.Protocol.WFS({
> >>>>             version:"1.1.0",
> >>>>           url: "http://127.0.0.1/cgi-bin/tinyows.exe",
> >>>>           featureType: "frida",
> >>>>           outputformat:"application/json",
> >>>>           readFormat: new OpenLayers.Format.GeoJSON(),
> >>>>           featureNS: "http://127.0.0.1/",
> >>>>           geometryName: "the_geom"
> >>>>       })
> >>>> });
> >>>>   map.addLayers([osm, wfs]);
> >>>>
> >>>>   map.zoomToMaxExtent();
> >>>>
> >>>> The layer is actually in  31467 - I want to get it working for the
> >>>> frida parks example. I reduced everything else in my javascript file.
> >>>>
> >>>> But I think I have a problem with my configuration. I am setting
> >>>> the following in OpenLayers: OpenLayers.ProxyHost =
> >>>> "/cgi-bin/proxy.cgi?url="; and I saw that you were actually
> >>>> refering to a fcgi file in your config.xml. I thought I could
> >>>> define there the path to the tinyows.exe like this:
> >>>> http://127.0.0.1/cgi-bin/tinyows.exe - do I also give the proxy there?
> >>>> Could you send me the content of your
> >>>> weather-sites-tinyows-1.0.0.fcgi file? I have to say that I can´t
> >>>> follow your instructions for setting the environment variable - I
> >>>> made that via the control Panel :) - and the ScriptAlias.
> >>>>
> >>>> I have to install the wget first on windows, but thanks for that
> >>>> hint - I will try it after the restart now!
> >>>>
> >>>> Thanks in advance,
> >>>> Anna
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> Am 11/9/2012 2:50 PM, schrieb Alexandre Dubé:
> >>>>> ### The apache config used to bind TinyOWS to this config using a
> >>>>> different url
> >>>>> FastCgiServer /usr/lib/cgi-bin/tinyows-1.0.0-weather-sites.fcgi
> >>>>> -initial-env
> >>>>> TINYOWS_CONFIG_FILE=/opt/labs/weather-
> sites/etc/tinyows/config.xml
> >>>>> ScriptAlias "/weather-sites-tinyows-1.0.0.fcgi"
> >>>>> "/usr/lib/cgi-bin/tinyows-1.0.0-weather-sites.fcgi"
> >>>>
> >>>
> >>>
> >>
> >
> >
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list