Discussion Board

Results 1 to 4 of 4

Thread: HTTP Problem

  1. #1
    Regular Contributor
    Join Date
    Jun 2007

    HTTP Problem

    I am working with http client example.I search all the forum for posting data through http but i m not finding any answer.So i am disscussing my problem bellow

    I want to crate login screen.By using username and password i hit the url which i want to send in xml format,Url respond some xml data. by taking suppose say customerId again i hit url ,server respond me some data in xml format.

    I am using POST method,bellow is my code. I dont know how to send xml but i tried it.by using HTTPClient example,i does some changes.

    _LIT8(KMimeType, "text/xml; charset=utf-8");
    void CClientAppUi::HandleCommandL(TInt aCommand)
    case EClientPost:
    // Issue HTTP post to engine; first cancel possible existing transaction


    _LIT(KXmlData,"<?xml version=1.0 encoding=UTF-8?>\n"
    TBuf<KDefaultBufferSize> postData(KXmlData);
    TBuf8<KDefaultBufferSize> postData8;

    // Start transaction
    TRAPD(err, iEngine->IssueHTTPPostL(KUrl8, KMimeType, postData8));
    // TODO: Error handling


    ///Http client
    void CClientEngine::IssueHTTPPostL(const TDesC8& aUri,
    const TDesC8& aContentType,
    const TDesC8& aBody)

    // Parse string to URI
    TUriParser8 uri;

    // Copy data to be posted into member variable; iPostData is used later in
    // methods inherited from MHTTPDataSupplier.
    delete iPostData;
    iPostData = 0;
    iPostData = aBody.AllocL();

    // Create HTTP connection
    TRAPD(err, SetupConnectionL());
    // User didn't select an IAP
    if (err == KErrNotReady) {
    HBufC* resTxCancelled = StringLoader::LoadLC(R_HTTP_TX_CANCELLED);

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

    // 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, accepted content type and body's
    // content type.
    RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();
    SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
    SetHeaderL(hdr, HTTP::EAccept, KAccept);
    SetHeaderL(hdr, HTTP::EContentType, aContentType);

    // Set this class as an data supplier. Inherited MHTTPDataSupplier methods
    // are called when framework needs to send body data.
    MHTTPDataSupplier* dataSupplier = this;

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

    iRunning = ETrue;
    HBufC* resConnecting = StringLoader::LoadLC(R_HTTP_CONNECTING);

    I am not able to Post the things.
    Simply i want to hit server by using username and password ,that i want to send it in xml format to server.then server will respond me xml
    as for sucessfull login
    <?xml version="1.0" encoding="UTF-8"?>


    For Invalid user:-


    then by using custmerId again i hit to server then sever respond me required XML
    how to do this.
    Plz help me
    Thx in advance

  2. #2
    Registered User
    Join Date
    Oct 2009

    Re: HTTP Problem

    Im also suffering form this matter, I want to post some xml data to google calendar server which should send as "application/Atom+xml" MIME type. I tried for weeks. Bud didn't come up with a solution, Server says the thransaction is OK and send 200 status code, But POST XML data didnt fetch from the server.
    please help me


  3. #3
    Regular Contributor
    Join Date
    Jun 2007

    Re: HTTP Problem

    Anybody please give response. give any solution

  4. #4
    Registered User
    Join Date
    Dec 2006

    Re: HTTP Problem

    When u request for the server using post method did you get any response back in MHFRunL() funtion of THTTPEvent::EGotResponseBodyData case?

    i has also done the same thing.when i got the response in mhfrunl funtion i write all data in a file and used xml parser.


Similar Threads

  1. Nokia N70 - HTTP POST problem
    By heuven in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2007-04-13, 15:48
  2. access points problem with HTTP client api
    By Svat_ in forum Symbian
    Replies: 1
    Last Post: 2006-12-26, 16:19
  3. Problem with HTTP POST
    By thathoo in forum Mobile Java General
    Replies: 2
    Last Post: 2006-12-18, 18:23
  4. Problem in Http Connection
    By jaceline in forum Mobile Java General
    Replies: 0
    Last Post: 2005-10-14, 04:08
  5. Replies: 2
    Last Post: 2003-02-19, 03:10

Posting Permissions

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