I’m trying to send some xml to asp using flex, all the script does is send back the xml that was received/loaded. When I simply load the xml from a text file on the server all is fine, however if I send the same xml from flex it does not work and I get this error in flex>
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL:
http://127.0.0.1/test.asp
My ASP CODE>
<%
Dim mydoc
Set mydoc=Server.CreateObject("Microsoft.XMLDOM")
mydoc.async=false
mydoc.load(Request)
if mydoc.parseError.errorcode<>0 then
Response.write mydoc.parseError.errorcode
else
Response.ContentType = "text/xml"
Response.write mydoc.xml
end if
%>
My XML>
<book category="COOKING"></book>
My Flex function that sends and receives the xml>
loader = new URLLoader();
loader.dataFormat = "text";
loader.addEventListener(Event.COMPLETE, loaded);
request = new URLRequest("http://127.0.0.1/NGC/login.asp");
request.data = XML(<book category="COOKING"></book>);
request.contentType = "text/xml";
request.method = "POST";
loader.load(request);
private function loaded(ev:Event):void {
try {
trace(ev.target.data);
} catch (err:TypeError) {
trace(err.message);
}
}
When I change the ASP code above to load the xml from a book.xml file with the same xml like so>
mydoc.load(Server.MapPath("book.xml"))
it works fine and asp sends the xml back to the client.
It could be that the response ASP sends back to flex is not xml, this could be because of a xml parse error when ASP tries to parse the request but the xml is no different then the one in the xml file, and on that occasion all is fine.