×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    11

    HTTP post(ing) problem

    Hi,
    I am using the HTTPExampleClient code to post a message to a web server.
    The message is read from a Message queue and passed on to the StartClien()method and finally to the GetPostBodyManually() of CHTTPClient.

    The problem is arising in the CACtiveScheduler::Start() call from the InvokeHTTPMethodL().

    Actually,the message queue implementation is also using the Active Scheduler,but in the RunL() method of message queue implementation before i am calling the StartClientL() from i am stopping the scheduler.
    Still,no data is posted.

    Please Help!!

    Messge queue implementation-----

    void CHServerGlobalMsgQue::RunL()
    {
    if(iStatus==KErrNone)
    {
    iMessagequeue.Receive(iMessageBuff);

    CActiveScheduler::Stop();

    httpCli->StartClientL(iMessageBuff);

    iMessagequeue.NotifyDataAvailable(iStatus);

    SetActive();
    }
    }

    HTTPClient-------

    typedef TBuf8<100> TTestMsg;

    void CHttpClient::GetPostBodyManuallyL(TTestMsg val)
    {


    if (iFormEncoder)
    {
    delete iFormEncoder;
    iFormEncoder = NULL;
    }

    iFormEncoder = CHTTPFormEncoder::NewL();


    TBuf8<256> value;

    TBuf8<256> name;

    name.Copy(_L8("Packet"));

    value.Copy(val);

    TRAPD(err, iFormEncoder->AddFieldL(name, value));

    User::LeaveIfError(err);

    }

    void CHttpClient::InvokeHttpMethodL(const TDesC8& aUri, RStringF aMethod)
    {


    iDataChunkCount = 0;
    TUriParser8 uri;
    uri.Parse(aUri);
    iTrans = iSess.OpenTransactionL(uri, *iTransObs, aMethod);
    RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();

    // Add headers appropriate to all methods
    SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
    SetHeaderL(hdr, HTTP::EAccept, KAccept);

    // Add headers and body data for methods that use request bodies
    if (iHasARequestBody)
    {
    // Content type header
    TBuf8<64> contTypeBuf;
    contTypeBuf.Copy(iReqBodyContentType);
    RStringF contTypeStr = iSess.StringPool().OpenFStringL(contTypeBuf);
    THTTPHdrVal contType(contTypeStr);
    hdr.SetFieldL(iSess.StringPool().StringF(HTTP::EContentType,RHTTPSession::GetTable()), contType);
    contTypeStr.Close();

    MHTTPDataSupplier* dataSupplier = this;
    if (iManualPost)
    dataSupplier = iFormEncoder;
    iTrans.Request().SetBody(*dataSupplier);
    TInt size = dataSupplier->OverallDataSize();

    }


    //TInt err;
    // submit the transaction
    TRAPD(err,iTrans.SubmitL());
    User::LeaveIfError(err);
    // Start the scheduler, once the transaction completes or is cancelled on an error the scheduler will be
    // stopped in the event handler


    CActiveScheduler::Start();//EXECUTION STOPS HERE


    // all done
    iUtils->PressAnyKey();

    // close the request body file, if one was opened
    if (iHasARequestBody)
    iReqBodyFile.Close();
    }

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    11

    Re: HTTP post(ing) problem

    Sorry folks,the execution is continuing.

    Actually,its almst takn 4mins to enter the MHFRunL() after starting the scheduler,so i thought may be the execution is halted.

Similar Threads

  1. Http request/response problem
    By mrekha01 in forum Symbian
    Replies: 3
    Last Post: 2007-02-01, 18:09
  2. access points problem with HTTP client api
    By Svat_ in forum Symbian
    Replies: 1
    Last Post: 2006-12-26, 17:19
  3. Problem with HTTP POST
    By thathoo in forum Mobile Java General
    Replies: 2
    Last Post: 2006-12-18, 19:23
  4. NOKIA vs. SIEMENS HTTP connection problem?
    By imarenic in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2003-11-03, 10:03
  5. Replies: 2
    Last Post: 2003-02-19, 04: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
  •  
×