Many thanks buddy, but I solved the problem. It was exactly what you
also said. HTTPService.contentType = "application/xml", and some
errors in PHP as well. Btw, once in PHP I used this small piece of
code and it works great:

$raw_xml  = file_get_contents("php://input");
$xmlData = new SimpleXMLElement($raw_xml);

SimpleXMLElement is a very straightforward way to parse the xml.

Thanks again

Alen



--- In flexcoders@yahoogroups.com, "nathanpdaniel" <[EMAIL PROTECTED]> wrote:
>
> If you want to send raw XML from Flex, try building your XML within 
> Flex (like so)... 
> 
> <mx:XML id="myXML">
>  <data>{stringVar}</data>
> </mx:XML>
> 
> Then, in your HTTPService object, just keep the first line with one 
> exception:
> <mx:HTTPService id="xmlSender" contentType="application/xml" .... />
> 
> When you call myRequest.send() - use this instead: myRequest.send
> (myXML);
> 
> In your PHP you'll need to request like so:
> 
> if (isset($HTTP_RAW_POST_DATA)) {
>  $request_xml = $HTTP_RAW_POST_DATA;
> }
> else {
>  $request_xml = implode("\r\n", file('php://input'));
> }
> 
> 
> That's all I do :D  Your error could in fact be coming from your PHP 
> rather than Flex itself, such as, your PHP page is sending back an 
> HTML error saying it can't decode - if there's nothing to decode, it 
> will cause a problem.  I'm in the midst of the same error myself, if 
> I post invalid XML - or XML not compliant to the schema, it returns 
> an HTML error, throwing a fault in Flex, so it looks like a Flex 
> issue when it's actually a fault with what I'm sending.  Hope it 
> helps! -Nathan
> --- In flexcoders@yahoogroups.com, "b_alen" <alen.balja@> wrote:
> >
> > I'm sending the XML object to php in HTTPService.send(xmlObject);
> > 
> > But how do I receive it on the server and then store this as a new 
> xml
> > file on a server? I'm getting errors when I'm trying all of these on
> > the server:
> > 
> > $raw_xml = $_POST["data"];
> > //$raw_xml = $_REQUEST["data"];
> > //$raw_xml = file_get_contents("php://input");
> > 
> > And this is on the client:
> > 
> >      <mx:HTTPService id="xmlSender"
> >                     url="test.php"
> >                     method="POST" showBusyCursor="true" 
> useProxy="false"
> >                     result="handleResult(event)"
> >                     fault="handleFault(event)" >
> >                     
> >                     <mx:request>
> >                             <data>{stringVar}</data>
> >                     </mx:request>
> > 
> >     </mx:HTTPService>
> > 
> > 
> > If I put the something directly in the <data />, I get the result, 
> but
> > if I use the variable like above, I get:
> > 
> > faultCode="Client.CouldNotDecode" 
> > 
> > 
> > Weird, and I can't find anything like that on Google. I'm trying for
> > two days with no progress. 
> > 
> > 
> > Thanks,
> > 
> > Alen
> >
>


Reply via email to