1
votes

I am trying to integrate Flex application to access Rest services (using Jersey) through BlazeDS. I'm able to get Rest + Jersey working (pretty straight forward I guess) and I was able to configure Flex + BlazeDS. I'm looking for help to invoke rest services (different methods) from Flex UI based on the annotations specified such as @Path in my rest service class.

Can someone provide some pointers/examples to configure Flex -BlazeDS to invoke the rest services?

Thanks,
RJ

1

1 Answers

0
votes

First off if you're using BlazeDS and only going to have Flex clients, you should setup BlazeDS remote objects instead of REST service. You can use amf channels and send objects instead of xml/json/text.

That being said, What version of flex are you using? I have only done this with Flex 4 (and actionscript 3) using URLRequest and URLLoader (or with HTTPRequest)
Example:

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? this topic has been discussed here with some good pointers and I think you should check it out.

Hopefully this can help you out some / point you in the right direction.