×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Regular Contributor
    Join Date
    Sep 2009
    Location
    India
    Posts
    172

    XML data sending problem

    Hello All,

    I want to send the XML request through HTTPPost Request having data size more than TBuf<1000>.
    When data size less than TBuf<900> its working fine on device (Nokia E50) and emulator.
    But when I try to send data having more than TBuf<1000> its gives error Panic User 42 on device (Nokia E50) but its working on emulator.

    How can I increase the TBuf <---> size? I try to increase it directly (i.e. TBuf<1500>) but it gives Panic User 42.


    Amit

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,336

    Re: XML data sending problem

    Use Heap based descriptor instead. For example:

    Code:
    HBufC* data = HBufC::NewL(1000);
    CleanupStack::PushL(data);
    ...
    //Perform your operations (e.g: sending data through http post)
    ...
    CleanupStack::PopAndDestroy(data);
    You may also want to increase Heap size for your application. Check this: http://wiki.forum.nokia.com/index.ph...an_application
    Nokia Developer Wiki Moderation team

  3. #3
    Regular Contributor
    Join Date
    Sep 2009
    Location
    India
    Posts
    172

    Re: XML data sending problem

    Hi Kiran,

    Thanks for your reply.
    As per your suggestion, I have used

    HBufC* data = HBufC::NewL(1000);
    CleanupStack::PushL(data);
    ...
    //Perform your operations (e.g: sending data through http post)
    ...
    CleanupStack::PopAndDestroy(data);

    But I am using ClientEngine class for sending the data through HTTPPost request.

    Here, void CClientEngine::IssueHTTPPostL(const TDesC8& aUri,
    const TDesC8& aContentType,
    const TDesC8& aBody)
    is the method which I have to call and pass the body data.

    If I pass HBufC* data instead of TDesC8& aBody
    Then I got data type mismatched on
    iBody = aBody.AllocL();

    Here is the code

    void CClientEngine::IssueHTTPPostL(const TDesC8& aUri,
    const TDesC8& aContentType,
    const TDesC8& aBody)
    {
    if (IsActive())
    {
    return;
    }

    iEngineState = EPost;

    delete iUri; iUri = NULL;
    delete iContentType; iContentType = NULL;
    delete iBody; iBody = NULL;

    iUri = aUri.AllocL();
    iContentType = aContentType.AllocL();
    iBody = aBody.AllocL(); error line data type mismatched

    // Create HTTP connection
    TRAPD(err, SetupConnectionL());
    if (err == KErrAlreadyExists)
    {
    DoHTTPPostL();
    }
    else if (err != KErrNone)
    {
    // return;
    }
    }


    Amit

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,336

    Re: XML data sending problem

    Use HBufC8 instead:

    Code:
    HBufC8* iBody;
    ..
    ..
    //To avoid memory leaks, delete previously owned data
    if(iBody) 
    {
         delete iBody;
         iBody = NULL;
    }
    iBody = aBody.AllocL(); 
    ..
    Nokia Developer Wiki Moderation team

  5. #5
    Regular Contributor
    Join Date
    Sep 2009
    Location
    India
    Posts
    172

    Re: XML data sending problem

    Hi Kiran,

    now, I get
    error: request for member `AllocL' in `aBody', which is of non-class type `HBufC*'
    On iBody = aBody.AllocL();


    Amit

  6. #6
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,336

    Re: XML data sending problem

    How did you declare iBody? Show it.
    Nokia Developer Wiki Moderation team

  7. #7
    Regular Contributor
    Join Date
    Sep 2009
    Location
    India
    Posts
    172

    Re: XML data sending problem

    Hi Kiran,

    Here is my code,

    void CClientEngine::IssueHTTPPostL(const TDesC8& aUri,
    const TDesC8& aContentType,
    HBufC* aBody)
    {
    if (IsActive())
    {
    return;
    }

    iEngineState = EPost;
    HBufC8* iBody;


    delete iUri; iUri = NULL;
    delete iContentType; iContentType = NULL;
    //delete iBody; iBody = NULL;

    iUri = aUri.AllocL();
    iContentType = aContentType.AllocL();
    if(iBody)
    {
    delete iBody;
    iBody = NULL;
    }
    //iBody = aBody.AllocL();
    iBody = aBody.AllocL();



    // Create HTTP connection
    TRAPD(err, SetupConnectionL());
    if (err == KErrAlreadyExists)
    {
    DoHTTPPostL();
    }
    else if (err != KErrNone)
    {
    // return;
    }
    }


    Amit

  8. #8
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,336

    Re: XML data sending problem

    Quote Originally Posted by amit04.kumar View Post
    Hi Kiran,

    Here is my code,

    void CClientEngine::IssueHTTPPostL(const TDesC8& aUri,
    const TDesC8& aContentType,
    HBufC* aBody) {
    Why are you doing this? Did I say to change it anywhere in this thread? Just revert it and use the following signature.

    Code:
    void CClientEngine::IssueHTTPPostL(const TDesC8& aUri,
    const TDesC8& aContentType,
    const TDesC8& aBody)
    Also if it works for iContentType then why don't you just imitate it and declare the same type of variable for iBody in your header file. Is it that hard?
    Nokia Developer Wiki Moderation team

  9. #9
    Regular Contributor
    Join Date
    Sep 2009
    Location
    India
    Posts
    172

    Re: XML data sending problem

    Hi Kiran,

    I have revert that code and iBody declare in header file.

    I am calling

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

    Inside

    void HandleUrlRequestL(const TBuf8<KMaxUriNameLength>& aUri,const TDesC8& aPostdata);

    Here aPostdata is TDesC8, aBody datatype is also TDesC8.

    But the XML which I have generating is stored in HBufC. Because of this I got the Error.
    function call 'HandleUrlRequestL({lval} TBuf8<128>, {lval} HBufC16 *)' does not match
    How can I send the
    HBufC* data = HBufC::NewL(1000);
    data to
    HandleUrlRequestL(uri,[data]);


    Amit

  10. #10
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,336

    Re: XML data sending problem

    Quote Originally Posted by amit04.kumar View Post
    void HandleUrlRequestL(const TBuf8<KMaxUriNameLength>& aUri,const TDesC8& aPostdata);
    First of all change above signature to:
    Code:
    void HandleUrlRequestL(const TDesC8& aUri,const TDesC8& aPostdata);

    Now sending HBufC data, you may try simple copy operations.

    Code:
    HBufC8* data = HBufC8::NewL(xmlData->Length());
    data->Des().Copy(*xmlData);
    ...
    ...
    Check this Wiki article also: http://wiki.forum.nokia.com/index.ph...ng_Descriptors
    Nokia Developer Wiki Moderation team

  11. #11
    Regular Contributor
    Join Date
    Sep 2009
    Location
    India
    Posts
    172

    Re: XML data sending problem

    Thanks Kiran,

    This will definitely help us.
    I am going to implement this and I will let you know if I got any problem.

    Amit

Similar Threads

  1. [moved] Error in sending data from nokia emulator to servlet(server)
    By icecubebar in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2008-10-09, 09:39
  2. XML writing and Appending the Problem
    By talk2mishal in forum Mobile Java General
    Replies: 3
    Last Post: 2008-09-19, 19:24
  3. Problem sending data via gprs
    By dnl21 in forum Mobile Java General
    Replies: 2
    Last Post: 2007-08-16, 21:51
  4. problem sending CONCATENATED SMS
    By habier in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-07-11, 11:00

Posting Permissions

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