02-16-2009 07:52 AM
i am developing a blackberry app in J2ME, which is pointing to web service written in dot net.
we have session state enabled in the webservice in dotnet.
i developed an application which for BB which was consuming this webservice and everything seemed to work fine ( ie even session seemed to work) while i used to run the application from the JDE device simulator.
but once i ported the same on the device, the BB app was not able to maintain the session from device
i am using ksoap to consume the web service from my BB app. cannot use jsr172 or other methods as most of the target devices are on JDE 4.2
can anybody plz help me on how to fix the issue.
i think there is issue in creation of cookies on device, but not sure. does anybody have any idea.
02-18-2009 10:17 AM
Am I correct to assume you were using the MDS Simulator with the BlackBerry Simulator? If so, it is likely that the MDS Simulator was handling the session cookie for you. If your application connects through a BlackBerry Enterprise Server you should see similar behaviour. If it is not, it would be up to your application to handle the session cookie.
02-18-2009 11:31 PM - edited 02-19-2009 04:24 AM
Thanks for checking on this
The application is a J2ME one developed in JDE 4.2 and am using the JDE Simulator ( not sure if it runs on MDS in the background)
would an unsigned app developed in JDE, connecting to a dotnet webservice using kSOAP2 and having no BES in the environment need to have added coding for handling session(though the simulator does not require this to maintain session)?
what change is required in such an app to handle session?
02-23-2009 02:43 PM
02-24-2009 12:35 AM
Sorry once again bothering you.
As I mentioned in my post earlier, the session is being maintained if I am running the application in Simulator,
Session is not being maintained while the app is being run from device.
This is irrespective of whether I am using ksoap or custom code using HttpConnection to invoke the Webservice.
So I don't think there should be anything that needs to be handled in ksoap or programatically.
Do you think this has got something to do with the signing of an application
02-25-2009 03:51 AM
When you run the application on simulator, the MDS simulator automatically handles the cookies. So first of all you need to disable this in MDS simulator config file. Browse to the config directory
Program Files\Research In Motion\BlackBerry Email and MDS Services Simulators #.#.#\MDS\config
Open rimpublic.property in text editor.
Under the [HTTP HANDLER] section, change the following:
application.handler.http.CookieSupport = [value]. By default it is true. Change it to false.
After this you need to extract the cookie from the connection
for (int i = 0;(key = _con.getHeaderFieldKey(i)) != null; i++)
String cookie = _con.getHeaderField(key);
// perform further cookie management
// extract Cookie name and its value from the cookie string
In the subsequent requests you will need to set cookie in connection
06-09-2009 11:45 AM
Very interesting. When I turned off cookie handling on the simulated MDS it also turned off automatic handling of redirects. Does anyone know if the MDS equivalent in BIS-B also handles cookies and redirects for you? And if so is there any way to signal to it within the HTTP request so it doesn't interfere?
08-17-2009 08:12 AM
My assignment is to consume a .NET web service using JSR 172. The web service has session management which the cookies are stored in a CookieContainer (don't know much about .NET). Now, when i consume the Log-in service, the server returns a SessionID with which i will have to pass to the other methods to authenticate the operations that i will use. (Note: The SessionID mentioned here is not the intrinsic SessionID of the cookies.) When i try to use the Log-out service, passing the SessionID, i get receive an error message from the webservice.
A developer of the web service thought that the problem could be due to the sessions in the server. That after the Log-in call, when i call Log-out service, the server doesnt recognize my client application anymore.
So what i did, i set the MAINTAIN_SESSION_PROPERTY of my stub to true. But still the problem persists.
Do you have any idea what is wrong?