Http POST problem

Hi

I am currently writing an MIDP application that POST's data to an embedded http server (embedded in a small electronic device). My problem is that the embedded http server is very senitive to the http POST format that I send it. When I use The HttpConnection class to post data the follow format is posted...

(When using WTK 2.2 and fiddler http debuger)

1.POST /servlet/MyServlet HTTP/1.1

2.Content-type: text/xml

3.Content-length: 5

4.Host: 192.168.1.111

5.Transfer-Encoding: chunked

6.

7.5

8.tinny

9.0

10.

The embedded server will only accept...

1.POST /servlet/MyServlet HTTP/1.1

2.Content-type: text/xml

3.Content-length: 5

4.Host: 192.168.1.111

5.

6.tinny

Is there anyway that I can get my desirered format using the HttpConnection class?

Is the 揟ransfer-Encoding: chunked?header my problem? If so can I disable it?

I would greatly appreciate any help anyone could give me, thanks in advance

Tinny :-)

[1056 byte] By [tinnya] at [2007-11-26 17:24:25]
# 1
> Is the 揟ransfer-Encoding: chunked?header my> problem? If so can I disable it?Yes it is, and generally, you cannot change this, But how does the httpserver react? Does it give an error?
deepspacea at 2007-7-8 23:52:25 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

> > Is the 揟ransfer-Encoding: chunked?header my

> > problem? If so can I disable it?

>

> Yes it is, and generally, you cannot change this,

>

> But how does the httpserver react? Does it give an

> error?

Yes, I get a 500 response back plus error xml content saying that the server could not find the xml content (<error>blar, blar</error>). The http server is a black box that I can抰 do anything about.

I抳e managed to make some progress by using SocketConnection con = Connector.open("socket://<address>:80")

then I manually write the headers and content from the resulting DataOutputStream (obtained from the SocketConnection).

The server now returns a valid response but i have no idea how this is going to work on a real device (how will my network providers WAP gateway treat this?)

Cheers

tinnya at 2007-7-8 23:52:25 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3
Not all devices can use sockets, so that might be a problem. Otherewise, networks should be able to handle them just fine.
deepspacea at 2007-7-8 23:52:26 > top of Java-index,Java Mobility Forums,Java ME Technologies...