[Geoserver-users] GetFeature issue using POST method ("connection refused" to PostGIS)

Hello,
In order to setup a WFS server, I'm trying to use GeoServer on an Ubuntu
8.04 server with Postgres and the PostGIS extension;
I added a new Feature Data Set over PostGIS and it works fine with Demo
on GeoServer page, but I have an issue when I try to perform a
GetFeature using POST method.

If I use the following link (GET method), the server returns the correct
xml file

http://<myHostName>:<myPort>/geoserver/wfs?request=getfeature&typename=roads&service=wfs&version=1.0.0

but if I send the following xml message with 'curl' using POST method,
GeoServer throws a "java.net.ConnectException: Connection refused"
exception (see attached exception.txt file)

    <?xml version="1.0" encoding="UTF-8"?>
    <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:cgf="http://www.opengis.net/cite/geometry&quot; outputFormat="GML2"
version="1.0.0" service="WFS">
        <wfs:Query typeName="sf:roads">
        </wfs:Query>
    </wfs:GetFeature>

curl command is:
curl -T roads.xml -X POST http://<hostname>:<port>/geoserver/wfs

I tried to remove the namespace from the typeName (sf:), but the result
is the same.
The returned message is:

    <?xml version="1.0" ?>
    <ServiceExceptionReport
       version="1.2.0"
       xmlns="http://www.opengis.net/ogc&quot;
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
       xsi:schemaLocation="http://www.opengis.net/ogc
http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd&quot;&gt;
       <ServiceException>
          java.lang.RuntimeException: java.io.IOException
    java.io.IOException
    null
    null
    Connection test failed
    Cannot create PoolableConnectionFactory (Connection refused. Check
that the hostname and port are correct and that the postmaster is
accepting TCP/IP connections.)
    Connection refused. Check that the hostname and port are correct and
that the postmaster is accepting TCP/IP connections.
    Connection refused
    </ServiceException></ServiceExceptionReport>

Note that GetCapabilities works with both POST and GET methods.
POST: <wfs:GetCapabilities service="wfs"
xmlns:wfs="http://www.opengis.net/wfs&quot;/&gt;
GET:
http://<hostname>:<port>/geoserver/wfs?request=getcapabilities&service=wfs&version=1.0.0

Other information (software versions):
  Ubuntu Server 8.04.2
  GeoServer 1.7.3
  Apache Tomcat 5.5.17
  Postgres 8.3
  PostGIS 1.3.3
  PROJ Rel. 4.6.0, 21 Dec 2007
Trying with
  GEOS 2.2.3-CAPI-1.1.1
and
  GEOS 3.0.0-CAPI-1.4.1

Many thanks for any advice and best regards

Marco

--
Marco Bascetta

MEEO S.r.l.
Via Saragat 9
I-44122 Ferrara, Italy
Tel: +39 0532 1861501
Fax: +39 0533 1861637
http://www.meeo.it

========================================
"ATTENZIONE:le informazioni contenute in questo messaggio sono
da considerarsi confidenziali ed il loro utilizzo è riservato unicamente
al destinatario sopra indicato. Chi dovesse ricevere questo messaggio
per errore è tenuto ad informare il mittente ed a rimuoverlo
definitivamente da ogni supporto elettronico o cartaceo."

"WARNING:This message contains confidential and/or proprietary
information which may be subject to privilege or immunity and which
is intended for use of its addressee only. Should you receive this
message in error, you are kindly requested to inform the sender and
to definitively remove it from any paper or electronic format."

Bascetta Marco ha scritto:

Hello,
In order to setup a WFS server, I'm trying to use GeoServer on an Ubuntu
8.04 server with Postgres and the PostGIS extension;
I added a new Feature Data Set over PostGIS and it works fine with Demo
on GeoServer page, but I have an issue when I try to perform a
GetFeature using POST method.

If I use the following link (GET method), the server returns the correct
xml file

http://<myHostName>:<myPort>/geoserver/wfs?request=getfeature&typename=roads&service=wfs&version=1.0.0

but if I send the following xml message with 'curl' using POST method,
GeoServer throws a "java.net.ConnectException: Connection refused"
exception (see attached exception.txt file)

    <?xml version="1.0" encoding="UTF-8"?>
    <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:cgf="http://www.opengis.net/cite/geometry&quot; outputFormat="GML2"
version="1.0.0" service="WFS">
        <wfs:Query typeName="sf:roads">
        </wfs:Query>
    </wfs:GetFeature>

curl command is:
curl -T roads.xml -X POST http://<hostname>:<port>/geoserver/wfs

I tried to remove the namespace from the typeName (sf:), but the result
is the same.
The returned message is:

    <?xml version="1.0" ?>
    <ServiceExceptionReport
       version="1.2.0"
       xmlns="http://www.opengis.net/ogc&quot;
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
       xsi:schemaLocation="http://www.opengis.net/ogc
http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd&quot;&gt;
       <ServiceException>
          java.lang.RuntimeException: java.io.IOException
    java.io.IOException
    null
    null
    Connection test failed
    Cannot create PoolableConnectionFactory (Connection refused. Check
that the hostname and port are correct and that the postmaster is
accepting TCP/IP connections.)
    Connection refused. Check that the hostname and port are correct and
that the postmaster is accepting TCP/IP connections.
    Connection refused
    </ServiceException></ServiceExceptionReport>

Note that GetCapabilities works with both POST and GET methods.
POST: <wfs:GetCapabilities service="wfs"
xmlns:wfs="http://www.opengis.net/wfs&quot;/&gt;
GET:
http://<hostname>:<port>/geoserver/wfs?request=getcapabilities&service=wfs&version=1.0.0

Other information (software versions):
  Ubuntu Server 8.04.2
  GeoServer 1.7.3
  Apache Tomcat 5.5.17
  Postgres 8.3
  PostGIS 1.3.3
  PROJ Rel. 4.6.0, 21 Dec 2007
Trying with
  GEOS 2.2.3-CAPI-1.1.1
and
  GEOS 3.0.0-CAPI-1.4.1

Many thanks for any advice and best regards

Marco

Sorry, I forgot the attachment

Marco

--
Marco Bascetta

MEEO S.r.l.
Via Saragat 9
I-44122 Ferrara, Italy
Tel: +39 0532 1861501
Fax: +39 0533 1861637
http://www.meeo.it

========================================
"ATTENZIONE:le informazioni contenute in questo messaggio sono
da considerarsi confidenziali ed il loro utilizzo è riservato unicamente
al destinatario sopra indicato. Chi dovesse ricevere questo messaggio
per errore è tenuto ad informare il mittente ed a rimuoverlo
definitivamente da ogni supporto elettronico o cartaceo."

"WARNING:This message contains confidential and/or proprietary
information which may be subject to privilege or immunity and which
is intended for use of its addressee only. Should you receive this
message in error, you are kindly requested to inform the sender and
to definitively remove it from any paper or electronic format."

exception.txt (10.3 KB)

Bascetta Marco ha scritto:

    Connection refused. Check that the hostname and port are correct and
that the postmaster is accepting TCP/IP connections.

This is just what it says I guess... the connection parameters you
specified in the datastore configuration are wrong (but you should
have got an error when you specified those and submitted) or the
server has gone down, or the username/password combination changed
in the meantime, or the configuration of postgres has been changed
so that it does not accept anymore tcp/ip connection, or... well,
you get the idea.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Andrea Aime ha scritto:

Bascetta Marco ha scritto:

    Connection refused. Check that the hostname and port are correct and
that the postmaster is accepting TCP/IP connections.

This is just what it says I guess... the connection parameters you
specified in the datastore configuration are wrong (but you should
have got an error when you specified those and submitted) or the
server has gone down, or the username/password combination changed
in the meantime, or the configuration of postgres has been changed
so that it does not accept anymore tcp/ip connection, or... well,
you get the idea.

Cheers
Andrea

Thanks, but in the first message I wrote:
"If I use the following link (GET method), the server returns the
correct xml file" and "it works fine with Demo on GeoServer page"
So the configuration in datastore of postgres parameters are correct (I
rechecked).

I tried the sequence GET,POST,GET,POST,GET,GET,POST,POST,GET and only
the GET method return successfully.

Any other suggestion?

Regards
  Marco

--
Marco Bascetta

MEEO S.r.l.
Via Saragat 9
I-44122 Ferrara, Italy
Tel: +39 0532 1861501
Fax: +39 0533 1861637
http://www.meeo.it

========================================
"ATTENZIONE:le informazioni contenute in questo messaggio sono
da considerarsi confidenziali ed il loro utilizzo è riservato unicamente
al destinatario sopra indicato. Chi dovesse ricevere questo messaggio
per errore è tenuto ad informare il mittente ed a rimuoverlo
definitivamente da ogni supporto elettronico o cartaceo."

"WARNING:This message contains confidential and/or proprietary
information which may be subject to privilege or immunity and which
is intended for use of its addressee only. Should you receive this
message in error, you are kindly requested to inform the sender and
to definitively remove it from any paper or electronic format."

Bascetta Marco ha scritto:

Andrea Aime ha scritto:

Bascetta Marco ha scritto:

    Connection refused. Check that the hostname and port are correct and
that the postmaster is accepting TCP/IP connections.

This is just what it says I guess... the connection parameters you
specified in the datastore configuration are wrong (but you should
have got an error when you specified those and submitted) or the
server has gone down, or the username/password combination changed
in the meantime, or the configuration of postgres has been changed
so that it does not accept anymore tcp/ip connection, or... well,
you get the idea.

Cheers
Andrea

Thanks, but in the first message I wrote:
"If I use the following link (GET method), the server returns the
correct xml file" and "it works fine with Demo on GeoServer page"
So the configuration in datastore of postgres parameters are correct (I
rechecked).

I tried the sequence GET,POST,GET,POST,GET,GET,POST,POST,GET and only
the GET method return successfully.

Any other suggestion?

Aah, now I get it, sorry. GET and POST differ in how the request
is parsed. The latter need to know the xml schema of all the feature
types registered against the server before starting the parse,
so what is probably happening is that you have one postgis datastore
that is not connecting anymore in your configuration, and this
is preventing all the WFS POST usage (if my hp is correct it
will blow up any WFS 1.1 GET request as well)

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Andrea Aime ha scritto:

Bascetta Marco ha scritto:

Andrea Aime ha scritto:

Bascetta Marco ha scritto:

    Connection refused. Check that the hostname and port are
correct and
that the postmaster is accepting TCP/IP connections.

This is just what it says I guess... the connection parameters you
specified in the datastore configuration are wrong (but you should
have got an error when you specified those and submitted) or the
server has gone down, or the username/password combination changed
in the meantime, or the configuration of postgres has been changed
so that it does not accept anymore tcp/ip connection, or... well,
you get the idea.

Cheers
Andrea

Thanks, but in the first message I wrote:
"If I use the following link (GET method), the server returns the
correct xml file" and "it works fine with Demo on GeoServer page"
So the configuration in datastore of postgres parameters are correct (I
rechecked).

I tried the sequence GET,POST,GET,POST,GET,GET,POST,POST,GET and only
the GET method return successfully.

Any other suggestion?

Aah, now I get it, sorry. GET and POST differ in how the request
is parsed. The latter need to know the xml schema of all the feature
types registered against the server before starting the parse,
so what is probably happening is that you have one postgis datastore
that is not connecting anymore in your configuration, and this
is preventing all the WFS POST usage (if my hp is correct it
will blow up any WFS 1.1 GET request as well)

Cheers
Andrea

Thank you very much...

We have two host with two machine. One of them is down... so I had to
delete this feature and datastore to view POST working.
( Note: WFS 1.0.0 and 1.1 GET requests work always. )

If one host has to undergo maintenance, it will bring down the entire
server... is there a way to avoid such behavior? Is it a bug or a
planned feature in future releases?

Many thanks
  Marco
--
Marco Bascetta

MEEO S.r.l.
Via Saragat 9
I-44122 Ferrara, Italy
Tel: +39 0532 1861501
Fax: +39 0533 1861637
http://www.meeo.it

========================================
"ATTENZIONE:le informazioni contenute in questo messaggio sono
da considerarsi confidenziali ed il loro utilizzo è riservato unicamente
al destinatario sopra indicato. Chi dovesse ricevere questo messaggio
per errore è tenuto ad informare il mittente ed a rimuoverlo
definitivamente da ogni supporto elettronico o cartaceo."

"WARNING:This message contains confidential and/or proprietary
information which may be subject to privilege or immunity and which
is intended for use of its addressee only. Should you receive this
message in error, you are kindly requested to inform the sender and
to definitively remove it from any paper or electronic format."

Bascetta Marco ha scritto:

Thank you very much...

We have two host with two machine. One of them is down... so I had to
delete this feature and datastore to view POST working.
( Note: WFS 1.0.0 and 1.1 GET requests work always. )

If one host has to undergo maintenance, it will bring down the entire
server... is there a way to avoid such behavior? Is it a bug or a
planned feature in future releases?

It is something I noticed just recently myself:
http://jira.codehaus.org/browse/GEOS-3049

Hopefully we'll fix it soon, atm it's just not clear what the
best path is, there are a few options we're discussing.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.