HTTP POST
| Tue, 2005-05-17 07:47 | |
|
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. |
|






Forum posts: 14
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.
Forum posts: 723
tOtE
Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/
Forum posts: 36
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 ?
Forum posts: 14
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.
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 ;
}
Forum posts: 36
Yes thanks that works fine now !
Forum posts: 3
Any ideas of what I can do to work this out ?
Thanks !!
Forum posts: 723
Cited from SDK help.
Tote
Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/
Forum posts: 3
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.