1 Reply Latest reply on Jun 5, 2014 5:27 AM by jfb00

    How to call HTTPservice for Java server side method and get JSON data.

    sathishnataraj

      Hi Guys,

       

      I'm learning Flex. I need your advise on the below.

       

      ===============================================

      Motive : Retrieve data from Oracle 11g DB, and Display in Flex Datagrid.

      ===============================================

      Hibernate - For Database data retrieval

      Java - Backend processing

      JSON - (Net sf json).

      * Create JSON object ( Put Java model data ex: Product)

      * Create JSON array ( Put all models data : All products)

      * Create JSON object ( put JSON array as Object : Ex: Products, All Products)

      * Return JSON object to Flex

       

      I was able to retrieve JSON data from a Website as below and it got displayed in Datagrid.

      I want to achieve the same for my server side Java Method (Preferably want to call Spring controllers method and handle it in backend and return JSON data to Flex).

       

      <s:HTTPService id="httpService"

          url="https://raw.githubusercontent.com/kronusme/dota2-api/master/data/heroes.json"

          resultFormat="text" method="POST" useProxy="false" result="onJSONLoad(event)"/>

       

      <s:RemoteObject id="po" destination="sebService" result="po_resultHandler(event)" />


      This remote object returns data but when I try to do JSON.parse in Flex, I get Unexpected Exception o encountered.

       

      I did lot of research on how to call the server side Java method from Flex HTTPService and couldn't find any help .

       

      Thanks in advance.

       

      Regards,

      Sathish Nataraj