3 Replies Latest reply on Mar 27, 2013 2:53 PM by kcbabo

    consume external rest services

    hnqoliveira

      Hello,

       

      Please, I need integrate an application with arcgis server using the rest API.

      How is the best manner to do references to external HTTP/Rest services ?

       

      Follow an example of URL : http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Locators/ESRI_Geocode_USA/GeocodeServer/findAddressCandidates?Address=380+New+York+Street&City=Redlands&State=CA&Zip=92373&outFields=&outSR=&f=pjson

       

      Best Regards.

        • 1. Re: consume external rest services
          kcbabo

          You can use a RESTEasy binding for references to interact with RESTful services.  There's an example of doing that in the rest-binding quickstart:

          https://github.com/kcbabo/quickstarts/tree/master/rest-binding

           

          First step would be to construct a JAX-RS client interface that maps to the resource URL.  Not sure how pretty that particular resource path is going to look when mapped to JAX-RS.  Once you have the resource interface, you just need a custom message composer to set the JAX-RS method parameters based on the input message.

           

          Another option would be to use the HTTP binding, but we don't currently support constructing the target URL dynamically (e.g. based on message content).  Interesting enhancement for the future.

          • 2. Re: consume external rest services
            hnqoliveira

            In this case I can't use the RestEasy binding, because the service has many query parameters, and the switchyard-component-resteasy allow none or one parameter (the method org.switchyard.component.common.rest.RsMethodUtil.parseResources make this validation on component start).

            Another negative point that I see is the amount of extra code to mapping the resources, when I need just modify the value of query strings.

             

            The HTTP binding with the possibility to change/construct the URL dynamically will be the perfect in this case.

             

            Thank you.

            • 3. Re: consume external rest services
              kcbabo

              One of the features in 0.8 was to allow multiple parameters in your JAX-RS resource interface.  The service interface will only have a single parameter and the custom message composer is used to reconcile the two. 

               

              I have filed a JIRA for the HTTP binding enhancement:

              https://issues.jboss.org/browse/SWITCHYARD-1375