Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-04-2007, 04:45 PM   #1
Daedalus
Flexified
 
Join Date: Aug 2005
Location: Bath, UK
Posts: 127
Question xml will not parse correctly in ASP when sent from flex

i'm sending some xml to asp from flex using the httpservice but when I try to parse the xml using the standard Microsoft.XMLDOM it always fails to parse the xml regardless of what xml I send. This leads me to think that flex is sending the xml incorrectly.

flex code>

request = new HTTPService();
request.url="http://127.0.0.1/test.asp";
request.contentType="application/xml"
request.method="POST"
request.resultFormat="text"
request.request = XML(<test>testingxml</test>);
request.addEventListener(ResultEvent.RESULT, success);
request.addEventListener(FaultEvent.FAULT, fault);
request.send();

private function success(e:mx.rpc.events.ResultEvent):void {
trace(e.result);
}

private function fault(e:mx.rpc.events.FaultEvent):void {
trace(e.message);
}

my ASP code>

Dim mydoc
Set mydoc=Server.CreateObject("Microsoft.XMLDOM")
mydoc.async=false
mydoc.load(Request)
Response.ContentType = "text/xml"
if mydoc.parseError.errorcode<>0 then
Response.write "<prob name='fail'>blah</prob>"
else
Response.write "<prob name='works'>yay</prob>"
end if


The asp script always sends <prob name='fail'>blah</prob> back to flex meaning that the xml failed to parse correctly. The xml is correct, if I load the same xml from a text file it will parse correctly, it only fails when the xml is loaded from flex.

Does anyone know the exact format that the xml is sent in using the httpservice.send() method? I tried using Request.Form in ASP but it only gives the error printed at the bottom of this post.

BTW is there anyway to get flex to trace error messages given from ASP when a script fails as I can't read them in a browser (because the request is sent using POST). When ASP gives an error flex either does not respond or gives this error which does not help my cause.

(mx.messaging.messages::ErrorMessage)#0
body = (Object)#1
clientId = "DirectHTTPChannel0"
correlationId = "39CFBD08-1AEC-89B8-EECA-57F7BC922158"
destination = ""
extendedData = (null)
faultCode = "Server.Error.Request"
faultDetail = "Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://127.0.0.1/test.asp"]. URL: http://127.0.0.1/test.asp"
faultString = "HTTP request error"
headers = (Object)#2
messageId = "3AC23FB2-BFB0-AC27-AE06-57F7BCC14B44"
rootCause = (flash.events::IOErrorEvent)#3
bubbles = false
cancelable = false
currentTarget = (flash.net::URLLoader)#4
bytesLoaded = 0
bytesTotal = 0
data = (null)
dataFormat = "text"
eventPhase = 2
target = (flash.net::URLLoader)#4
text = "Error #2032: Stream Error. URL: http://127.0.0.1/test.asp"
type = "ioError"
timestamp = 0
timeToLive = 0

Thanks in advance


EDIT:

I wrote the value of the ASP request (sent from flex) to a text file and I ended up getting blank, in other words no XML. Now i'm not even sure if flex is sending any xml.

Last edited by Daedalus; 05-04-2007 at 05:28 PM.
Daedalus is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flex Email a Form: PHP, ASP, ColdFusion videogamer2791 Flex 2, 3 & 4 1 05-31-2007 03:29 PM
sending xml to asp from flex Daedalus Server-Side Scripting 0 05-03-2007 04:16 PM
xml preloading problems irish10945 ActionScript 2.0 3 04-02-2007 05:00 PM
releasing xml file from XML.onLoad() sophistikat ActionScript 2.0 2 02-21-2007 07:00 PM
Parse XML to object kellere ActionScript 2.0 2 02-07-2007 02:58 AM


All times are GMT. The time now is 11:39 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.