8 Replies Latest reply on Jul 10, 2013 4:24 PM by moraleslos

    Newb: Need help with rest binding

    moraleslos

      Hi all,

       

      I'm a total newb with SY and am following the rest-binding example for the quickstart but I'm not sure how everything works out.  I would like to create a simple service in SY that, when invoked by some outside source, calls an external REST service.

       

      So say I have this external REST service I would like to use:  http://host.com/rest/services/GeocodeServer/findCity?x=____&y=_____

       

      Now in SY, I want to create essentially a facade that will receive the x and y coordinates, invoke the above external REST service with the passed-in coordinates, and then return a result which is essentially a POJO that has city information.  The SY service looks something like this:

       

       

      Town findTownInformation(String x, String y)

       

       

      Where Town is just a POJO containing basic properties.

       

       

      Now looking at the example I need to create a service, it's implementation, and a reference to the external Web Service.  So far this is how my example SY.xml looks like:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" name="switchyard-rest-example" targetNamespace="urn:com.example.switchyard:switchyard-rest-example:0.0.1-SNAPSHOT">

        <sca:composite name="switchyard-rest-example" targetNamespace="urn:com.example.switchyard:switchyard-rest-example:0.0.1-SNAPSHOT">

          <sca:component name="InvokeRestServiceBean">

            <bean:implementation.bean class="com.example.switchyard.switchyard_rest_example.InvokeRestServiceBean"/>

            <sca:service name="InvokeRestService">

              <sca:interface.java interface="com.example.switchyard.switchyard_rest_example.InvokeRestService"/>

            </sca:service>

            <sca:reference name="InvokeRestServiceReference">

              <sca:interface.java interface="com.example.switchyard.switchyard_rest_example.InvokeRestServiceReference"/>

            </sca:reference>

          </sca:component>

        </sca:composite>

      </switchyard>

       

       

      I'm totally stuck at this point.  Any help would be appreciated.  TIA.