Hi All,

I recently needed to call a Tuscany service (using json-rpc binding) from
Flex.  One of the Tuscany developers mentioned this was a common question
and thought it would be useful to post for the community.  Here's the
snippet of code we're using.  I hope it helps.

                        var http:HTTPService = new HTTPService();
                        http.addEventListener( ResultEvent.RESULT,
handleLoadTestData );
                        http.url =
"http://localhost/test/services/TestServiceComponent";;
                        http.method = "POST";
                        http.contentType = "application/json";

                        var jsonArgs:String = JSON.encode({
                              "params": ["5"],
                              "method": "getTestData",
                              "id": 1
                        });

                        http.send(jsonArgs);

The above snippet makes a call to our TestServiceComponent's getTestData
method (which expects a string arg -- "5").  The snippet also depends on an
external class called com.adobe.serialization.json.JSON.  It is part of
this library: http://code.google.com/p/as3corelib/

Regards,

Abraham

Reply via email to