全部,
我试图明确地找出 Flash/AS2 对 XML.sendAndLoad 使用什么方法(GET 或 POST)。
以下是帮助/文档 ( http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002340.html ) 关于该函数的说明
Encodes the specified XML object into an XML document, sends it to the specified URL using the POST method, downloads the server's response, and loads it into the resultXMLobject specified in the parameters.
但是,我使用此方法将 XML 数据发送到由另一个开发团队开发和维护的 Java Servlet。他们看到的日志条目如下所示:
GET /portal/delegate/[someService]?svc=setPayCheckInfo&XMLStr=[an encoded version of the XML I send]
经过 Google 搜索找出 POST 在日志中显示为 GET 的原因后,我发现了这篇 Adobe 技术说明 ( http://kb2.adobe.com/cps/159/tn_15908.html )。它是这样说的:
When loadVariables or getURL actions are used to send data to Java servlets it can appear that the data is being sent using a GET request, when the POST method was specified in the Flash movie.
This happens because Flash sends the data in a GET/POST hybrid format. If the data were being sent using a GET request, the variables would appear in a query string appended to the end of the URL. Flash uses a GET server request, but the Name/Value pairs containing the variables are sent in a second transmission using POST. Although this causes the servlet to trigger the doGet() method, the variables are still available in the server request.
我真的不太明白。什么是“GET/POST 混合格式”?
为什么 Flash 使用的方法(POST 或 GET)取决于数据是发送到 Java servlet 还是其他地方(例如 PHP 页面?)
有人能理解这个吗?非常感谢!
干杯, 马特
最佳答案
你有没有尝试过做这样的事情:
var sendVar=new LoadVars();
var xml=new XML("<r>test</r>");
sendVar.xml=xml;
sendVar.svc="setPayCheckInfo";
var receiveXML=new XML();
function onLoad(success) {
if (success) {
trace("receive:"+receiveXML);
} else {
trace('error');
}
}
receiveXML.onLoad=onLoad;
sendVar.sendAndLoad("http://mywebserver", receiveXML, "POST");
关于java - AS2 : Does xml. sendAndLoad 使用 POST 还是 GET?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1921481/