在flex中通过HTTPService.send()发送xml.tostring

时间:2009-06-30 08:05:27

标签: asp.net flex3

 public var newtreeItems:XML = <items><page caption="Page"><scene caption="Scene"></scene></page></items>;

private function BtnClick():void{
            var params:Object = {};             
            params["call"] = "WriteXml";
            params["XmlValue"] = newtreeItems.toString();
            Alert.show(xmlValue);
             hsData.send(params);
        }
<mx:HTTPService id="hsData" url="http://localhost/FlexXmlTest/Default.aspx" 
    fault="httpFaultHandler(event)"
    result="httpResultHandler(event)"
    method="POST"
    />

的Asp

switch (Request["call"])
            {

                case "WriteXml":
                    WriteXml(Request["XmlValue"]); // "in this method i am using StreamWriter to write as xml file"
                    break;

                case "AnotherMethod":
                    // your method call
                    break;
            }

我无法将此xml值发布到该页面...我将其保存为xml文件..但是如果我发送任何字符串值(“hi how ru”)没有任何标记意味着它的工作很好..

如何通过HTTPService发送xml格式的字符串?

1 个答案:

答案 0 :(得分:0)

您可以将http Service.content Type设置为“application / xml”