10-31-2012 08:06 AM
Your connection code looks OK, so I guess suspicion now falls on the POST parameters.
Can you do some debugging on the Server to determine that it is receiving the request as a POST and receiving the parameters correctly?
Also have you dumped out the bytes you are sending to make sure that they are correct? To do this you will either have to print the bytes in hex or try something like this:
String postString = new String(mParams, "UTF-8);
and dump our postString.
10-31-2012 08:45 AM
peter I checked paramString while sending to connection class and before writing to connection's outputstream and found both to be same and correct .
when i checked connection.getUrl() method i found it to be http://www.myserver.com/services/login?;interface=
which means my server would have been receiving request url to be http://www.myserver.com/services/login?;interface=
It means to handle my url at server as http://www.myserver.com/services/login?;interface=
I am new to BB Java development .
10-31-2012 08:47 AM
10-31-2012 09:04 AM - edited 10-31-2012 09:04 AM
It means there could be some error while writing parameters byte to connection's outputstream . Is it possible and if its possible how could we detect it ? Just before writing I did checked parameters and found them to be correct.
Can we detect complete url after the parameters are written to outputstream like in Android we can using HttpPost class
HttpPost p; p.getEntity().getContent(); // returns inpustream which can in turn gives string rep of complete URL.
it gives url like :
10-31-2012 09:31 AM
That looks like a GET request to me.
Can print out the URL you are using and the post parameters you are using and tell us exactly what they are before you issue the request?
Have you managed to do any analysis at the Server end?
10-31-2012 09:34 AM
i faced that problem when covert image into byte and try to send directly that byte to server
so i resolve by its using base64 encreaption
and i think its cause there some symbol in byte code so may be...
10-31-2012 09:42 AM
peter don't mistake about what i said in context with Android. Please forget about it (and in that case its a Post request).
and just before issue the request :
Params(String from byte) : username=mfsi&password=mfsi
just wanted to know if there is any possibility of error while writing to outputstream
10-31-2012 10:02 AM - edited 10-31-2012 10:42 AM
A URL with a "?" is to be an good indication of a URL you would use to do a GET. The ? separates the URL from the query values.
Have a look at this page for more:
I thought the POST was sent in the body of the request, so you will see it in the stream after the http headers. In the output you showed us previously, the parameters came immediately after the URL.
More on POST here:
So I'm still not convinced that you are sending the request in the correct way. If you can get your Server end person to look at what you are sending and how the Server is interpreting it, you will get to the bottom of this quicker.
Edit: Thanks for the input hitesh171285, but I am sure that this problem is different.
Edit2: I do not think there is a problem with your output of the POST bytes.
10-31-2012 10:30 AM
Yes peter whatever you are saying is right .
In the output you showed us previously, the parameters came immediately after the URL.
but whatever url I shown u was from my Android implementation and by writing it I only meant to know if anything like that is possible in android.
Yes as u said I need to check also from server end what url and params are they receiving.
Thanks peter , simon and hitesh
11-01-2012 02:07 PM
Thanks to all of you.
I used MFSI's modified code of ConnectionThread class and its working at my end.