×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jun 2013
    Posts
    4

    S60 Platform: HTTP Client Example v2.2

    In the HTTP Client Example here
    http://www.developer.nokia.com/info/..._2_en.zip.html

    Could you please tell me how to test the post request?

    for example i have an url: http://blablaconnect.com/webservices/getSingleRate and the post parameters is mobileNumber = 20111

    Thanks

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,570

    Re: S60 Platform: HTTP Client Example v2.2

    If URL encoded POST is enough, you may find http://www.developer.nokia.com/Commu...Url_parameters useful.
    If you want to "send" data, http://www.developer.nokia.com/Commu...part/form-data contains some related code fragments.

  3. #3
    Registered User
    Join Date
    Jun 2013
    Posts
    4

    Re: S60 Platform: HTTP Client Example v2.2

    Thanks wizard_hu_
    When sending a post request with the following code, the post data is empty
    Could you help me in figuring out this issue ?
    TBuf8<50> imobileNumber;
    CHTTPFormEncoder* iFormEncoder = NULL;
    iFormEncoder = CHTTPFormEncoder::NewL();
    // headers
    _LIT8(KContentType, "text/*");

    /******************** Form Encoder **********************/

    // Ensure the session is open

    OpenSessionL();
    // Parse string to URI (as defined in RFC2396)

    TUriParser8 uri;
    TBuf8<100> aUri;
    aUri.Copy(_L8("http://host.com/function"));
    uri.Parse( aUri );

    // Get request method string for HTTP POST
    RStringF method = iSession.StringPool().StringF( HTTP::EPOST,
    RHTTPSession::GetTable());

    // Open transaction with previous method and parsed uri. This class will
    // receive transaction events in MHFRunL and MHFRunError.
    iTransaction = iSession.OpenTransactionL( uri, *this, method );

    // Set headers for request; user agent and accepted content type
    RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();
    SetHeaderL( hdr, HTTP::EUserAgent, KUserAgent );
    SetHeaderL( hdr, HTTP::EAccept, KAccept );
    SetHeaderL( hdr, HTTP::EContentType, KContentType );

    _LIT8(KPostMobileNumber, "mobileNumber");
    imobileNumber.Copy(_L8("2011"));
    iFormEncoder->AddFieldL(KPostMobileNumber, imobileNumber);

    iTransaction.Request().SetBody(*iFormEncoder);

    // Submit the transaction. After this the framework will give transaction
    // events via MHFRunL and MHFRunError.

    iTransaction.SubmitL();
    iRunning = ETrue;

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: S60 Platform: HTTP Client Example v2.2

    What is happening inside the iFormEncoder, it should be indeed giving the data, so do debug what happens with it. Also do debug HTTP state callback to see whether you get errors.

  5. #5
    Registered User
    Join Date
    Jun 2013
    Posts
    4

    Re: S60 Platform: HTTP Client Example v2.2

    When sending this post request, the server response is "Missing Arguments". This means that i have sent no data within the POST request.

  6. #6
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: S60 Platform: HTTP Client Example v2.2

    I don't really like to repeat myself, anyway, did you do any parts I suggested in the previous post ?

  7. #7
    Registered User
    Join Date
    Jun 2013
    Posts
    4

    Re: S60 Platform: HTTP Client Example v2.2

    Yeah, I have followed your suggestions, but no callback errors. Unfortunately, I could not debug my app because of pjsip.
    Anyway, could you tell me how to use HTTP Client Example v2.2 POST request as sisfile? I could handle my issues from that point

  8. #8
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: S60 Platform: HTTP Client Example v2.2

    You could do file based debugging at least. Basically you would need to check whether the data is actually fetched, and that you do handle it right.

Similar Threads

  1. Replies: 1
    Last Post: 2011-09-19, 14:17
  2. http client, XML-RPC, and SOAP client libraries?
    By nawkboy in forum Symbian Networking & Messaging (Closed)
    Replies: 6
    Last Post: 2010-03-22, 13:33
  3. Need help in client platform
    By Liyo in forum Mobile Java General
    Replies: 2
    Last Post: 2007-06-14, 20:36
  4. HTTP Client - Synchronous HTTP POST Calls?
    By symbian_ravi in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2006-04-16, 11:51

Posting Permissions

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