Configuration looks ok. Do you get any errors when trying this out? Can you 
trace the message flow between Synapse and wikipedia and see if that works fine?

Thanks,
Hiranya


On Oct 5, 2012, at 2:04 PM, Kevin Minder <[email protected]> wrote:

> Hi I'm new to Synapse and could really use a leg up.  I'm experimenting with 
> using Synapse as a REST API "gateway".  For this experiment I'm trying to 
> pass a Wikipedia REST API call through Synapse basically unmodified.
> 
> I can use cURL for the Wikipedia REST API like this
> 
> curl 
> "http://en.wikipedia.org/w/api.php?&action=query&titles=Apache%20Synapse&format=json";
> 
> and get this JSON back.
> 
> {"query":{"pages":{"17911473":{"pageid":17911473,"ns":0,"title":"Apache 
> Synapse"}}}}
> 
> What would the required synapse.xml be to setup a dumb gateway for this API?  
> If this works I would expect the following curl to return the same result as 
> the previous curl.
> 
> curl 
> "http://localhost:8280/wiki/synapse?&action=query&titles=Apache%20Synapse&format=json";
>  
> 
> Here is one of the synapse variants that I have tried.  I love to write this 
> up as a sample to contribute if I can get it working.
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <definitions xmlns="http://ws.apache.org/ns/synapse";>
> <api name="wikipedia" context="/wiki">
>   <resource uri-template="/synapse" methods="GET">
>      <inSequence>
>         <log level="full"/>
>         <send>
>            <endpoint>
>               <address uri="http://en.wikipedia.org/w/api.php"; format="get"/>
>            </endpoint>
>         </send>
>      </inSequence>
>      <outSequence>
>         <log level="full"/>
>         <send/>
>      </outSequence>
>   </resource>
> </api>
> </definitions>

--
Hiranya Jayathilaka
Mayhem Lab/RACE Lab;
Dept. of Computer Science, UCSB;  http://cs.ucsb.edu
E-mail: [email protected];  Mobile: +1 (805) 895-7443
Blog: http://techfeast-hiranya.blogspot.com

  • REST Gateway Kevin Minder
    • Re: REST Gateway Hiranya Jayathilaka

Reply via email to