Getting Crazy with WiFly Module + Telnet :-(

Hello,

i'm hosting an Environmental Sensing Workshop in Tallinn, Estonia and we've got a couple of WiFly-Modules on Shields from Sparkfun here.

We are using them together with Arduino and I manged to configure the WiFly Moduels and they are connecting properly.

We want to collect some Sensor-data and upload it to pachube.com.

The problem is the following: if i do an upload test from my mac via telnet, everything is working fine. if i connect over the wifly moduel and send the same request i always get an http 400 error? why? ist there something i have to consider?

i didnt find any documentation about an outgoing connection.

Ok. as this is my first post and I cant post links. the rest of the message comes in the second part ...

http://community.pachube.com/node/332#comment-form

i have somehow the same problems like described in the post, but i can't figure out how to solve it. i can connect to the server but as soon as i try to submit sth. i get an error back from the webserver. but the same request works from telnet via my computer.

if i use the SPI_Uart Interface from sparkfun the connection looks like:

SPI_Uart_println("open pachube.com 80");

and the message would look like this:
SPI_Uart_println("PUT /api/7430.csv HTTP/1.1");
SPI_Uart_print("Host: www.pachube.com");
SPI_Uart_print("X-PachubeApiKey:XXXX");
SPI_Uart_print("Content-type: text/csv");
SPI_Uart_print("Content-Length: 3");
SPI_Uart_print("Connection: close");
SPI_Uart_print("200");

also tried to add "\r\n" to every line. also no success :frowning:

hopefully somebody can give me a clue.

cheers, stefan

SPI_Uart_println("PUT /api/7430.csv HTTP/1.1");
SPI_Uart_print("Host: www.pachube.com");
SPI_Uart_print("X-PachubeApiKey:XXXX");
SPI_Uart_print("Content-type: text/csv");
SPI_Uart_print("Content-Length: 3");
SPI_Uart_print("Connection: close");
SPI_Uart_print("200");

As shown, you are missing ANY separator characters between fields, and it will all flow together like:

PUT /api/7430.csv HTTP/1.1
Host: www.pachube.comX-PachubeApiKey:XXXXContent-type: text/csvContent-Length: 3Connection: close200

Which is clearly wrong. You're also missing a blank line between your header and your data, which I think is required. But you should have gotten closer with the "\r\n" in each line, I would think. I wouldn't trust "println" to have the right sequence, and would try something like:

SPI_Uart_print("PUT /api/7430.csv HTTP/1.1\r\n");
SPI_Uart_print("Host: www.pachube.com\r\n");
SPI_Uart_print("X-PachubeApiKey:XXXX\r\n");
SPI_Uart_print("Content-type: text/csv\r\n");
SPI_Uart_print("Content-Length: 3\r\n");
SPI_Uart_print("Connection: close\r\n\r\n");  // note extra blank line
SPI_Uart_print("200\r\n");

Your key doesn't contain any backslash characters, does it? That would also be a problem unless you double them...

hello and thx for your help. actually your suggestions is resulting on a fault of mine by cleaning up the code for the forum.

i used to try already what you suggested and also:

SPI_Uart_println("PUT /api/7430.csv HTTP/1.1");
SPI_Uart_println("Host: www.pachube.com");
SPI_Uart_println("X-PachubeApiKey:XXXX");
SPI_Uart_println("Content-type: text/csv");
SPI_Uart_println("Content-Length: 3");
SPI_Uart_println("Connection: close");
SPI_Uart_println("");
SPI_Uart_println("200");

to simplify the question a bit: given that i know the right set of commands (testet via telnet from my computer and checked via the server, because there is a successful entry). what do i have to consider if i use arduio + wifly module?

is there sth. different with the characer encoding? line endings? in terminal i just copy and paste the whole "block = set of commands" and i get an answer from server (http 200).

i also tried yesterday night to just send a simple "GET" to my local apache. no reply. thats also a bit confusing. sometimes if i send a complete block, i get a http 400. if i try to go over terminal mode via serial-uart-spi interface via screen->arduino->wifly and just write line by line in the OPEN connection to server, there is no reply. how to commit a line?

i also tried to replace the uart-spi script sparkfun withe the spi-library from the spanish guys. same result.

if i send just "asjfköls" to my local apache via telnet, i get a error entry in the log. if i try to send the same from the arudino. there is no entry. even if the connection is open?

hope somebody has got more ideas ...

thx a lot. best stefan