This probably means that the url is returning an HTML formatted error instead of an XML formatted one.  Try to find out the error, catch it and format it as xml to return to Flex.

 

Tracy


From: [email protected] [mailto:[email protected]] On Behalf Of Andrew D. Goodfellow
Sent: Friday, December 30, 2005 4:58 PM
To: [email protected]
Subject: Re: [flexcoders] Flex 1.5 HTTPService Fault: An XML element was malformed

 

Thanks Tracy, that did help. Now I'm getting a wierd fault back that says it can't parse the HTTP response, but everything is posting ok. I'll just catch the fault for now. Thanks again!

-Andy

On 12/30/05, Tracy Spratt <[EMAIL PROTECTED]> wrote:

Probably the returned xml is malformed. ;)

 

Seriously, call the HTTPService url directly from a browser.  What you get back will probably show the problem.

 

Ah, also, I am not sure that adding querystring data to the url is supported.  Instead, put your data into a request object and then call the naked url.  This way you can use POST, which can carry more data, more securely, and with less issues with escaping.

 

It is partially supported.  I found this in the docs:

url

url : String  

Location of the service. The specified URL should not contain any query parameters (? followed by name/value pairs), unless the HTTP method is GET and the
<mx:HTTPService> tag contains no request parameters. Currently you can only add parameters to the URL if you set it through ActionScript, not the tag. Use either the url property or the serviceName property, not both.

 

Still, it is an ugly way to do it.  Use the request Object.

var sReqParam:String = "SEL_EVENT" + sWhatever;

var oRequest:Object = new Object({sql: sReqParam })

eventHTTP.send(oRequest );

 

Tracy

 


From: [email protected] [mailto:[email protected]] On Behalf Of Andrew D, Goodfellow
Sent: Friday, December 30, 2005 1:30 AM
To: [email protected]
Subject: [flexcoders] Flex 1.5 HTTPService Fault: An XML element was malformed

 

Does anyone know why when I run this code I get an error that says: "HTTPService Fault: An XML element was malformed."? It seems to only happen when I escape things like & and # into the URL.


<?xml version=" 1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">

    <mx:HTTPService id="eventHTTP" url=""
    <mx:Script>
    <![CDATA[
   
        function HTTPServiceErrorTest():Void {
            var myEscapedStuff:String = escape("&");
            eventHTTP.url = "" href="http://127.0.0.1/intranet?sql=SEL_EVENT" target="_blank"> http://127.0.0.1/intranet?sql=SEL_EVENT "+myEscapedStuff;
            eventHTTP.send();
        }
       
        ]]>
    </mx:Script>
    <mx:Button label="Button" click="HTTPServiceErrorTest()"/>
</mx:Application>

TIA

-Andy




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com



SPONSORED LINKS

Web site design development

Computer software development

Software design and development

Macromedia flex

Software development best practice

 

 


YAHOO! GROUPS LINKS

 

 






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to