views:

24

answers:

1

I have a REST API written in PHP located on Apache server. It takes as a parameter a file (15KB). When I call this API from J2ME application it does work fine. Moreover when I wrote a API client in C# it worked too fine.

But now I have this second server with Lighttpd. I copied my API to this server and called it from C# app and it worked fine.

Next thing I did was to test if it work from J2ME application. And it appeared it DOES NOT. In return from server I get 3 characters, two first are squares and third is a letter j. Weird huh?

What is more interesting is that when I simulate passing file of 1B (byte) size it works like a charm.

So in short words: How can I properly pass 15 KB file to REST API located on Lighttp from J2ME app?

You are my last resort of help I don't know what to do to find out what can be wrong. Any suggestion appreciated.

If you wish I can add source code and server parameters here if it is needed - please write in comments what can be helpful. Or maybe you already know what is the problem?

Hope you can help me, I know this is not strict question like: what is a function that does this or that, but still it's a question right?

A: 

Have you checked the headers being returned from both servers (upon first request)? J2ME could be looking for a specific returned header to be able to send/post files. Perhaps a transfer encoding type?

A file of 1 byte most likely would work because of it's size, especially if that one byte is a newline as that would be interpreted as part of the header.

Your C# app perhaps isn't as strict with it's limits.

Viper_Sb