<sequence name="_throttle_out_handler_" xmlns="http://ws.apache.org/ns/synapse">
    <filter source="get-property('MESSAGE_FORMAT')" regex="soap1[1-2]">
        <then>
            <property name="SOAP_FAULT_CODE" value="Server"/>
            <makefault version="soap11">
                <code expression="$ctx:SOAP_FAULT_CODE"/>
                <reason expression="$ctx:ERROR_MESSAGE"/>
                <detail expression = "$ctx:ERROR_DETAIL"/>
            </makefault>
        </then>
        <else>
            <filter source="boolean(get-property('NEXT_ACCESS_UTC_TIME'))" regex="true">
            <then>
                <payloadFactory media-type="json">
                    <format>{"code":"$1","message":"$2","description":"$3","nextAccessTime":"$4"}</format>
                    <args>
                        <arg expression="$ctx:ERROR_CODE"/>
                        <arg expression="$ctx:ERROR_MESSAGE"/>
                        <arg expression="$ctx:ERROR_DETAIL"/>
                        <arg expression="$ctx:NEXT_ACCESS_UTC_TIME"/>
                    </args>
                </payloadFactory>
            </then>
                <else>
                    <payloadFactory media-type="json">
                        <format>{"code":"$1","message":"$2","description":"$3"}</format>
                        <args>
                            <arg expression="$ctx:ERROR_CODE"/>
                            <arg expression="$ctx:ERROR_MESSAGE"/>
                            <arg expression="$ctx:ERROR_DETAIL"/>
                        </args>
                    </payloadFactory>
                </else>
            </filter>
            <filter source="$axis2:HTTP_METHOD" regex="^(?!.*(POST|PUT|PATCH)).*$">
                <property name="messageType" value="application/json" scope="axis2"/>
            </filter>
        </else>
    </filter>
    <property name="RESPONSE" value="true"/>
    <header name="To" action="remove"/>
    <property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
    <property name="ContentType" scope="axis2" action="remove"/>
    <property name="Authorization" scope="transport" action="remove"/>
    <property name="Host" scope="transport" action="remove"/>
    <property name="Accept" scope="transport" action="remove"/>
    <property name="X-JWT-Assertion" scope="transport" action="remove"/>
    <sequence key="_cors_request_handler_"/>
</sequence>