HTTP POST

Login to reply to this topic.
Tue, 2005-05-17 07:47
Joined: 2004-10-28
Forum posts: 14
Hi,

  I am getting problems when trying to send a file to a web server in HTTP POST request. The POST content could be large, so it is read in several parts from a previously generated file.
  I supose that I haven't understood at all GetNextDataPart() and ReleaseData() methods inherited from MHTTPDataSupplier. I have modified HTTP client example in order to send a file when calling PostL method, but program crashed.
  Has anybody done a HTTP POST request with a file? Could you help me?

  Thank you.

Mon, 2005-05-23 10:30
Joined: 2004-10-28
Forum posts: 14
Re: HTTP POST
   Hello again,

   finally I can do HTTP POST reading data from a file (the problem was NotifyNewRequestBodyPartL call in ReleaseData method). But now I have a new trouble, I would like make several POST request one by one within a while loop. How can I do this? I have tried a wait loop that sleeps and polls a running flag after RHTTPTransaction::SubmitL(), but request didn't works and MHFRunL is never called.
   How can I wait for transaction without using MHFRunL callback method?

   Thanks in advance.

Tue, 2005-05-31 11:48
Forum Nokia Champion
Joined: 2003-10-01
Forum posts: 723
Re: HTTP POST
Did you try to wait with issuing the second POST until the response for the first POST arrived? Because you might not issue multiple HTTP requests in parallel due to a restriction in Symbian HTTP framework (pipelining).

tOtE

Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/

Tue, 2005-06-21 08:48
Forum Nokia Champion
Joined: 2004-06-30
Forum posts: 36
Re: HTTP POST
Quote from: maimonides
...
   finally I can do HTTP POST reading data from a file (the problem was NotifyNewRequestBodyPartL call in ReleaseData method).
...

I have exactly the same problem of NotifyNewRequestBodyPartL call in ReleaseData crach (on Serie 60 but not on UIQ)
Could you tells us what your problem/correction was ?

Mon, 2005-06-27 10:55
Joined: 2004-10-28
Forum posts: 14
Re: HTTP POST
   Hello stephbel,

   Excuse my little English. Such another troubles in Symbian C++ programming, there is insufficient documentation about libraries and classes, so I had to solve trying different choices still one worked.
   In my application, I read from a file the content of a POST request in GetNextDataPart() method. In this method I manage a boolean variable that shows if file was fully read (last RFile::Read() returned a zero length descriptor). ReleaseData() method doesn't call RHTTPTransaction::NotifyNewRequestBodyPartL() if previous GetNextDataPart() method didn't read anythig from file.
   I hope this can be useful for solving your problem.

Code:
TBool CHttp::GetNextDataPart(TPtrC8& aDataPart) {
TBool ret = ETrue;
if(iPost) {
TPtr8 ptr = iBuffer->Des();
iPostDataFile.Read(ptr);
aDataPart.Set(ptr);
if (ptr.Length() > 0) {
ret = EFalse;
}
iPostCompleted = ret;
}

return ret;
}


void CHttp::ReleaseData() {
if (iPost && !iPostCompleted)
iTransaccion.NotifyNewRequestBodyPartL();
}


TInt CHttp::Reset() {
return KErrNotSupported;
}


TInt CHttp::OverallDataSize() {
TInt tam = KErrNotFound;
if (iPost)
iPostDataFile.Size(tam);
return tam ;
}
Mon, 2005-08-08 10:56
Forum Nokia Champion
Joined: 2004-06-30
Forum posts: 36
Re: HTTP POST
I forget to reply...

Yes thanks that works fine now ! Grin
Thu, 2007-01-04 14:45
Joined: 2007-01-04
Forum posts: 3
Re: HTTP POST
Hello, did you get to work out with the HTTP POST ? I need some help with it. I'm getting stuck with a E32USER-CBASE 42 error ( I used Panix to find it out ) right before MHFRunL get called to notify a EGotResponseHeaders event.

Any ideas of what I can do to work this out ?

Thanks !!
Thu, 2007-01-04 14:52
Forum Nokia Champion
Joined: 2003-10-01
Forum posts: 723
Re: HTTP POST
And does this help?

Quote
This panic is raised by the SetActive() member function of an active object, a CActive. It is caused by an attempt to flag the active object as active when it is already active, i.e. a request is still outstanding.

Cited from SDK help.  Roll Eyes

Tote

Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/

Thu, 2007-01-04 15:11
Joined: 2007-01-04
Forum posts: 3
Re: HTTP POST
thanks you for your reply.

I already looked at the SDK's documentation but It didnt help. The problem is that I am not directly using setactive() it may be done by the framework, before to launch the MHFRunl method.
and I am having the same error when doing a POST from a file using the SDK's example httpexampleclient.
  • Login to reply to this topic.