Response.Write("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
Response.Write("<user>");
Response.Write("<userName>" + userName + "</userName>");
Response.Write("<age>" + age + "</age>");
Response.Write("<sex>" + sex + "</sex>");
Response.Write("<hight>" + hight + "</hight>");
Response.Write("<weight>" + weight + "</weight>");
Response.Write("<address>" + address + "</address>");
Response.Write("<job>" + job + "</job>");
Response.Write("</user>");
以上是.net 的输出结果,使用flex HTTPService接收
flex中发送请求:
private function getUserInfo():void
{
httpser2.url="http://localhost:8888/hy/GetUserInfoFromServer.aspx";
var params:URLVariables = new URLVariables();
params.userName = httpEncoding(userName);
httpser2.send(params);
}
<mx:HTTPService id="httpser2" showBusyCursor="true" result="httpHandle2 (event);" resultFormat="e4x" useProxy="false" xmlDecode="xmlDecoder">
private function httpHandle2(e:ResultEvent):void //执行<mx:HTTPService>组件后的处理函数
{
var userNames:XML = e.result as XML;
Alert.show(userNames.userName);
}