Very cool... Nice to hear that you got it to work.

Thanks,
Ruwan

On Thu, Jul 16, 2009 at 10:20 AM, Coulombe, Greg
<[email protected]>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:[email protected]]
> Sent: Tuesday, July 14, 2009 3:37 PM
> To: [email protected]
> 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
> <[email protected]>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:[email protected]]
> > Sent: Tuesday, July 14, 2009 12:45 AM
> > To: [email protected]
> > 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<[email protected]>
> > 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: [email protected]; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com

Reply via email to