WSO2 ESB, and different response types for the same call

时间:2018-02-05 12:58:57

标签: wso2 esb

I am using WSO2 4.9. I have a simple endpoint defined as such

<endpoint name="someEndpoint">
    <address uri="someAddress" format="soap11">
</endpoint>

This specific endpoint also requires basic HTTP auth, which I provide like this:

<property name="Authorization" description="Set-User-Pwd" expression="fn:concat('Basic ', $ctx:authorizationProperty)" scope="transport" type="STRING"/>

I make a simple call towards it like this:

<call description="Some description">
    <endpoint key="someEndpoint"/>
</call>

I should note that the server which I'm attempting to call:

  • responds with a SOAP answer (i.e. proper XML, etc) when all is good
  • responds with a HTML answer when authorization errors happen

The problem I'm having concerns the situation when I'm passing it a wrong user. I'm expecting that in this scenario, my fault sequence would get invoked (the above is part of an api declaration, which also has a fault sequence). But this doesn't happen, and I get the following error:

Caused by: com.ctc.wstx.exc.WstxParsingException: Unexpected close tag </body>; expected </HR>.
 at [row,col {unknown-source}]: [1,1054]

I suspect this is happening because WSO2 attempts to parse my HTML response as if it were XML, and fails (which is understandable). I also suspect that this happens before any error sequence gets invoked, etc, and hence my problem.

Edit1: At the beginning of my outSequence, I have a log line which isn't getting printed. So I don't think this is something caused by whatever mediators are in outSequence.

        <outSequence>
            <log level="custom">
                <property name="message" value="OUT call!!!!!!!!!!!!!!!!!!!!!!!" />
            </log>
            ...
        </outSequence>

Edit2: Some more details about inSequence. It contains these lines, which seem to make no difference on the error message (i.e. I get the same if I remove).

<property name="messageType" scope="axis2" value="application/xml"/>
<property name="ContentType" scope="axis2" value="application/xml"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove" />

What can I do in this situation in order to be able to catch these errors? I should note that I don't particularly care about the text in the body (I'm only interested in HTTP status code and maybe HTTP status message).

0 个答案:

没有答案