|
View:
New views
11 Messages
—
Rating Filter:
Alert me
|
|
|
Passing non-XML body content for REST servicesHello,
I am developing some REST services (using the a 1.3 snapshot build of synapse) and I'd like to use Synapse to proxy REST service calls that return (or accept) non-XML content. How do I configure Synapse to proxy that content without wrapping it in an XML element? The content types that I am interested in proxying are JSON and Binary. I have been playing with the Axis2 BinaryFormatter and BinaryBuilder and it seems close to what I am looking for but not exactly correct: when I call GET against a service that returns a content type of application/octet-stream, I get back the binary content but it is MIME encoded (I think) in a <binary/> element. Is there a way to configure synapse/axis2 to simply pass that binary data through untouched? Similarly, I would like to do this with plain text and/or JSON data too. Thanks, Greg Coulombe |
|
|
Re: Passing non-XML body content for REST servicesThat should be possible. Can you post your synapse.xml file?
Andreas On Mon, Jul 13, 2009 at 13:23, Coulombe, Greg<Greg_Coulombe@...> wrote: > Hello, > > I am developing some REST services (using the a 1.3 snapshot build of > synapse) and I'd like to use Synapse to proxy REST service calls that > return (or accept) non-XML content. How do I configure Synapse to proxy > that content without wrapping it in an XML element? The content types > that I am interested in proxying are JSON and Binary. I have been > playing with the Axis2 BinaryFormatter and BinaryBuilder and it seems > close to what I am looking for but not exactly correct: when I call GET > against a service that returns a content type of > application/octet-stream, I get back the binary content but it is MIME > encoded (I think) in a <binary/> element. Is there a way to configure > synapse/axis2 to simply pass that binary data through untouched? > Similarly, I would like to do this with plain text and/or JSON data too. > > Thanks, > > Greg Coulombe > > > |
|
|
RE: Passing non-XML body content for REST servicesSure. Here is the synapse.xml, axis2.xml is below:
<definitions xmlns="http://ws.apache.org/ns/synapse"> <endpoint name="myEndPoint"> <address uri="http://localhost:8080/myendpoint" format="rest" /> </endpoint> <proxy name="myProxy" transports="http" startOnLoad="true"> <target> <inSequence> <send> <endpoint key="myEndPoint" /> </send> </inSequence> <outSequence> <send/> </outSequence> </target> </proxy> <sequence name="errorHandler"> <log level="full" /> </sequence> </definitions> Snippets from axis2.xml: <messageBuilder contentType="*/*" class="org.apache.axis2.format.BinaryBuilder"/> ... <messageFormatter contentType="*/*" class="org.apache.axis2.format.BinaryFormatter"/> What should I modify to enable plain text, JSON and binary data to pass through without change? Thanks, --GKC -----Original Message----- From: Andreas Veithen [mailto:andreas.veithen@...] Sent: Tuesday, July 14, 2009 12:45 AM To: user@... Subject: Re: Passing non-XML body content for REST services That should be possible. Can you post your synapse.xml file? Andreas On Mon, Jul 13, 2009 at 13:23, Coulombe, Greg<Greg_Coulombe@...> wrote: > Hello, > > I am developing some REST services (using the a 1.3 snapshot build of > synapse) and I'd like to use Synapse to proxy REST service calls that > return (or accept) non-XML content. How do I configure Synapse to proxy > that content without wrapping it in an XML element? The content types > that I am interested in proxying are JSON and Binary. I have been > playing with the Axis2 BinaryFormatter and BinaryBuilder and it seems > close to what I am looking for but not exactly correct: when I call GET > against a service that returns a content type of > application/octet-stream, I get back the binary content but it is MIME > encoded (I think) in a <binary/> element. Is there a way to configure > synapse/axis2 to simply pass that binary data through untouched? > Similarly, I would like to do this with plain text and/or JSON data too. > > Thanks, > > Greg Coulombe > > > |
|
|
Re: Passing non-XML body content for REST servicesHi,
How about using org.apache.axis2.format.PlainTextFormatter and org.apache.axis2.format.PlainTextBuilder? Thanks, Supun.. On Tue, Jul 14, 2009 at 10:16 AM, Coulombe, Greg <Greg_Coulombe@...>wrote: > Sure. Here is the synapse.xml, axis2.xml is below: > > <definitions xmlns="http://ws.apache.org/ns/synapse"> > <endpoint name="myEndPoint"> > <address uri="http://localhost:8080/myendpoint" > format="rest" /> > </endpoint> > > <proxy name="myProxy" transports="http" startOnLoad="true"> > <target> > <inSequence> > <send> > <endpoint key="myEndPoint" /> > </send> > </inSequence> > <outSequence> > <send/> > </outSequence> > </target> > </proxy> > <sequence name="errorHandler"> > <log level="full" /> > </sequence> > </definitions> > > Snippets from axis2.xml: > > <messageBuilder contentType="*/*" > class="org.apache.axis2.format.BinaryBuilder"/> > ... > <messageFormatter contentType="*/*" > class="org.apache.axis2.format.BinaryFormatter"/> > > What should I modify to enable plain text, JSON and binary data to pass > through without change? > > Thanks, > > --GKC > > -----Original Message----- > From: Andreas Veithen [mailto:andreas.veithen@...] > Sent: Tuesday, July 14, 2009 12:45 AM > To: user@... > Subject: Re: Passing non-XML body content for REST services > > That should be possible. Can you post your synapse.xml file? > > Andreas > > On Mon, Jul 13, 2009 at 13:23, Coulombe, Greg<Greg_Coulombe@...> > wrote: > > Hello, > > > > I am developing some REST services (using the a 1.3 snapshot build of > > synapse) and I'd like to use Synapse to proxy REST service calls that > > return (or accept) non-XML content. How do I configure Synapse to > proxy > > that content without wrapping it in an XML element? The content types > > that I am interested in proxying are JSON and Binary. I have been > > playing with the Axis2 BinaryFormatter and BinaryBuilder and it seems > > close to what I am looking for but not exactly correct: when I call > GET > > against a service that returns a content type of > > application/octet-stream, I get back the binary content but it is MIME > > encoded (I think) in a <binary/> element. Is there a way to configure > > synapse/axis2 to simply pass that binary data through untouched? > > Similarly, I would like to do this with plain text and/or JSON data > too. > > > > Thanks, > > > > Greg Coulombe > > > > > > > -- Software Engineer, WSO2 Inc http://wso2.org supunk.blogspot.com |
|
|
Re: Passing non-XML body content for REST servicesIt would be great to be able to assign message builders/formatters on
a per proxy basis in synapse.xml. Thoughts? Paul On Tue, Jul 14, 2009 at 11:07 AM, Supun Kamburugamuva<supun06@...> wrote: > Hi, > How about using org.apache.axis2.format.PlainTextFormatter > and org.apache.axis2.format.PlainTextBuilder? > > Thanks, > Supun.. > > On Tue, Jul 14, 2009 at 10:16 AM, Coulombe, Greg > <Greg_Coulombe@...>wrote: > >> Sure. Here is the synapse.xml, axis2.xml is below: >> >> <definitions xmlns="http://ws.apache.org/ns/synapse"> >> <endpoint name="myEndPoint"> >> <address uri="http://localhost:8080/myendpoint" >> format="rest" /> >> </endpoint> >> >> <proxy name="myProxy" transports="http" startOnLoad="true"> >> <target> >> <inSequence> >> <send> >> <endpoint key="myEndPoint" /> >> </send> >> </inSequence> >> <outSequence> >> <send/> >> </outSequence> >> </target> >> </proxy> >> <sequence name="errorHandler"> >> <log level="full" /> >> </sequence> >> </definitions> >> >> Snippets from axis2.xml: >> >> <messageBuilder contentType="*/*" >> class="org.apache.axis2.format.BinaryBuilder"/> >> ... >> <messageFormatter contentType="*/*" >> class="org.apache.axis2.format.BinaryFormatter"/> >> >> What should I modify to enable plain text, JSON and binary data to pass >> through without change? >> >> Thanks, >> >> --GKC >> >> -----Original Message----- >> From: Andreas Veithen [mailto:andreas.veithen@...] >> Sent: Tuesday, July 14, 2009 12:45 AM >> To: user@... >> Subject: Re: Passing non-XML body content for REST services >> >> That should be possible. Can you post your synapse.xml file? >> >> Andreas >> >> On Mon, Jul 13, 2009 at 13:23, Coulombe, Greg<Greg_Coulombe@...> >> wrote: >> > Hello, >> > >> > I am developing some REST services (using the a 1.3 snapshot build of >> > synapse) and I'd like to use Synapse to proxy REST service calls that >> > return (or accept) non-XML content. How do I configure Synapse to >> proxy >> > that content without wrapping it in an XML element? The content types >> > that I am interested in proxying are JSON and Binary. I have been >> > playing with the Axis2 BinaryFormatter and BinaryBuilder and it seems >> > close to what I am looking for but not exactly correct: when I call >> GET >> > against a service that returns a content type of >> > application/octet-stream, I get back the binary content but it is MIME >> > encoded (I think) in a <binary/> element. Is there a way to configure >> > synapse/axis2 to simply pass that binary data through untouched? >> > Similarly, I would like to do this with plain text and/or JSON data >> too. >> > >> > Thanks, >> > >> > Greg Coulombe >> > >> > >> > >> > > > > -- > Software Engineer, WSO2 Inc > http://wso2.org > supunk.blogspot.com > -- Paul Fremantle Co-Founder and CTO, WSO2 Apache Synapse PMC Chair OASIS WS-RX TC Co-chair blog: http://pzf.fremantle.org paul@... "Oxygenating the Web Service Platform", www.wso2.com |
|
|
Re: Passing non-XML body content for REST servicesOn Tue, Jul 14, 2009 at 10:46 AM, Coulombe, Greg
<Greg_Coulombe@...>wrote: > Sure. Here is the synapse.xml, axis2.xml is below: > > <definitions xmlns="http://ws.apache.org/ns/synapse"> > <endpoint name="myEndPoint"> > <address uri="http://localhost:8080/myendpoint" > format="rest" /> > </endpoint> > > <proxy name="myProxy" transports="http" startOnLoad="true"> > <target> > <inSequence> > <send> > <endpoint key="myEndPoint" /> > </send> > </inSequence> > <outSequence> > <send/> > </outSequence> > </target> > </proxy> > <sequence name="errorHandler"> > <log level="full" /> > </sequence> > </definitions> > > Snippets from axis2.xml: > > <messageBuilder contentType="*/*" > class="org.apache.axis2.format.BinaryBuilder"/> > ... > <messageFormatter contentType="*/*" > class="org.apache.axis2.format.BinaryFormatter"/> Hi, I am not exactly sure, but I don't think axis2 supports wild cards for the content type when declaring the message builders and formatters :-( So you need to give the exact set of content types that you are expecting to receive. Thanks, Ruwan > > > What should I modify to enable plain text, JSON and binary data to pass > through without change? > > Thanks, > > --GKC > > -----Original Message----- > From: Andreas Veithen [mailto:andreas.veithen@...] > Sent: Tuesday, July 14, 2009 12:45 AM > To: user@... > Subject: Re: Passing non-XML body content for REST services > > That should be possible. Can you post your synapse.xml file? > > Andreas > > On Mon, Jul 13, 2009 at 13:23, Coulombe, Greg<Greg_Coulombe@...> > wrote: > > Hello, > > > > I am developing some REST services (using the a 1.3 snapshot build of > > synapse) and I'd like to use Synapse to proxy REST service calls that > > return (or accept) non-XML content. How do I configure Synapse to > proxy > > that content without wrapping it in an XML element? The content types > > that I am interested in proxying are JSON and Binary. I have been > > playing with the Axis2 BinaryFormatter and BinaryBuilder and it seems > > close to what I am looking for but not exactly correct: when I call > GET > > against a service that returns a content type of > > application/octet-stream, I get back the binary content but it is MIME > > encoded (I think) in a <binary/> element. Is there a way to configure > > synapse/axis2 to simply pass that binary data through untouched? > > Similarly, I would like to do this with plain text and/or JSON data > too. > > > > Thanks, > > > > Greg Coulombe > > > > > > > -- Ruwan Linton Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb WSO2 Inc.; http://wso2.org email: ruwan@...; cell: +94 77 341 3097 blog: http://ruwansblog.blogspot.com |
|
|
Re: Passing non-XML body content for REST servicesCompletely +1 for the feature paul... but implementation wise this will
requires some changes to the axis2 :-( Thanks, Ruwan On Tue, Jul 14, 2009 at 4:17 PM, Paul Fremantle <pzfreo@...> wrote: > It would be great to be able to assign message builders/formatters on > a per proxy basis in synapse.xml. Thoughts? > > Paul > > On Tue, Jul 14, 2009 at 11:07 AM, Supun Kamburugamuva<supun06@...> > wrote: > > Hi, > > How about using org.apache.axis2.format.PlainTextFormatter > > and org.apache.axis2.format.PlainTextBuilder? > > > > Thanks, > > Supun.. > > > > On Tue, Jul 14, 2009 at 10:16 AM, Coulombe, Greg > > <Greg_Coulombe@...>wrote: > > > >> Sure. Here is the synapse.xml, axis2.xml is below: > >> > >> <definitions xmlns="http://ws.apache.org/ns/synapse"> > >> <endpoint name="myEndPoint"> > >> <address uri="http://localhost:8080/myendpoint" > >> format="rest" /> > >> </endpoint> > >> > >> <proxy name="myProxy" transports="http" startOnLoad="true"> > >> <target> > >> <inSequence> > >> <send> > >> <endpoint key="myEndPoint" /> > >> </send> > >> </inSequence> > >> <outSequence> > >> <send/> > >> </outSequence> > >> </target> > >> </proxy> > >> <sequence name="errorHandler"> > >> <log level="full" /> > >> </sequence> > >> </definitions> > >> > >> Snippets from axis2.xml: > >> > >> <messageBuilder contentType="*/*" > >> class="org.apache.axis2.format.BinaryBuilder"/> > >> ... > >> <messageFormatter contentType="*/*" > >> class="org.apache.axis2.format.BinaryFormatter"/> > >> > >> What should I modify to enable plain text, JSON and binary data to pass > >> through without change? > >> > >> Thanks, > >> > >> --GKC > >> > >> -----Original Message----- > >> From: Andreas Veithen [mailto:andreas.veithen@...] > >> Sent: Tuesday, July 14, 2009 12:45 AM > >> To: user@... > >> Subject: Re: Passing non-XML body content for REST services > >> > >> That should be possible. Can you post your synapse.xml file? > >> > >> Andreas > >> > >> On Mon, Jul 13, 2009 at 13:23, Coulombe, Greg<Greg_Coulombe@...> > >> wrote: > >> > Hello, > >> > > >> > I am developing some REST services (using the a 1.3 snapshot build of > >> > synapse) and I'd like to use Synapse to proxy REST service calls that > >> > return (or accept) non-XML content. How do I configure Synapse to > >> proxy > >> > that content without wrapping it in an XML element? The content types > >> > that I am interested in proxying are JSON and Binary. I have been > >> > playing with the Axis2 BinaryFormatter and BinaryBuilder and it seems > >> > close to what I am looking for but not exactly correct: when I call > >> GET > >> > against a service that returns a content type of > >> > application/octet-stream, I get back the binary content but it is MIME > >> > encoded (I think) in a <binary/> element. Is there a way to configure > >> > synapse/axis2 to simply pass that binary data through untouched? > >> > Similarly, I would like to do this with plain text and/or JSON data > >> too. > >> > > >> > Thanks, > >> > > >> > Greg Coulombe > >> > > >> > > >> > > >> > > > > > > > > -- > > Software Engineer, WSO2 Inc > > http://wso2.org > > supunk.blogspot.com > > > > > > -- > Paul Fremantle > Co-Founder and CTO, WSO2 > Apache Synapse PMC Chair > OASIS WS-RX TC Co-chair > > blog: http://pzf.fremantle.org > paul@... > > "Oxygenating the Web Service Platform", www.wso2.com > -- Ruwan Linton Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb WSO2 Inc.; http://wso2.org email: ruwan@...; cell: +94 77 341 3097 blog: http://ruwansblog.blogspot.com |
|
|
Re: Passing non-XML body content for REST services> I am not exactly sure, but I don't think axis2 supports wild cards for the
> content type when declaring the message builders and formatters :-( I think it does, but the patterns must be regular expressions, so ".*/.*" instead of "*/*". Andreas |
|
|
Re: Passing non-XML body content for REST servicesOn Tue, Jul 14, 2009 at 4:17 PM, Paul Fremantle<pzfreo@...> wrote:
> It would be great to be able to assign message builders/formatters on > a per proxy basis in synapse.xml. Thoughts? > > Paul +1 Thanks, Saliya > > On Tue, Jul 14, 2009 at 11:07 AM, Supun Kamburugamuva<supun06@...> wrote: >> Hi, >> How about using org.apache.axis2.format.PlainTextFormatter >> and org.apache.axis2.format.PlainTextBuilder? >> >> Thanks, >> Supun.. >> >> On Tue, Jul 14, 2009 at 10:16 AM, Coulombe, Greg >> <Greg_Coulombe@...>wrote: >> >>> Sure. Here is the synapse.xml, axis2.xml is below: >>> >>> <definitions xmlns="http://ws.apache.org/ns/synapse"> >>> <endpoint name="myEndPoint"> >>> <address uri="http://localhost:8080/myendpoint" >>> format="rest" /> >>> </endpoint> >>> >>> <proxy name="myProxy" transports="http" startOnLoad="true"> >>> <target> >>> <inSequence> >>> <send> >>> <endpoint key="myEndPoint" /> >>> </send> >>> </inSequence> >>> <outSequence> >>> <send/> >>> </outSequence> >>> </target> >>> </proxy> >>> <sequence name="errorHandler"> >>> <log level="full" /> >>> </sequence> >>> </definitions> >>> >>> Snippets from axis2.xml: >>> >>> <messageBuilder contentType="*/*" >>> class="org.apache.axis2.format.BinaryBuilder"/> >>> ... >>> <messageFormatter contentType="*/*" >>> class="org.apache.axis2.format.BinaryFormatter"/> >>> >>> What should I modify to enable plain text, JSON and binary data to pass >>> through without change? >>> >>> Thanks, >>> >>> --GKC >>> >>> -----Original Message----- >>> From: Andreas Veithen [mailto:andreas.veithen@...] >>> Sent: Tuesday, July 14, 2009 12:45 AM >>> To: user@... >>> Subject: Re: Passing non-XML body content for REST services >>> >>> That should be possible. Can you post your synapse.xml file? >>> >>> Andreas >>> >>> On Mon, Jul 13, 2009 at 13:23, Coulombe, Greg<Greg_Coulombe@...> >>> wrote: >>> > Hello, >>> > >>> > I am developing some REST services (using the a 1.3 snapshot build of >>> > synapse) and I'd like to use Synapse to proxy REST service calls that >>> > return (or accept) non-XML content. How do I configure Synapse to >>> proxy >>> > that content without wrapping it in an XML element? The content types >>> > that I am interested in proxying are JSON and Binary. I have been >>> > playing with the Axis2 BinaryFormatter and BinaryBuilder and it seems >>> > close to what I am looking for but not exactly correct: when I call >>> GET >>> > against a service that returns a content type of >>> > application/octet-stream, I get back the binary content but it is MIME >>> > encoded (I think) in a <binary/> element. Is there a way to configure >>> > synapse/axis2 to simply pass that binary data through untouched? >>> > Similarly, I would like to do this with plain text and/or JSON data >>> too. >>> > >>> > Thanks, >>> > >>> > Greg Coulombe >>> > >>> > >>> > >>> >> >> >> >> -- >> Software Engineer, WSO2 Inc >> http://wso2.org >> supunk.blogspot.com >> > > > > -- > Paul Fremantle > Co-Founder and CTO, WSO2 > Apache Synapse PMC Chair > OASIS WS-RX TC Co-chair > > blog: http://pzf.fremantle.org > paul@... > > "Oxygenating the Web Service Platform", www.wso2.com > -- Saliya Ekanayake http://www.esaliya.blogspot.com http://www.esaliya.wordpress.com |
|
|
RE: Passing non-XML body content for REST servicesHi all,
I just wanted to write back to the group to indicate that the problem has been resolved: I was correctly configuring axis2 with the BinaryBuilder/Formatter as follows: <messageFormatter contentType="application/octet-stream" class="org.apache.axis2.format.BinaryFormatter"/> ... <messageBuilder contentType="application/octet-stream" class="org.apache.axis2.format.BinaryBuilder"/> The problem I was having was that I didn't have any mediators set up for the incoming binary message. Thus, the output of the binary builder ("<binary>...</binary") was being passed directly to the response. The problem was that the content type of the message after it was processed by the BinaryBuilder was application/xml. Since I didn't have any more mediators set up, Synapse dutifully forwared that in-memory XML to the response. Once I added a property mediator that set the content type to application/octet-stream, the BinaryFormatter was called during the response process and the binary was output just fine. The final proxy config that accomplished the pass-through follows: <proxy name="binary" transports="http" startOnLoad="true"> <target> <endpoint> <address uri="http://server:8080/" format="rest" /> </endpoint> <outSequence> <property action="set" scope="axis2" name="messageType" value="application/octet-stream"/> <send/> </outSequence> </target> </proxy> --GKC -----Original Message----- From: Supun Kamburugamuva [mailto:supun06@...] Sent: Tuesday, July 14, 2009 3:37 PM To: user@... Subject: Re: Passing non-XML body content for REST services Hi, How about using org.apache.axis2.format.PlainTextFormatter and org.apache.axis2.format.PlainTextBuilder? Thanks, Supun.. On Tue, Jul 14, 2009 at 10:16 AM, Coulombe, Greg <Greg_Coulombe@...>wrote: > Sure. Here is the synapse.xml, axis2.xml is below: > > <definitions xmlns="http://ws.apache.org/ns/synapse"> > <endpoint name="myEndPoint"> > <address uri="http://localhost:8080/myendpoint" > format="rest" /> > </endpoint> > > <proxy name="myProxy" transports="http" startOnLoad="true"> > <target> > <inSequence> > <send> > <endpoint key="myEndPoint" /> > </send> > </inSequence> > <outSequence> > <send/> > </outSequence> > </target> > </proxy> > <sequence name="errorHandler"> > <log level="full" /> > </sequence> > </definitions> > > Snippets from axis2.xml: > > <messageBuilder contentType="*/*" > class="org.apache.axis2.format.BinaryBuilder"/> > ... > <messageFormatter contentType="*/*" > class="org.apache.axis2.format.BinaryFormatter"/> > > What should I modify to enable plain text, JSON and binary data to > through without change? > > Thanks, > > --GKC > > -----Original Message----- > From: Andreas Veithen [mailto:andreas.veithen@...] > Sent: Tuesday, July 14, 2009 12:45 AM > To: user@... > Subject: Re: Passing non-XML body content for REST services > > That should be possible. Can you post your synapse.xml file? > > Andreas > > On Mon, Jul 13, 2009 at 13:23, Coulombe, > wrote: > > Hello, > > > > I am developing some REST services (using the a 1.3 snapshot build of > > synapse) and I'd like to use Synapse to proxy REST service calls that > > return (or accept) non-XML content. How do I configure Synapse to > proxy > > that content without wrapping it in an XML element? The content types > > that I am interested in proxying are JSON and Binary. I have been > > playing with the Axis2 BinaryFormatter and BinaryBuilder and it seems > > close to what I am looking for but not exactly correct: when I call > GET > > against a service that returns a content type of > > application/octet-stream, I get back the binary content but it is MIME > > encoded (I think) in a <binary/> element. Is there a way to configure > > synapse/axis2 to simply pass that binary data through untouched? > > Similarly, I would like to do this with plain text and/or JSON data > too. > > > > Thanks, > > > > Greg Coulombe > > > > > > > -- Software Engineer, WSO2 Inc http://wso2.org supunk.blogspot.com |
|
|
Re: Passing non-XML body content for REST servicesVery cool... Nice to hear that you got it to work.
Thanks, Ruwan On Thu, Jul 16, 2009 at 10:20 AM, Coulombe, Greg <Greg_Coulombe@...>wrote: > Hi all, > > I just wanted to write back to the group to indicate that the problem > has been resolved: I was correctly configuring axis2 with the > BinaryBuilder/Formatter as follows: > > <messageFormatter contentType="application/octet-stream" > class="org.apache.axis2.format.BinaryFormatter"/> > > ... > > <messageBuilder contentType="application/octet-stream" > class="org.apache.axis2.format.BinaryBuilder"/> > > The problem I was having was that I didn't have any mediators set up for > the incoming binary message. Thus, the output of the binary builder > ("<binary>...</binary") was being passed directly to the response. The > problem was that the content type of the message after it was processed > by the BinaryBuilder was application/xml. Since I didn't have any more > mediators set up, Synapse dutifully forwared that in-memory XML to the > response. Once I added a property mediator that set the content type to > application/octet-stream, the BinaryFormatter was called during the > response process and the binary was output just fine. The final proxy > config that accomplished the pass-through follows: > > <proxy name="binary" transports="http" startOnLoad="true"> > <target> > <endpoint> > <address uri="http://server:8080/" > format="rest" /> > </endpoint> > <outSequence> > <property action="set" scope="axis2" > name="messageType" value="application/octet-stream"/> > <send/> > </outSequence> > </target> > </proxy> > > --GKC > > > -----Original Message----- > From: Supun Kamburugamuva [mailto:supun06@...] > Sent: Tuesday, July 14, 2009 3:37 PM > To: user@... > Subject: Re: Passing non-XML body content for REST services > > Hi, > How about using org.apache.axis2.format.PlainTextFormatter > and org.apache.axis2.format.PlainTextBuilder? > > Thanks, > Supun.. > > On Tue, Jul 14, 2009 at 10:16 AM, Coulombe, Greg > <Greg_Coulombe@...>wrote: > > > Sure. Here is the synapse.xml, axis2.xml is below: > > > > <definitions xmlns="http://ws.apache.org/ns/synapse"> > > <endpoint name="myEndPoint"> > > <address uri="http://localhost:8080/myendpoint" > > format="rest" /> > > </endpoint> > > > > <proxy name="myProxy" transports="http" startOnLoad="true"> > > <target> > > <inSequence> > > <send> > > <endpoint key="myEndPoint" /> > > </send> > > </inSequence> > > <outSequence> > > <send/> > > </outSequence> > > </target> > > </proxy> > > <sequence name="errorHandler"> > > <log level="full" /> > > </sequence> > > </definitions> > > > > Snippets from axis2.xml: > > > > <messageBuilder contentType="*/*" > > class="org.apache.axis2.format.BinaryBuilder"/> > > ... > > <messageFormatter contentType="*/*" > > class="org.apache.axis2.format.BinaryFormatter"/> > > > > What should I modify to enable plain text, JSON and binary data to > pass > > through without change? > > > > Thanks, > > > > --GKC > > > > -----Original Message----- > > From: Andreas Veithen [mailto:andreas.veithen@...] > > Sent: Tuesday, July 14, 2009 12:45 AM > > To: user@... > > Subject: Re: Passing non-XML body content for REST services > > > > That should be possible. Can you post your synapse.xml file? > > > > Andreas > > > > On Mon, Jul 13, 2009 at 13:23, Coulombe, > Greg<Greg_Coulombe@...> > > wrote: > > > Hello, > > > > > > I am developing some REST services (using the a 1.3 snapshot build > of > > > synapse) and I'd like to use Synapse to proxy REST service calls > that > > > return (or accept) non-XML content. How do I configure Synapse to > > proxy > > > that content without wrapping it in an XML element? The content > types > > > that I am interested in proxying are JSON and Binary. I have been > > > playing with the Axis2 BinaryFormatter and BinaryBuilder and it > seems > > > close to what I am looking for but not exactly correct: when I call > > GET > > > against a service that returns a content type of > > > application/octet-stream, I get back the binary content but it is > MIME > > > encoded (I think) in a <binary/> element. Is there a way to > configure > > > synapse/axis2 to simply pass that binary data through untouched? > > > Similarly, I would like to do this with plain text and/or JSON data > > too. > > > > > > Thanks, > > > > > > Greg Coulombe > > > > > > > > > > > > > > > -- > Software Engineer, WSO2 Inc > http://wso2.org > supunk.blogspot.com > -- Ruwan Linton Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb WSO2 Inc.; http://wso2.org email: ruwan@...; cell: +94 77 341 3097 blog: http://ruwansblog.blogspot.com |
| Free embeddable forum powered by Nabble | Forum Help |