×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Regular Contributor
    Join Date
    May 2008
    Location
    Switzerland - VS
    Posts
    81

    Simple http request

    Hi,

    I'm working on a software for S60, and I need to do just a little http request to a server.

    I just watch a little about the http exemples... but It seems pretty complexe to do a simple request...

    I only have to make a GET request and handling the result.. in the result there is no header, only a simple line text... Is there a simple way to do it ?

    I don't need to have a thread solution... I just need to do the request.. while the request is pending there is no problemes if the soft is "freezed" until the end of the request, so ... requests events and so... are realy not necessary.

    I'm realy searching the simplest way to do this request, because I don't have a lot of time for it.

    Or perhaps is there a classe or lib that make this easier ?

    I hope someone could help me. Or a little help for including the exemples of SDK in another soft could be helpfull.

    Thank you in advance.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: Simple http request

    There are really no simple solutions, basically, you have two options, using the HTTP exmaple as a base, or using sockets and writing your own stuff to the pot 80. anyway, the HTTP example might be the easiest one..

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: Simple http request

    Also note that
    Quote Originally Posted by Christophe.A View Post
    in the result there is no header, only a simple line text
    is unlikely a real HTTP transaction.
    I don't need to have a thread solution...
    No one needs threaded solution for that in Symbian.
    You can use sockets directly if you really think that your communication is that simple (RSocket::RecvOneOrMore is your friend when you do not know the length of the data), however I have some doubts about that.

  4. #4
    Regular Contributor
    Join Date
    May 2008
    Location
    Switzerland - VS
    Posts
    81

    Re: Simple http request

    okay, thank you for your advices. I'll see if the RSocket is suffisant for my needs.

    For information, the datas I need to get from the server is an URL.
    The case is strange, I just need to open a browser on a webpage, but this web page has php parametters, and depend of this parametters the web page does a redirection on another server.

    The probleme is here : the phone operator of my client don't allow redirections on other server apparently. All is fine with my tests but the custumer has an error message like .. ".. contact your operator ...."

    So I thought I can just get the URL to go, with the socket connection, and then open the right URL in the browser.

  5. #5
    Regular Contributor
    Join Date
    Mar 2007
    Location
    "On a b'ful lil palnet called EARTH belongs wid Galaxy named MilkyWay in Universe"
    Posts
    402

    Post Re: Simple http request

    Christophe.. Http exmaple in EMCC is not so complex. So you may try that...
    ===With Symbian===
    "Something Has Survived..!!!"

  6. #6
    Registered User
    Join Date
    Feb 2007
    Location
    Tampere
    Posts
    370

    Re: Simple http request

    Hi,

    You can try using a http filter. You can cancel the transaction using this and even display your error message.

    I have used filter for different purpose but am guessing it can help you

    here is the link for the example
    http://wiki.forum.nokia.com/index.ph..._filter_plugin
    Regards

    - MVP
    "Dare To Dream" - A.P.J.Kalam

  7. #7
    Regular Contributor
    Join Date
    May 2008
    Location
    Switzerland - VS
    Posts
    81

    Re: Simple http request

    Christophe.. Http exmaple in EMCC is not so complex. So you may try that...
    Because I'm not realy familiar with symbian, first time I saw it, it appers complex, but it's understandable.. sure..


    So.. I'm trying to use the httpExempleClient of the SDK. For sparing time I try to juste use the classes used in this exemple.

    So for my try I just want to launch the httpClient from my app (it's a modified version of the CCameraApp exemple of the SDK) So I just use the httpexempleclient and httpexempleutils cpp/h and commented the E32Main().

    I just selected the code I thought was necessary for launch my request

    Code:
    CHttpClient* httpCli = CHttpClient::NewLC();
     	 RStringPool strP = httpCli->iSess.StringPool();
     	_LIT(UrlTest, "http://www.google.com");
     	// Start the method off
    	TBuf8<256> url8;
    	url8.Copy(UrlTest);
    	RStringF method = strP.StringF(HTTP::EGET,RHTTPSession::GetTable());
    	httpCli->InvokeHttpMethodL(url8, method);
    but the console return a unrecognized event -46. I dunno what it means...
    Perhaps it's an error because of the scheduler, that it's already used in my camera app base. I'm not enought familiar with to say it.

  8. #8
    Regular Contributor
    Join Date
    May 2008
    Location
    Switzerland - VS
    Posts
    81

    Re: Simple http request

    Okay, finaly I restarted to trying to integrate http client api exemple 2.1, but I have always have troubles because my knowledge in Symbian are weaks.

    So, I'll ask you if you can help me about the integrating in my current project.

    My project is a modified version of the "Camera Example v2.1" In the CCameraAppContainer (where the camera picture is drawn) a picture decoder is called, and currently the webbrowser is launched, depend of the result of the decoder.

    I need to remplace the browser launching by the Http request.

    So, in this project I have : the application, the appui, some containers, the view, and the capture engine class.

    So my first problem is about the httpObserver. I think I can use one of the current classes and make it inherite from "MClientObserver" but I'm not sure about which one is the best for doing it without having other problems.

    Is that plausible to use the appControler for doing that job ? or I'm totally out ?

    Then I think I can create an clientEngine from everywhere in my soft just for launching the request, and no problems should happend ?

  9. #9
    Regular Contributor
    Join Date
    May 2008
    Location
    Switzerland - VS
    Posts
    81

    Re: Simple http request

    realy nobody for help me ? ...

    So I tryied to do what I said in the prevouse post... and suprise .. don't works.

    I can obtain the "choose access point" dialog.. but when I select it... my soft crashs...

    I tried to debug on the device... but impossible ... The only mean to debug is to comment/uncomment...

    So when the function " iTransaction.SubmitL(); " is executed in the IssueHTTPGetL

    My session is opened in the appContainer .. for tests I tried with :
    Code:
    iEngine->CancelTransaction();
                            	
    _LIT(UrlTest, "http://www.google.com");
    TBuf8<256> url8;url8.Copy(UrlTest);
    TRAPD(err,  iEngine->IssueMyHTTPGetL(url8));
    and my observer is the appcontroler.
    For now I only keept the functions but they are empty. (ClientBodyReceived and ClientEvent)


    the base exemple was named S60 Platform Camera Example v2.1

Similar Threads

  1. how to use HTTPS connection in a simple http request
    By kishore84 in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2008-04-29, 09:43
  2. Problem with HTTP POST
    By thathoo in forum Mobile Java General
    Replies: 2
    Last Post: 2006-12-18, 18:23
  3. Custom request fields with http get/post
    By browndrf in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2006-11-08, 19:57
  4. Problem In calling http request by 9500
    By vinayjdhv in forum Personal Profile
    Replies: 3
    Last Post: 2005-10-07, 09:56
  5. Error while sending HTTP Post Request
    By bhonsle in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2004-01-11, 16:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×