This is a known issue with Flex's HTTPService (and should be fixed in
Flex SDK 2.0.1 Hotfix 2).
 
For now, before calling send, convert the content to a String by
explicitly calling content.toXMLString(). 
 
service.send(content.toXMLString());
 
Note that XML.toString() and XML.toXMLString() behave differently
according to the E4X specification. If there is a single node that has
simple content, the simple content will be unwrapped when toString() is
used, but not in the case of toXMLString(). Furthermore, if the node's
simple content is actually empty, then you'll run into another known
issue with the player that if there is no content to POST (i.e. the
empty String) then the request is converted to a GET.
 
 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of kaleb_pederson
Sent: Tuesday, April 24, 2007 3:42 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Bug: GET/POST determined by XML Contents not
method



When I send data to a web service, whether or not it sends the 
request as a GET or a POST is determined by contents of the XML that 
I happened to be sending.

For example, here's the ActionScript I used:

import mx.rpc.http.HTTPService;

var service:HTTPService = new HTTPService();

service.url = "http://localhost:8080/path/to/dest
<http://localhost:8080/path/to/dest> ";
service.method = "POST";
service.contentType = HTTPService.CONTENT_TYPE_XML;

var content:XML = <test/>; // FAILS - Sent as a GET
//var content:XML = <test></test>; // FAILS - Sent as a GET
//var content:XML = <test><hasChild/></test>; // WORKS - Sent as a 
POST

service.send( content );

As indicated in the comments above, if I add a dummy child node to 
my root element, it makes the request a POST. Without it, 
it sends the request as a GET. 

This is definitely repeatable on my end. Can anyone else confirm 
this bug please?

Thanks.

--Kaleb



 

Reply via email to