Discussion Board

Results 1 to 4 of 4
  1. #1
    Hi,

    Im developing a mobile application in j2me.Im using "Nokia c2-01" mobile for testing.In my application i send a request to one servlet and receive response to mobile via GPRS.I send the request to the servlet through ("https://" ).Here one problem is when i send a request to the server.The request is not hit to server when it goes from mobile application ,but it hits succesfully and get response succefully from server when i type the address ("https://61.......") in the mobile phone's web browser. Here i cannot identify why i cannot able to send the request via my application running in mobile (but it sends succeffully from the mobile phone's browser) My source code snippet is given below

    HttpsConnection httpsConnection=(HttpsConnection)Connector.open(url);
    InputStream is=httpsConnection.openInputStream();

    Here the urs starts from "https://" some url.In my mobile app it throws the "CertificationException".But from mobile phone's web browser it works correctly. Please any one give me ur ideas about this issues.



    Additional information: when i use the url "onlinesbi.com";(https://www.onlinesbi.com) (It is a state bank of india's web site) it hits the servlet (server) succeffully from my test mobile phone (nokia c2 01)'s web browser and it also successfully hits from my mobile application also.So i think my phone supports Https.I think there is any changes is needed in the mobile phone's setting.Please help me its an urgent issue



    im using test certificate (self signed) in server side.But i does not put the certificate into mobile phone.Here one thing is when i type the url in the web browser of mobile phone it works fine.I think if certificate problem means it is not also work from web browser of mobile phone.Im also tested in "Sony erricson z530i" mobile it works fine.But based on project requirements here my target phone is nokia.If there is any mistake on my comment please forgive me.On past 20 days im not able to solve the issues .So please help me to solve the issues.All ideas are welcome

  2. #2
    Nokia Developer Expert skalogir's Avatar
    Join Date
    Aug 2011
    Posts
    547
    Hi,

    Does the URL contain characters that need to be URL encoded? If you are passing parameters via URL, the value of these parameters should not contain characters like: ! * ' ( ) ; : @ & = + $ , / ? % # [ ]
    If that's the case, these characters need to be encoded.

    Browsers can do the encoding automatically, but that's not the case for Java applications.

    More information regarding URL encoding here:

    http://en.wikipedia.org/wiki/Percent-encoding

    Also, have you tried to specify the submission method (either GET or POST) and the content type, just before you open the input stream?

    Here is a snippet:
    Code:
    	        httpsConnection.setRequestMethod(HttpsConnection.POST);
    	        httpsConnection.setRequestProperty("Content-Type","text/xml");
    There is also Nokia's Professional Technical Support Service:
    http://www.developer.nokia.com/Resou..._support.xhtml
    that can be an option for urgent cases that require immediate solutions.

  3. #3
    Nokia Developer Champion im2amit's Avatar
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    2,903
    I suggest to test the app on Nokia emulator and see if work with HTTPS - URL encoding may be a issue. (try with HTTP)
    Other issue your Nokia device may need a signed build of the app to make HTTPS request.
    thanks,
    ~Amitabh
    (Poster of the Month -Dec'12)
    Follow me on my blog for Innovative Mobile Apps

  4. #4
    Nokia Developer Champion traud's Avatar
    Join Date
    Mar 2003
    Posts
    3,869
    Quote Originally Posted by im2amit View Post
    your Nokia device may need a signed build of the app to make HTTPS request.
    Signing the code is not required for HttpsConnection class(es).
    Quote Originally Posted by J.SIVAKUMAR000@GMAIL.COM View Post
    i cannot identify why i cannot able to send the request via my application running in mobile (but it sends succeffully from the mobile phone's browser)
    Unfortunately, the internal browser and J2ME use different algorithms and user interactions to handle server certificates. Furthermore in a Nokia C2-01, the browser is actually a proxy based browser which should not be used for HTTPS communication at all – because you do not know who listens at the proxy.

    Unfortunately, unfortunately, I do not have an answer to your actual question, just some recommendations…
    Quote Originally Posted by J.SIVAKUMAR000@GMAIL.COM View Post
    im using test certificate (self signed) in server side.But i does not put the certificate into mobile phone.
    The bottom line from the above recommendations: Create a full blow server, with a correct certificate, from a well-known authority like VeriSign or Entrust. It is near to impossible to do HTTPS in the debugging phase without that. Otherwise you waste more time, than a server-setup is going to cost.
    – Instead of using a well-know authority, and creating a self-signed certificates fails because you are not able to install it in your phone.
    – Instead of using a domain-name, and utilising IP-addresses as server domain fails because well-known authorities won’t give you a certificate, then.
    – Instead of installing the whole chain of certificates, and using only the given certificate fails just like Apple Safari for Mac OS X will fail.
    Then, no changes to your phone must be done. Actually, no change to your MIDlet must be done. Not a single code has to be re-written. All you have to do is to change the URL from http:// to https://. Even the class-cast in the line of the Connector.open statement stays the same, because HttpsConnection is a subclass of HttpConnection.
    Last edited by traud; 2011-11-06 at 14:01.

Similar Threads

  1. How will I solve this problem in StringTokenizer in J2ME?
    By SHENGTON in forum Mobile Java General
    Replies: 1
    Last Post: 2011-02-12, 09:11
  2. https certificate issues with Nokia E50
    By krzysztof.kucharewicz in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 0
    Last Post: 2009-02-26, 11:19
  3. https issues
    By HasithaRandika in forum Mobile Java Networking & Messaging & Security
    Replies: 12
    Last Post: 2009-01-23, 10:58
  4. j2me .jad download over HTTPS
    By Nikolaos in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2008-07-03, 09:01
  5. J2ME Security : MIDP HTTPS vs Browser HTTPS
    By dhamodharan in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-09-11, 14:19

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved