问题描述
我正与一个基于Jetty的REST服务写道由第三方开发者,我必须做出的动作3.电话有多个呼叫可用,其中大部分工作,但只有一个我遇到的麻烦:要结束一个会议上,我不得不作出一个POST请求的http://本地主机/控制/结束
。
I'm working with a Jetty based REST service wrote by a 3rd party developer to which I have to make calls from actionscript 3. There are multiple calls available and most of them work, there only one I'm having trouble with: To end a session I have to make a POST request to http://localhost/control/end
.
我做了与简单的REST客户端在Chrome和工程
I've made a basic test with Simple Rest Client in Chrome and that works:
- 我得到一个状态200响应
- 在服务控制台我看到一个
SETEND
通话发
- I get a status 200 response
- In service's console I see a
setEnd
call made
现在的问题是,当我尝试同样的动作,它似乎并没有工作。这是我的基本呼叫:
The problem is, when I try the same in actionscript, it doesn't seem to work.Here's my basic call:
private function deleteSID(event : MouseEvent) : void {
var request:URLRequest = new URLRequest(SERVER+"control/end");
request.method = URLRequestMethod.POST;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, deletedSID);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS , onHTTPStatus);
loader.load(request);
}
不过,我收到了404,而不是200,因为如果它实际上没有做一个POST。
But I get a 404 instead of a 200, as if it's not actually doing a POST.
不幸的是,我没有什么我可能会丢失是AP preciated了很多经验的REST API,所以任何提示/提示。
Unfortunately I don't have a lot experience with REST APIs, so any hint/tip on what I might be missing is appreciated.
推荐答案
试着用你的POST调用发送一些数据:
Try sending some data with your POST call:
var requestVars:URLVariables = new URLVariables();
requestVars.dummy = "lol";
...
request.data = requestVars;
这篇关于问题作出POST调用从AS3 REST服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!