J2ME, GPRS and HTTP Cookies

J2ME, GPRS and HTTP Cookies SearchSearch

SMS & MMS Technical Forum » Now.WAP Proxy (Product Support Only) » J2ME, GPRS and HTTP Cookies « Previous || Next »
Author Message
Harsh Tak
New member
Username: Harshtak

Post Number: 2
Registered: 05-2012
Posted on Tuesday, May 22, 2012 - 10:55 am:   

Hi,

I created one j2me application which is using HttpConnection. I have to maintain login session of the user so I am getting cookie from the header and set it again to header.
The problem is with some GPRS setting I am not able to get the cookie. It is not showing the cookie header also due to this my next response is not coming and application is throwing message "please login again".

Due to some proxy settings my header is not setted correctly to the server i am using PHP at the server end.

So is there any way to set and get those headers irrespective of the GPRS settings OR with a particular GPRS setting that i can set for my application.

I am excited to get reply.

Thanks.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3969
Registered: 08-2008
Posted on Tuesday, May 22, 2012 - 03:55 pm:   

Hi Harsh Tak,

I don't think your question is related to either of the threads that you have posted to. I have moved it to a new thread.

Is either yourself or the mobile operator using NowWAP? You have posted in a product support area for the NowWAP product, and it is not clear to me that your question is in any way related to NowWAP.

Assuming that it is not, I don't have enough information to help you. I cannot see what headers you are generating, or what headers are received.

To have the best chance of getting assistance, I would recommend providing more detail.

For example, describe the configuration where your application works. Show the HTTP header that is sent by your application server that includes the directive to set the cookie. Then show the HTTP header that is received back by your application server which has the cookie set.

Next, describe the configuration that does not work, and show the HTTP headers sent and received.

That should at least give a better idea of what exactly is going wrong, and whether or not NowWAP is involved.

--
Des
NowSMS Support
Harsh Tak
New member
Username: Harshtak

Post Number: 3
Registered: 05-2012
Posted on Wednesday, May 23, 2012 - 04:47 am:   

Hi Des,

Thanks for your reply. Exactly It is not releted to NowWAP. I am using some different operater here. As I was searching solution for my problem i read the below thread on your support forum.

http://support.nowsms.com/discus/messages/131/476.html
"J2ME application connection dosent work because of "Loading..." pag..."

So I want to know the actual scenario that what is happening behind the connection. Why this problem is coming at all.

Problem Details
-----------------------------------
I have 2 types of GPRS Settings.

1. AirTel
It Contains
*Multimedia messaging.
*Web
*Access Point

2. AIRTEL
It Contains
*Web
*Multimedia messaging
*x-midlet-NokiaVisualRadio
*Access Point

// getting cookie header
cookie = httpconnection.getHeaderField("Set-Cookie");

// setting cookie header
httpConnection.setRequestProperty("Cookie", cookie);

With Setting 1 I am able to get cookie but with setting 2 it is not giving me cookie value

So I want to know if I am using different operators for my application which setting i have to use that it gives me all the HTTP headers.
Because different operators have their own default setting so every time i have to change it manually like hit and trial method that it is working or not so want to know the actual technical solution or reason that i can explain to other people.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3973
Registered: 08-2008
Posted on Friday, May 25, 2012 - 04:27 pm:   

Hi,

Any issues you encounter may be mobile operator specific.

I would be really surprised if an operator blocked cookies.

My suggestion would be to use a tool like Wireshark to observe the raw HTTP headers sent and received by your application server.

Compare the headers of a working scenario with one that does not work.

(If you do not have a working scenario, then chances are that there is an error somewhere in your application logic, as I find it highly unlikely that an operator system would arbitrarily block cookies. The thread that you referenced was referring to issues with special HTTP X- headers ... those I could see being blocked ... but cookies, it seems unlikely.)

--
Des
NowSMS Support
Harsh Tak
New member
Username: Harshtak

Post Number: 4
Registered: 05-2012
Posted on Tuesday, May 29, 2012 - 04:36 am:   

Hi,

Yeah it may be operator specific issue.
yes I can check with wireshark.

Application Logic is simply maintain login session of the user so it requires cookie to be send again to the server.

But at the first time when hitting login url I am not able to get cookie value.

One thing I have to ask that what is the main cause behind all this scenario in your perspective.

Thanks
Harsh
Banglore - India
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3978
Registered: 08-2008
Posted on Wednesday, May 30, 2012 - 02:37 am:   

Hi Harsh,

It is possible that an operator proxy is not forwarding cookies. But rather than jumping to the conclusion, I would advise doing the Wireshark traces (compare working and non-working scenarios) to verify that the cookies are indeed missing, and that there is not some other type of error or unexpected issue.

Assuming the operator is blocking cookies ...

If you can see the values of the settings (GPRS APN, gateway and/or proxy settings), that may help you identify which setting is a problem so that you know how to tell your users to avoid it.

If that is not an acceptable option (operator settings determined to be in too widespread use), you'd need to do URL rewriting where instead of putting a session value in a cookie, you include it as a URL parameter for subsequent requests.

--
Des
NowSMS Support

Add Your Message Here, or click here to create a new discussion topic.
Post:
Bold text Italics Underline Create a hyperlink Insert a clipart image
Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Click here to create an account.
Username:
Password:
Options: Automatically activate URLs in message
Action:

Login Login / Register Logout Logout Search Last 30 Days Topics Topics