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/