Hi,
After debugging the JS code, found on the HTTPService.js class something that I
think is not ok.
The function org.apache.flex.net.HTTPService.prototype.send = function(value)
expects an argument, but that is not send, and the value of the var "value"
defaults to null.
Around line 320 there's the following code:
if (value !== '')
{
contentData = value;
}
I think the problem is here, as null is always not equivalent to '' therefore
contentData is set to null and send to the server as an empty string.
Changed the class by commenting these piece of code, and I got the posted data
on the server side. Problem solved!
(I really needed this to start implementing AMF in JS)
Hope this helps in some way.
Paulo Esgaio
-----Mensagem original-----
De: Logibérica - Paulo Esgaio [mailto:[email protected]]
Enviada: 5 de junho de 2014 10:00
Para: [email protected]
Cc: Logibérica - Jaime Martin; Logibérica - Marco Peixoto
Assunto: RE: HTTPService Example
Hi Alex,
Thank you!
Same code in the Actionscript version is working like a charm, but the JS
version is not sending any data.
Also called your post app for testing using JS.
-----Mensagem original-----
De: Alex Harui [mailto:[email protected]]
Enviada: 4 de junho de 2014 21:47
Para: [email protected]
Cc: Logibérica - Jaime Martin; Logibérica - Marco Peixoto
Assunto: Re: HTTPService Example
Is it not working for both the ActionScript and JavaScript versions?
I don't have a real server for testing POST, my test app sends to
http://httpbin.org/post and the returned data looks right to me, but I could be
missing something.
Or try a network monitor. Is the data really not being sent at all or could it
be mis-identified?
Thanks,
-Alex
On 6/4/14 5:57 AM, "Logibérica - Paulo Esgaio" <[email protected]>
wrote:
>Hi
>
>No they are there. It always ends on onRequestComplete(), and on the
>server side I get a request.
>On the onRequestComplete I can read the previous posted data onto
>_HTTPService.contentData, on the property _HTTPService.result_data.
>It seems that _HTTPService.contentData is not being send to the server
>but keeps its contents on client side.
>
>private function onRequestComplete(e:org.apache.flex.events.Event):void
>{
> Alert.show("Success", "Posting Data",Alert.OK);
> MyTxtResult.text = _HTTPService.result_data; }
>
>private function onRequestFault(e:org.apache.flex.events.Event):void
>{
> Alert.show("ERROR","Posting Data",Alert.OK); }
>
>-----Mensagem original-----
>De: Deepak MS [mailto:[email protected]]
>Enviada: 4 de junho de 2014 12:38
>Para: [email protected]
>Cc: Logibérica - Marco Peixoto
>Assunto: Re: HTTPService Example
>
>Are you missing result and fault events?
>
>_HTTPService.addEventListener("result",onResult);
>_HTTPService.addEventListener("fault",onFault);
>
>
>
>On Wed, Jun 4, 2014 at 4:18 PM, Logibérica - Paulo Esgaio <
>[email protected]> wrote:
>
>> Sorry for the late answer.
>>
>> I didn't receive any error, but on the server side (using PHP) the
>> $_POST var is empty. The http headers are OK.
>>
>> Here's the partial code:
>>
>> private var _HTTPService:HTTPService = new HTTPService(); ...
>> _HTTPService.method = "POST"
>> _HTTPService.url = _url;
>> _HTTPService.contentType = "charset=x-user-defined";
>> _HTTPService.contentData = my_data_to_send;
>> _HTTPService.addEventListener("complete",onRequestComplete);
>> _HTTPService.addEventListener("ioError",onRequestFault);
>> _HTTPService.send();
>>
>> If i'm doing something wrong, please give me some guide lines.
>>
>> TIA.
>>
>> -----Mensagem original-----
>> De: Alex Harui [mailto:[email protected]]
>> Enviada: 3 de junho de 2014 04:55
>> Para: [email protected]
>> Cc: Logibérica - Marco Peixoto
>> Assunto: Re: HTTPService Example
>>
>> A simple POST test worked for me. Did you get an error? What were
>> you trying to post?
>>
>> -Alex
>>
>> On 6/2/14 10:18 AM, "pesgaio" <[email protected]> wrote:
>>
>> >Thak you, but I meant a FlexJS example.
>> >
>> >
>> >
>> >
>> >--
>> >View this message in context:
>> >http://apache-flex-development.2333347.n4.nabble.com/FlexJS-HTTPServ
>> >i
>> >ce
>> >-Ex
>> >ample-tp37930p37933.html
>> >Sent from the Apache Flex Development mailing list archive at
>>Nabble.com.
>>
>>
>>
>>
>>