Hi All,

Running synapse3 with a rest api. I have a faultsequence defined which is being 
invoked when my backend call returns an error. The 500 internal server error is 
being sent back to my client, however, I cannot seem to send my error message 
back.

Here is my xml config fragment

<resource uri-template="/dutyhours/costcode/lasn/search?query={symbol}" 
methods="GET"
          content-type="text/plain; charset=utf-8">
    <inSequence>
        <header name="Access-Control-Allow-Origin" value="*" scope="transport"/>
        <payloadFactory>
            <format>
                <m0:RecordTAMediatorRequest
                        
xmlns:m0="http://services.ambulance.qld.gov.au/mediator/hcm/mra/mta/rta";>
                    <m0:query>$1</m0:query>
                    <m0:indexName>QASCostCode</m0:indexName>
                    <m0:responseFormat>json</m0:responseFormat>
                </m0:RecordTAMediatorRequest>
            </format>
            <args>
                <arg 
expression="url-encode(fn:concat('q=t_lasn:&#34;',get-property('uri.var.symbol'),'&#34;'))"/>
                <arg expression="get-property('uri.var.index')"/>
                <arg expression="get-property('uri.var.responseFormat')"/>
            </args>
        </payloadFactory>
        <property name="SOAPAction" value="searchForCostCentre" 
scope="transport"/>

        <send>
            <endpoint>
                <address
                        
uri="http://PC004406:8280/services/RecordTAMediatorProxy.RecordTAMediatorProxyHttpSoap11Endpoint";
                        format="soap11"/>
            </endpoint>
        </send>
    </inSequence>
    <outSequence>
        <header name="Access-Control-Allow-Origin" value="*" scope="transport"/>
        <!--<xslt key="json_only"/>-->
        <filter source="get-property('uri.var.responseFormat')" regex="xml">
            <then>
                <property name="messageType" value="application/xml" 
scope="axis2"/>
                <respond/>
            </then>
            <else>
                <property name="TRANSPORT_HEADERS" action="remove" 
scope="axis2"/>
                <property name="messageType" value="text/plain" scope="axis2"/>
                <property name="ContentType" value="text/plain" scope="axis2"/>
                <header name="Access-Control-Allow-Origin" value="*" 
scope="transport"/>
                <xslt key="rta_rest_api_transform"/>
                <respond/>
            </else>
        </filter>
        <send/>
    </outSequence>
    <faultSequence>
        <property name="messageType" value="text/xml" scope="axis2"/>
        <property name="ContentType" value="text/xml" scope="axis2"/>
        <property name="Content-Type" value="text/xml" scope="transport"/>
        <property name="HTTP_SC" value="500" scope="axis2"/>
        <makefault response="true" version="pox">
            <code xmlns:tns="http://www.w3.org/2003/05/soap-envelope"; 
value="tns:Receiver"/>
            <reason expression="get-property('ERROR_DETAIL')"/>
        </makefault>

        <log level="full"/>
        <send/>
    </faultSequence>
</resource>

In my log statement in the faultsequence I see this

INFO LogMediator To: 
/rest/mediator/hcm/mra/mta/rta/dutyhours/costcode/lasn/search?query=south, 
MessageID: urn:uuid:c2b2c888-02d2-4c8f-a715-8528e10c1512, Direction: request, 
Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope 
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";><soapenv:Header/><soapenv:Body><tp:fault
 xmlns:tp="http://test.com";><tp:code>500</tp:code><tp:type>Status 
report</tp:type><tp:message>Internal Server 
Error</tp:message><tp:description>Barf.</tp:description></tp:fault></soapenv:Body></soapenv:Envelope>

Which is what I want to see in my rest client (soap-ui).

However, all I see in my client are the headers, body is empty / null. Any 
ideas? I'm guessing it has something to do with my contentType and my axis2 
config for messageFormatter's and or messageBuilder's?

I've also tried replacing makefault mediator with a payloadfactory, but same 
problem.

Cheers,
Matt.



This email, including any attachments sent with it, is confidential and for the 
sole use of the intended recipient(s). This confidentiality is not waived or 
lost, if you receive it and you are not the intended recipient(s), or if it is 
transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this 
email is strictly prohibited. The information contained in this email, 
including any attachment sent with it, may be subject to a statutory duty of 
confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in 
error, you are asked to immediately notify the sender. You should also delete 
this email, and any copies, from your computer system network and destroy any 
hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or 
take any action(s) that relies on it; any form of disclosure, modification, 
distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure 
this email does not contain malicious software, the Queensland Ambulance 
Service does not accept responsibility for the consequences if any person's 
computer inadvertently suffers any disruption to services, loss of information, 
harm or is infected with a virus, other malicious computer programme or code 
that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and 
not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland 
Government as an information source only. The State of Queensland makes no 
statements, representations or warranties about the accuracy, completeness or 
reliability of any information contained in this publication. The State of 
Queensland disclaims all responsibility and all liability (including without 
limitation for liability in negligence) for all expenses, losses, damages and 
costs you might incur as a result of the information being inaccurate or 
incomplete in any way, and for any reason reliance was placed on such 
information.

Reply via email to