[Geoserver-users] WFS-Post Request via Java, no success?

Hello folks,

I'm trying to do a wfs post request via java to the geoserver. I just want to do a simple getFeature Requst. For testing I took the xml body from the demo page. (WFS_getFeature_1.0.xml). Error and Java Code following...

Error response:
------------------------------------------------
"<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/ows http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:ows="http://www.opengis.net/ows&quot;&gt;
<ows:Exception exceptionCode="MissingParameterValue" locator="request">
<ows:ExceptionText>Could not determine geoserver request
   from http request org.apache.catalina.connector.RequestFacade@anonymised.com</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>"
------------------------------------------------

Here's my Java Code:
------------------------------------------------
public void postTest() throws Exception{
     URL url = new URL ("http://localhost:8080/geoserver/wfs&quot;\);
     String xml ="<wfs:GetFeature service='WFS' version='1.0.0' outputFormat='GML2' xmlns:topp='http://www.openplans.org/topp’ xmlns:wfs='http://www.opengis.net/wfs’ xmlns:ogc='http://www.opengis.net/ogc’ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance’ xsi:schemaLocation='http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd’><wfs:Query typeName='topp:states'><ogc:Filter><ogc:FeatureId fid='states.3'/></ogc:Filter></wfs:Query></wfs:GetFeature>";
     String tmp = null;
           // Get connection
     URLConnection urlConn = url.openConnection();
     urlConn.setDoInput (true);
     urlConn.setDoOutput (true);
     urlConn.setUseCaches (false);
     urlConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
           // Write output
     DataOutputStream printout = new DataOutputStream (urlConn.getOutputStream ());
     String data = URLEncoder.encode("url", "UTF-8") + "=" + URLEncoder.encode("http://localhost:8080/geoserver/wfs&quot;, "UTF-8");
            data += "&" + URLEncoder.encode("body", "UTF-8") + "=" + URLEncoder.encode(xml, "UTF-8");
            data += "&" + URLEncoder.encode("username", "UTF-8") + "=" + URLEncoder.encode("admin", "UTF-8");
            data += "&" + URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode("geoserver", "UTF-8");
     printout.writeBytes (data);
     printout.flush ();
     printout.close ();
           // Get response
     DataInputStream input = new DataInputStream (urlConn.getInputStream ());
           while (null != ((tmp = input.readLine())))
         System.out.println (tmp);

     input.close();
}
------------------------------------------------

The console says:
09 Jun 14:07:48 INFO [geoserver.filters] - 127.0.0.1 "POST /geoserver/wfs" took 221ms
09 Jun 14:08:16 INFO [geoserver.filters] - 127.0.0.1 "POST /geoserver/wfs" "Java/1.6.0_03" ""
09 Jun 14:08:16 WARN [geoserver.ows] -
org.geoserver.platform.ServiceException: Could not determine geoserver request from http request org
.apache.catalina.connector.RequestFacade@anonymised.com
....

What's the problem? Maybe someone of you can help me.

Regards,
Sebastian

Hi Sebastian,

The problem here is the use of the content type "x-www-form...". When GeoServer sees this content type it essentially treats the request as a GET pulling the kvp's from the body rather than the header.

So in this case it sees three key value pairs: body, username + password. The problem is that "body" is not recognized to be special... so it wont parse it as xml or anything.

Anyways, to get this to work i believe you will have to change the content type to "text/xml" or "application/xml". Now to send the username and password you need to use the "Authorization" header in the request. Something like this:

HttpURLConnection conn = ...;

String username = "...";
String password = "...";

byte b = Base64.encodeBase64(username + ":" + password);
String authHeader = "Basic " + new String(b);

conn.setRequestProperty("Authorization", authHeader);

Hope that helps,

-Justin

Sebastian wrote:

Hello folks,

I'm trying to do a wfs post request via java to the geoserver. I just want to do a simple getFeature Requst. For testing I took the xml body from the demo page. (WFS_getFeature_1.0.xml). Error and Java Code following...

Error response:
------------------------------------------------
"<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/ows http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:ows="http://www.opengis.net/ows&quot;&gt;
<ows:Exception exceptionCode="MissingParameterValue" locator="request">
<ows:ExceptionText>Could not determine geoserver request
   from http request org.apache.catalina.connector.RequestFacade@anonymised.com</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>"
------------------------------------------------

Here's my Java Code:
------------------------------------------------
public void postTest() throws Exception{
     URL url = new URL ("http://localhost:8080/geoserver/wfs&quot;\);
     String xml ="<wfs:GetFeature service='WFS' version='1.0.0' outputFormat='GML2' xmlns:topp='http://www.openplans.org/topp’ xmlns:wfs='http://www.opengis.net/wfs’ xmlns:ogc='http://www.opengis.net/ogc’ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance’ xsi:schemaLocation='http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd’><wfs:Query typeName='topp:states'><ogc:Filter><ogc:FeatureId fid='states.3'/></ogc:Filter></wfs:Query></wfs:GetFeature>";
     String tmp = null;
           // Get connection
     URLConnection urlConn = url.openConnection();
     urlConn.setDoInput (true);
     urlConn.setDoOutput (true);
     urlConn.setUseCaches (false);
     urlConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
           // Write output
     DataOutputStream printout = new DataOutputStream (urlConn.getOutputStream ());
     String data = URLEncoder.encode("url", "UTF-8") + "=" + URLEncoder.encode("http://localhost:8080/geoserver/wfs&quot;, "UTF-8");
            data += "&" + URLEncoder.encode("body", "UTF-8") + "=" + URLEncoder.encode(xml, "UTF-8");
            data += "&" + URLEncoder.encode("username", "UTF-8") + "=" + URLEncoder.encode("admin", "UTF-8");
            data += "&" + URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode("geoserver", "UTF-8");
     printout.writeBytes (data);
     printout.flush ();
     printout.close ();
           // Get response
     DataInputStream input = new DataInputStream (urlConn.getInputStream ());
           while (null != ((tmp = input.readLine())))
         System.out.println (tmp);

     input.close();
}
------------------------------------------------

The console says:
09 Jun 14:07:48 INFO [geoserver.filters] - 127.0.0.1 "POST /geoserver/wfs" took 221ms
09 Jun 14:08:16 INFO [geoserver.filters] - 127.0.0.1 "POST /geoserver/wfs" "Java/1.6.0_03" ""
09 Jun 14:08:16 WARN [geoserver.ows] -
org.geoserver.platform.ServiceException: Could not determine geoserver request from http request org
.apache.catalina.connector.RequestFacade@anonymised.com
....

What's the problem? Maybe someone of you can help me.

Regards,
Sebastian

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4007,484dac34232693668746562!

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

Sebastian ha scritto:

Hello folks,

I'm trying to do a wfs post request via java to the geoserver. I just want to do a simple getFeature Requst. For testing I took the xml body from the demo page. (WFS_getFeature_1.0.xml). Error and Java Code following...

Error response:
------------------------------------------------
"<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/ows http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:ows="http://www.opengis.net/ows&quot;&gt;
<ows:Exception exceptionCode="MissingParameterValue" locator="request">
<ows:ExceptionText>Could not determine geoserver request
   from http request org.apache.catalina.connector.RequestFacade@anonymised.com</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>"
------------------------------------------------

Here's my Java Code:
------------------------------------------------
public void postTest() throws Exception{
     URL url = new URL ("http://localhost:8080/geoserver/wfs&quot;\);
     String xml ="<wfs:GetFeature service='WFS' version='1.0.0' outputFormat='GML2' xmlns:topp='http://www.openplans.org/topp’ xmlns:wfs='http://www.opengis.net/wfs’ xmlns:ogc='http://www.opengis.net/ogc’ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance’ xsi:schemaLocation='http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd’><wfs:Query typeName='topp:states'><ogc:Filter><ogc:FeatureId fid='states.3'/></ogc:Filter></wfs:Query></wfs:GetFeature>";
     String tmp = null;
           // Get connection
     URLConnection urlConn = url.openConnection();
     urlConn.setDoInput (true);
     urlConn.setDoOutput (true);
     urlConn.setUseCaches (false);
     urlConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
           // Write output
     DataOutputStream printout = new DataOutputStream (urlConn.getOutputStream ());
     String data = URLEncoder.encode("url", "UTF-8") + "=" + URLEncoder.encode("http://localhost:8080/geoserver/wfs&quot;, "UTF-8");
            data += "&" + URLEncoder.encode("body", "UTF-8") + "=" + URLEncoder.encode(xml, "UTF-8");
            data += "&" + URLEncoder.encode("username", "UTF-8") + "=" + URLEncoder.encode("admin", "UTF-8");
            data += "&" + URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode("geoserver", "UTF-8");
     printout.writeBytes (data);
     printout.flush ();
     printout.close ();
           // Get response
     DataInputStream input = new DataInputStream (urlConn.getInputStream ());
           while (null != ((tmp = input.readLine())))
         System.out.println (tmp);

     input.close();
}
------------------------------------------------

The console says:
09 Jun 14:07:48 INFO [geoserver.filters] - 127.0.0.1 "POST /geoserver/wfs" took 221ms
09 Jun 14:08:16 INFO [geoserver.filters] - 127.0.0.1 "POST /geoserver/wfs" "Java/1.6.0_03" ""
09 Jun 14:08:16 WARN [geoserver.ows] -
org.geoserver.platform.ServiceException: Could not determine geoserver request from http request org
.apache.catalina.connector.RequestFacade@anonymised.com
....

What's the problem? Maybe someone of you can help me.

Hum, I'd say wrong MIME type:
http://geoserver.org/display/GEOSDOC/My+WFS+POST+does+not+work.

Cheers
Andrea

Andrea Aime schrieb:

Sebastian ha scritto:

Hello folks,

I'm trying to do a wfs post request via java to the geoserver. I just want to do a simple getFeature Requst. For testing I took the xml body from the demo page. (WFS_getFeature_1.0.xml). Error and Java Code following...

Error response:
------------------------------------------------
"<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/ows http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd&quot;

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:ows="http://www.opengis.net/ows&quot;&gt;
<ows:Exception exceptionCode="MissingParameterValue" locator="request">
<ows:ExceptionText>Could not determine geoserver request
   from http request org.apache.catalina.connector.RequestFacade@anonymised.com</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>"
------------------------------------------------

Here's my Java Code:
------------------------------------------------
public void postTest() throws Exception{
     URL url = new URL ("http://localhost:8080/geoserver/wfs&quot;\);
     String xml ="<wfs:GetFeature service='WFS' version='1.0.0' outputFormat='GML2' xmlns:topp='http://www.openplans.org/topp’ xmlns:wfs='http://www.opengis.net/wfs’ xmlns:ogc='http://www.opengis.net/ogc’ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance’ xsi:schemaLocation='http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd’><wfs:Query typeName='topp:states'><ogc:Filter><ogc:FeatureId fid='states.3'/></ogc:Filter></wfs:Query></wfs:GetFeature>";
     String tmp = null;
           // Get connection
     URLConnection urlConn = url.openConnection();
     urlConn.setDoInput (true);
     urlConn.setDoOutput (true);
     urlConn.setUseCaches (false);
     urlConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
           // Write output
     DataOutputStream printout = new DataOutputStream (urlConn.getOutputStream ());
     String data = URLEncoder.encode("url", "UTF-8") + "=" + URLEncoder.encode("http://localhost:8080/geoserver/wfs&quot;, "UTF-8");
            data += "&" + URLEncoder.encode("body", "UTF-8") + "=" + URLEncoder.encode(xml, "UTF-8");
            data += "&" + URLEncoder.encode("username", "UTF-8") + "=" + URLEncoder.encode("admin", "UTF-8");
            data += "&" + URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode("geoserver", "UTF-8");
     printout.writeBytes (data);
     printout.flush ();
     printout.close ();
           // Get response
     DataInputStream input = new DataInputStream (urlConn.getInputStream ());
           while (null != ((tmp = input.readLine())))
         System.out.println (tmp);

     input.close();
}
------------------------------------------------

The console says:
09 Jun 14:07:48 INFO [geoserver.filters] - 127.0.0.1 "POST /geoserver/wfs" took 221ms
09 Jun 14:08:16 INFO [geoserver.filters] - 127.0.0.1 "POST /geoserver/wfs" "Java/1.6.0_03" ""
09 Jun 14:08:16 WARN [geoserver.ows] -
org.geoserver.platform.ServiceException: Could not determine geoserver request from http request org
.apache.catalina.connector.RequestFacade@anonymised.com
....

What's the problem? Maybe someone of you can help me.

Hum, I'd say wrong MIME type:
http://geoserver.org/display/GEOSDOC/My+WFS+POST+does+not+work.

Cheers
Andrea

I changed the mime-type to application/xml but now I get a
"NoApplicableCode" Exception:

------------------
<ows:Exception exceptionCode="NoApplicableCode">

    <ows:ExceptionText>org.xmlpull.v1.XmlPullParserException:
      only whitespace content allowed before start tag and
      not u (position: START_DOCUMENT seen u... @1:1) only
      whitespace content allowed before start tag and not u
      (position: START_DOCUMENT seen u... @1:1) </ows:ExceptionText>
  </ows:Exception>
------------------

I think the xml body isn't recognized, what attribute name do I need?

Regards and Thanks,
Sebastian

------------------
<ows:Exception exceptionCode="NoApplicableCode">

    <ows:ExceptionText>org.xmlpull.v1.XmlPullParserException:
      only whitespace content allowed before start tag and
      not u (position: START_DOCUMENT seen u... @1:1) only
      whitespace content allowed before start tag and not u
      (position: START_DOCUMENT seen u... @1:1) </ows:ExceptionText>
  </ows:Exception>
------------------

I think the xml body isn't recognized, what attribute name do I need?

Did you remove the url encoding of the xml? It looks like it is still being sent encoded.

Regards and Thanks,
Sebastian

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4007,48501b40201447180515871!

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

On Thu, 12 Jun 2008 08:35:20 -0700, Justin Deoliveira

<jdeolive@anonymised.com> wrote:

------------------

<ows:Exception exceptionCode="NoApplicableCode">

    <ows:ExceptionText>org.xmlpull.v1.XmlPullParserException:

      only whitespace content allowed before start tag and

      not u (position: START_DOCUMENT seen u... @1:1) only

      whitespace content allowed before start tag and not u

      (position: START_DOCUMENT seen u... @1:1) </ows:ExceptionText>

  </ows:Exception>

------------------

I think the xml body isn't recognized, what attribute name do I need?

Did you remove the url encoding of the xml? It looks like it is still

being sent encoded.

Regards and Thanks,

Sebastian

-------------------------------------------------------------------------

Check out the new SourceForge.net Marketplace.

It's the best place to buy or sell services for

just about anything Open Source.

http://sourceforge.net/services/buy/index.php

_______________________________________________

Geoserver-users mailing list

Geoserver-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4007,48501b40201447180515871!

--

Justin Deoliveira

The Open Planning Project

jdeolive@anonymised.com

Hmm... thats my code now:

--------------

      URL url = new URL ("http://localhost:8080/geoserver/wfs&quot;\);

      String xml = "<wfs:Transaction .... </wfs:Transaction>";

      String tmp = null;

      // Get connection

      URLConnection conn = url.openConnection();

      conn.setDoInput (true);

      conn.setDoOutput (true);

      conn.setUseCaches (false);

      conn.setRequestProperty("Content-Type", "application/xml");

      // Write output

      DataOutputStream printout = new DataOutputStream (conn.getOutputStream

());

      String data = "username=admin&password=geoserver&body="+xml;

      printout.writeBytes (data);

      printout.flush ();

      printout.close ();

      // Get response

      DataInputStream input = new DataInputStream (conn.getInputStream ());

      while (null != ((tmp = input.readLine())))

        System.out.println (tmp);

      input.close();

---------------

and still:

---------------

<?xml version="1.0" encoding="UTF-8"?>

<ows:ExceptionReport version="1.0.0"

  xsi:schemaLocation="http://www.opengis.net/ows

http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd&quot;

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;

xmlns:ows="http://www.opengis.net/ows&quot;&gt;

  <ows:Exception exceptionCode="NoApplicableCode">

    <ows:ExceptionText>org.xmlpull.v1.XmlPullParserException:

      only whitespace content allowed before start tag and

      not u (position: START_DOCUMENT seen u... @1:1) only

      whitespace content allowed before start tag and not u

      (position: START_DOCUMENT seen u... @1:1) </ows:ExceptionText>

  </ows:Exception>

</ows:ExceptionReport>

---------------

My xml is ok, I checked it with the probe request site.

Regards,

Sebastian

Ok, so still a couple of things wrong:

1. The body of the request (ie data variable) must only be the xml, it cannot be key value pairs body, username, and password. So change:

String data = "username=admin&password=geoserver&body="+xml;

to

String data = xml;

2. GeoServer will not recognize username and password in this way. In my first reply I described how to do authentication in a POST, I provided a code example as well:

String username = "...";
String password = "...";

byte b = Base64.encodeBase64(username + ":" + password);
String authHeader = "Basic " + new String(b);

conn.setRequestProperty("Authorization", authHeader);

-Justin

Sebastian wrote:

On Thu, 12 Jun 2008 08:35:20 -0700, Justin Deoliveira
<jdeolive@anonymised.com> wrote:

------------------
<ows:Exception exceptionCode="NoApplicableCode">

    <ows:ExceptionText>org.xmlpull.v1.XmlPullParserException:
      only whitespace content allowed before start tag and
      not u (position: START_DOCUMENT seen u... @1:1) only
      whitespace content allowed before start tag and not u
      (position: START_DOCUMENT seen u... @1:1) </ows:ExceptionText>
  </ows:Exception>
------------------

I think the xml body isn't recognized, what attribute name do I need?

Did you remove the url encoding of the xml? It looks like it is still
being sent encoded.

Regards and Thanks,
Sebastian

-------------------------------------------------------------------------

Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

Hmm... thats my code now:
--------------
      URL url = new URL ("http://localhost:8080/geoserver/wfs&quot;\);
      String xml = "<wfs:Transaction .... </wfs:Transaction>";
      String tmp = null;
            // Get connection
      URLConnection conn = url.openConnection();
      conn.setDoInput (true);
      conn.setDoOutput (true);
      conn.setUseCaches (false);
      conn.setRequestProperty("Content-Type", "application/xml");
                  // Write output
      DataOutputStream printout = new DataOutputStream (conn.getOutputStream
());
      String data = "username=admin&password=geoserver&body="+xml;
      printout.writeBytes (data);
      printout.flush ();
      printout.close ();
            // Get response
      DataInputStream input = new DataInputStream (conn.getInputStream ());
            while (null != ((tmp = input.readLine())))
        System.out.println (tmp);

      input.close();
---------------

and still:
---------------
<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.0.0"
  xsi:schemaLocation="http://www.opengis.net/ows
http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xmlns:ows="http://www.opengis.net/ows&quot;&gt;
  <ows:Exception exceptionCode="NoApplicableCode">

    <ows:ExceptionText>org.xmlpull.v1.XmlPullParserException:
      only whitespace content allowed before start tag and
      not u (position: START_DOCUMENT seen u... @1:1) only
      whitespace content allowed before start tag and not u
      (position: START_DOCUMENT seen u... @1:1) </ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>
---------------

My xml is ok, I checked it with the probe request site.

Regards,
Sebastian

!DSPAM:4007,4852655b279501439371379!

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

Thank you!

I had a problem with the base64 encoding, so I just left the encoding away and wrote:

conn.setRequestProperty("Authorization","admin:geoserver");

Now it works :slight_smile:

Thanks again and regards,
Sebastian

Justin Deoliveira schrieb:

Ok, so still a couple of things wrong:

1. The body of the request (ie data variable) must only be the xml, it cannot be key value pairs body, username, and password. So change:

String data = "username=admin&password=geoserver&body="+xml;

to

String data = xml;

2. GeoServer will not recognize username and password in this way. In my first reply I described how to do authentication in a POST, I provided a code example as well:

String username = "...";
String password = "...";

byte b = Base64.encodeBase64(username + ":" + password);
String authHeader = "Basic " + new String(b);

conn.setRequestProperty("Authorization", authHeader);

-Justin

Sebastian wrote:

On Thu, 12 Jun 2008 08:35:20 -0700, Justin Deoliveira
<jdeolive@anonymised.com> wrote:

------------------
<ows:Exception exceptionCode="NoApplicableCode">

    <ows:ExceptionText>org.xmlpull.v1.XmlPullParserException:
      only whitespace content allowed before start tag and
      not u (position: START_DOCUMENT seen u... @1:1) only
      whitespace content allowed before start tag and not u
      (position: START_DOCUMENT seen u... @1:1) </ows:ExceptionText>
  </ows:Exception>
------------------

I think the xml body isn't recognized, what attribute name do I need?

Did you remove the url encoding of the xml? It looks like it is still
being sent encoded.

Regards and Thanks,
Sebastian

-------------------------------------------------------------------------

Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

Hmm... thats my code now:
--------------
        URL url = new URL ("http://localhost:8080/geoserver/wfs&quot;\);
        String xml = "<wfs:Transaction .... </wfs:Transaction>";
        String tmp = null;
                // Get connection
        URLConnection conn = url.openConnection();
        conn.setDoInput (true);
        conn.setDoOutput (true);
        conn.setUseCaches (false);
        conn.setRequestProperty("Content-Type", "application/xml");
                        // Write output
        DataOutputStream printout = new DataOutputStream (conn.getOutputStream
());
        String data = "username=admin&password=geoserver&body="+xml;
        printout.writeBytes (data);
        printout.flush ();
        printout.close ();
                // Get response
        DataInputStream input = new DataInputStream (conn.getInputStream ());
                while (null != ((tmp = input.readLine())))
            System.out.println (tmp);

        input.close();
---------------

and still:
---------------
<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.0.0"
  xsi:schemaLocation="http://www.opengis.net/ows
http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd&quot;

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xmlns:ows="http://www.opengis.net/ows&quot;&gt;
  <ows:Exception exceptionCode="NoApplicableCode">

    <ows:ExceptionText>org.xmlpull.v1.XmlPullParserException:
      only whitespace content allowed before start tag and
      not u (position: START_DOCUMENT seen u... @1:1) only
      whitespace content allowed before start tag and not u
      (position: START_DOCUMENT seen u... @1:1) </ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>
---------------

My xml is ok, I checked it with the probe request site.

Regards,
Sebastian

!DSPAM:4007,4852655b279501439371379!