Your welcome and nice to hear that you got it to work. Ruwan
On Wed, Jul 2, 2008 at 4:59 AM, <[EMAIL PROTECTED]> wrote: > Hi Ruwan, > > Thanks muchly. With this I was able to get it accepting. > > -Leander > > -----Original Message----- > From: "Ruwan Linton" <[EMAIL PROTECTED]> > Sent: Friday, June 27, 2008 9:55pm > To: [email protected], [EMAIL PROTECTED] > Subject: Re: Possible for Synapse to handle non-xml responses? > > Hi Leander, > > This is because of the following behavior of Axis2. > > Axis2 builds the message by selecting the builder associated with the > Content-Type, if there is no builder associated with the Content-Type of > the > message then it axis2 will default to the ApplicationXMLBuilder, this is > why > it is expecting a XML in here. > > To over come this you need to add the MessageBuilder for your Content-Type > into the axis2.xml. For example if you need to associate the Content-Type > "foo" with text messages, then you need to add the following section to the > builder definition section of the axis2.xml found at, repository/conf > folder > of the synapse installation directory. > > <!-- ================================================= --> > <!-- Message Builders --> > <!-- ================================================= --> > <!--Following content type to builder mapping can be used to implement > support for different message --> > <!--formats in Axis2. These message formats are expected to be resolved > based on the content type. --> > <messageBuilders> > <messageBuilder contentType="foo" > > class="org.apache.synapse.format.PlainTextBuilder"/> > </messageBuilders> > > Please note that I have shown just the builder for foo content type and > there will be a bunch of builders on a particular axis2.xml. At the same > time if you need to serialize this message correctly you will need to > register the message formatter as well on the axis2.xml. > > Hope this will help you to understand the behavior. > > Thanks, > Ruwan > > On 6/28/08, [EMAIL PROTECTED] < > [EMAIL PROTECTED]> wrote: > > > > Is it possible for synapse to handle non-xml responses to messages? That > > is, suppose I have a <default> endpoint, and it gets a message bound for > a > > normal webserver: > > > > To Address: http://www.example.com/foo > > Content of foo: > > > > Hello, world! > > ^D > > > > Endpoint: > > <default format="get" trace="enable"/> > > > > When the content of foo is valid xml, it gets returned from the endpoint, > > albeit with a content-type of application/xml regardless of the > content-type > > set by www.example.com. > > Non-XML content however, throws this exception: > > > > <Exception>Unexpected response received : > > com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'H' > (code > > 47) in prolog; expected '<' > > at [row,col {unknown-source}]: [1,1]</Exception> > > > > ...which I take to mean that synapse (or axis? This seems to happen > before > > the message gets to any Synapse code) was expecting an XML document > rather > > than some other content type. Is there a way around this? > > > > Thanks, > > > > -Leander > > > > > > > -- > Ruwan Linton > http://wso2.org - "Oxygenating the Web Services Platform" > http://ruwansblog.blogspot.com/ > > > -- Ruwan Linton http://wso2.org - "Oxygenating the Web Services Platform" http://ruwansblog.blogspot.com/
