在flex中通过HTTPService.send()发送xml.tostring
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 r u”)而不带任何标签,则意味着它工作正常。 .
如何通过 HTTPService 发送 xml 格式的字符串?
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;
}
I cant able to post this xml value to that page... on that i am saving as a xml file..but if i send any string value like ("hi how r u") with out any tag means its working fine ..
how to send xml formatted string via HTTPService ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将 httpService.contentType 设置为“application/xml”
You can set httpService.contentType to "application/xml"