我正在尝试通过BlazeDS集成Flex应用程序来访问Rest服务(使用泽西岛)。我能够让Rest +泽西工作(我猜是非常直截了当的),并且我能够配置Flex + BlazeDS。我正在寻找帮助,根据指定的注释(如rest服务类中的@Path )从Flex调用rest服务(不同方法)。
有人能提供一些指针/示例来配置Flex -BlazeDS来调用rest服务吗?
谢谢,
RJ
发布于 2011-02-15 14:29:05
首先,如果您使用的是BlazeDS,并且只有Flex客户机,那么应该设置BlazeDS远程对象,而不是REST服务。您可以使用amf通道并发送对象,而不是xml/json/text。
话虽如此,你用的是什么版本的挠曲?我只在使用URLRequest和URLLoader (或HTTPRequest)的Flex 4(和actionscript 3)中做到了这一点。
示例:
var dataRequest:URLRequest;
var dataLoader:URLLoader;
dataRequest = new URLRequest("http://localhost:8080/Path/to/webservice");
//using post in this case, you can also acess GET
dataRequest.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.xmlCoords = xml;
dataRequest.data = variables;
dataRequest.contentType = "application/xml";
dataRequest.requestHeaders.push(new URLRequestHeader("accept", "application/xml"));
dataLoader.load(dataRequest);Is it feasible to create a REST client with Flex?在这里讨论了这个主题,并给出了一些很好的提示,我认为您应该检查一下。
希望这能帮助你指出一些/指出你的正确方向。
https://stackoverflow.com/questions/5004232
复制相似问题