You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@synapse.apache.org by "Obendorf, Mike" <Mi...@intuit.com> on 2009/02/13 18:53:21 UTC

Problems with Synapse REST proxy

My understanding from https://issues.apache.org/jira/browse/SYNAPSE-365
and https://issues.apache.org/jira/browse/SYNAPSE-412  is that I can
setup a RESTProxy and call that proxy - essentially as a passthrough and
expect the same response as if I had invoked the REST service directly.
I have a fairly simple GET on a resource that returns an xml response if
I call it directly, but if I attempt a GET on the resource through my
Synapse Proxy, the Response is a 301 - Moved Permanently. I'm hoping
that you can shed some light on what I might be doing wrong. Thanks!

 

I am using a SNAPSHOT build that I downloaded last night and the Synapse
config is as follows:

 

<syn:definitions xmlns:syn="http://ws.apache.org/ns/synapse">

    <syn:proxy name="RESTTxnService" startOnLoad="true" >

        <syn:target>

            <syn:endpoint>

                <syn:address
uri="http://host0925.pharos.intuit.com:8080/sb/customer/v1/102099219"
format="get" trace="enable" />

            </syn:endpoint>

            <syn:outSequence>

                <syn:send/>

            </syn:outSequence>

        </syn:target>

    </syn:proxy>

</syn:definitions>

 

The Request, Response and Synapse output:

 

GET /services/RESTTxnService HTTP/1.1

User-Agent: Fiddler

Host: localhost:8280

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-excel, application/vnd.ms-powerpoint,
application/msword, application/xaml+xml,
application/vnd.ms-xpsdocument, application/x-ms-xbap,
application/x-ms-application, application/x-shockwave-flash, */*

Accept-Language: en-us

UA-CPU: x86

Content-Type: text/xml

Accept-Encoding: gzip, deflate

Cookie: locationValue=<cookie stuff>

Connection: Keep-Alive

Authorization: <auth stuff>

 

HTTP/1.1 301 Moved Permanently

Location: /services/

Date: Fri, 13 Feb 2009 17:09:54 GMT

Server: Synapse-HttpComponents-NIO

Transfer-Encoding: chunked

Connection: Keep-Alive

 

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG ServerH

andler HTTP connection [/127.0.0.1:3896]: Connected

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG ServerH

andler HTTP connection [/127.0.0.1:3896]: GET /services/RESTTxnService
HTTP/1.1

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG headers

 >> GET /services/RESTTxnService HTTP/1.1

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG headers

 >> User-Agent: Fiddler

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG headers

 >> Host: localhost:8280

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG headers

 >> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-excel, applicati

on/vnd.ms-powerpoint, application/msword, application/xaml+xml,
application/vnd.ms-xpsdocument, appl

ication/x-ms-xbap, application/x-ms-application,
application/x-shockwave-flash, */*

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG headers

 >> Accept-Language: en-us

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG headers

 >> UA-CPU: x86

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG headers

 >> Content-Type: text/xml

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG headers

 >> Accept-Encoding: gzip, deflate

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG headers

 >> Cookie: locationValue=<cookie info>

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG headers

 >> Connection: Keep-Alive

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG headers

 >> Authorization: <auth stuff>

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG ServerH

andler HTTP connection [/127.0.0.1:3896]: Output ready

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG ServerH

andler HTTP connection [closed]: Content encoder [chunk-coded;
completed: true]

2009-02-13 09:09:54,983 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-1] DEBUG ServerH

andler HTTP connection [closed]: Closed

 

 

 

If I attempt a GET on just /services then I see my Snapse Proxy is
available - apparently as a SOAP based service ("RESTTxnService?wsdl").
Again, the Request, Response, and Synapse output follows:

 

GET /services HTTP/1.1

User-Agent: Fiddler

Host: localhost:8280

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-excel, application/vnd.ms-powerpoint,
application/msword, application/xaml+xml,
application/vnd.ms-xpsdocument, application/x-ms-xbap,
application/x-ms-application, application/x-shockwave-flash, */*

Accept-Language: en-us

UA-CPU: x86

Content-Type: text/xml

Accept-Encoding: gzip, deflate

Cookie: <cookie>

Connection: Keep-Alive

Authorization: <auth>

 

HTTP/1.1 200 OK

Content-Type: text/html

Date: Fri, 13 Feb 2009 17:35:06 GMT

Server: Synapse-HttpComponents-NIO

Connection: Keep-Alive

Content-Length: 301

 

<html><head><title>Axis2: Services</title></head><body><h2>Deployed
services</h2><h3><a
href="RESTTxnService?wsdl">RESTTxnService</a></h3>Available operations
<ul><li>mediate</li></ul><hr><h2><font color="blue">Faulty
Services</font></h2><h3><font
color="blue">RESTTxnService</font></h3></body></html>

 

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG ServerH

andler HTTP connection [/127.0.0.1:3983]: Connected

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG ServerH

andler HTTP connection [/127.0.0.1:3983]: GET /services HTTP/1.1

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG headers

 >> GET /services HTTP/1.1

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG headers

 >> User-Agent: Fiddler

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG headers

 >> Host: localhost:8280

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG headers

 >> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-excel, applicati

on/vnd.ms-powerpoint, application/msword, application/xaml+xml,
application/vnd.ms-xpsdocument, appl

ication/x-ms-xbap, application/x-ms-application,
application/x-shockwave-flash, */*

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG headers

 >> Accept-Language: en-us

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG headers

 >> UA-CPU: x86

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG headers

 >> Content-Type: text/xml

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG headers

 >> Accept-Encoding: gzip, deflate

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG headers

 >> Cookie: locationValue=san_diego;
s_vi=[CS]v1|492B127700007F88-A3A0942000039BB[CE]; s_cc=true; s_

sq=%5B%5BB%5D%5D; INTUIT_SESSIONID=c17Sr0PfzPjarKH75RPt9g**.g31-2;
SHOPPER_USER_ID=1687295976

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG headers

 >> Connection: Keep-Alive

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG headers

 >> Authorization: Basic QWxtaXJhOmludHVpdA==

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG ServerH

andler HTTP connection [/127.0.0.1:3983]: Output ready

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG ServerH

andler HTTP connection [closed]: Content encoder [chunk-coded;
completed: true]

2009-02-13 09:35:06,158 [172.18.50.117-SDGD04LKCKRDW] [http-Listener I/O
dispatcher-2] DEBUG ServerH

andler HTTP connection [closed]: Closed


Re: Problems with Synapse REST proxy

Posted by Andreas Veithen <an...@gmail.com>.
Mike,

I think a realistic view is as follows:
- Synapse relies on Axis2 to handle REST (which internally represents
REST requests as SOAP); REST support in Synapse is therefore as
good/complete as in Axis2. Note that since I'm not very familiar with
that part of Axis2, I'm not in a position to give an opinion on its
quality.
- REST is not entirely transport agnostic. Since Synapse has its own
(non blocking) HTTP transport implementation, this means that there
can be specific issues which appear in Synapse but that don't exist
with Axis2's default HTTP transport (as can be seen from this thread).
Note that these issues are in general quite easy to fix. In addition,
since the transports are loosely coupled to the rest of Synapse, you
can easily replace the HTTP transport component by a newer version. It
is just a matter of replacing a JAR file. You also have the option of
using Synapse with Axis2's default HTTP transport (though this is not
recommended for other reasons). All this means that the risk related
to this type of issue is quite low.

To answer your question about the priority of REST related
improvements, I think that everything depends on user feedback: If you
identify and report REST related issues and provide us with all the
info required to track them down, I'm pretty sure that enough people
in the developer community will be ready to help fixing them.

Andreas

PS: BTW, is there already a JIRA report about the issue you described
in the initial post? If not, please open one so that we can track that
problem.

On Tue, Feb 24, 2009 at 08:21, Obendorf, Mike
<Mi...@intuit.com> wrote:
> Thanks for the replies Andreas and Asankha. From these responses I'm
> getting the impression that Synapse is not really setup to support
> RESTful services - is this an incorrect read? I'd really like to use the
> built-in Synapse mediators (particularly throttling) with REST services,
> but I'd like to know that Synapse fully supports (or will in the
> near-term) the proxying of REST services and mediation/transformation of
> same. Is this something that is high on the priority list for the next
> release(s)?
>
> Thanks again for your insights...
>
> Mike
>
> -----Original Message-----
> From: Andreas Veithen [mailto:andreas.veithen@gmail.com]
> Sent: Saturday, February 14, 2009 2:08 AM
> To: user@synapse.apache.org
> Subject: Re: Problems with Synapse REST proxy
>
> For the blocking HTTP transport, this issue was solved in
> WSCOMMONS-405. We should realign the behavior of the NIO transport
> with this.
>
> Andreas
>
> On Sat, Feb 14, 2009 at 06:52, Asankha C. Perera <as...@apache.org>
> wrote:
>> Hi Mike
>>>
>>> My understanding from
> https://issues.apache.org/jira/browse/SYNAPSE-365
>>> and https://issues.apache.org/jira/browse/SYNAPSE-412  is that I can
>>> setup a RESTProxy and call that proxy - essentially as a passthrough
> and
>>> expect the same response as if I had invoked the REST service
> directly.
>>> I have a fairly simple GET on a resource that returns an xml response
> if
>>> I call it directly, but if I attempt a GET on the resource through my
>>> Synapse Proxy, the Response is a 301 - Moved Permanently. I'm hoping
>>> that you can shed some light on what I might be doing wrong. Thanks!
>>>
>>
>> This seems like a bug, where the request did not get dispatched to the
>> service, and hence a redirect to the service list page instead.. I
> think we
>> need to fix the existing JIRA's and ensure good support for REST
>>
>> cheers
>> asankha
>>
>> --
>> Asankha C. Perera
>> http://adroitlogic.org
>>
>> http://esbmagic.blogspot.com
>>
>>
>

RE: Problems with Synapse REST proxy

Posted by "Obendorf, Mike" <Mi...@intuit.com>.
Thanks for the replies Andreas and Asankha. From these responses I'm
getting the impression that Synapse is not really setup to support
RESTful services - is this an incorrect read? I'd really like to use the
built-in Synapse mediators (particularly throttling) with REST services,
but I'd like to know that Synapse fully supports (or will in the
near-term) the proxying of REST services and mediation/transformation of
same. Is this something that is high on the priority list for the next
release(s)?

Thanks again for your insights...

Mike

-----Original Message-----
From: Andreas Veithen [mailto:andreas.veithen@gmail.com] 
Sent: Saturday, February 14, 2009 2:08 AM
To: user@synapse.apache.org
Subject: Re: Problems with Synapse REST proxy

For the blocking HTTP transport, this issue was solved in
WSCOMMONS-405. We should realign the behavior of the NIO transport
with this.

Andreas

On Sat, Feb 14, 2009 at 06:52, Asankha C. Perera <as...@apache.org>
wrote:
> Hi Mike
>>
>> My understanding from
https://issues.apache.org/jira/browse/SYNAPSE-365
>> and https://issues.apache.org/jira/browse/SYNAPSE-412  is that I can
>> setup a RESTProxy and call that proxy - essentially as a passthrough
and
>> expect the same response as if I had invoked the REST service
directly.
>> I have a fairly simple GET on a resource that returns an xml response
if
>> I call it directly, but if I attempt a GET on the resource through my
>> Synapse Proxy, the Response is a 301 - Moved Permanently. I'm hoping
>> that you can shed some light on what I might be doing wrong. Thanks!
>>
>
> This seems like a bug, where the request did not get dispatched to the
> service, and hence a redirect to the service list page instead.. I
think we
> need to fix the existing JIRA's and ensure good support for REST
>
> cheers
> asankha
>
> --
> Asankha C. Perera
> http://adroitlogic.org
>
> http://esbmagic.blogspot.com
>
>

Re: Problems with Synapse REST proxy

Posted by Andreas Veithen <an...@gmail.com>.
For the blocking HTTP transport, this issue was solved in
WSCOMMONS-405. We should realign the behavior of the NIO transport
with this.

Andreas

On Sat, Feb 14, 2009 at 06:52, Asankha C. Perera <as...@apache.org> wrote:
> Hi Mike
>>
>> My understanding from https://issues.apache.org/jira/browse/SYNAPSE-365
>> and https://issues.apache.org/jira/browse/SYNAPSE-412  is that I can
>> setup a RESTProxy and call that proxy - essentially as a passthrough and
>> expect the same response as if I had invoked the REST service directly.
>> I have a fairly simple GET on a resource that returns an xml response if
>> I call it directly, but if I attempt a GET on the resource through my
>> Synapse Proxy, the Response is a 301 - Moved Permanently. I'm hoping
>> that you can shed some light on what I might be doing wrong. Thanks!
>>
>
> This seems like a bug, where the request did not get dispatched to the
> service, and hence a redirect to the service list page instead.. I think we
> need to fix the existing JIRA's and ensure good support for REST
>
> cheers
> asankha
>
> --
> Asankha C. Perera
> http://adroitlogic.org
>
> http://esbmagic.blogspot.com
>
>

Re: Problems with Synapse REST proxy

Posted by "Asankha C. Perera" <as...@apache.org>.
Hi Mike
> My understanding from https://issues.apache.org/jira/browse/SYNAPSE-365
> and https://issues.apache.org/jira/browse/SYNAPSE-412  is that I can
> setup a RESTProxy and call that proxy - essentially as a passthrough and
> expect the same response as if I had invoked the REST service directly.
> I have a fairly simple GET on a resource that returns an xml response if
> I call it directly, but if I attempt a GET on the resource through my
> Synapse Proxy, the Response is a 301 - Moved Permanently. I'm hoping
> that you can shed some light on what I might be doing wrong. Thanks!
>   
This seems like a bug, where the request did not get dispatched to the 
service, and hence a redirect to the service list page instead.. I think 
we need to fix the existing JIRA's and ensure good support for REST

cheers
asankha

-- 
Asankha C. Perera
http://adroitlogic.org

http://esbmagic.blogspot.com