Search code examples
wso2esb

Different behaviors between ESB 4.9.0 and 4.8.1


I have this proxy service in ESB 4.8.1, when I test it with SoapUI 5.2.1. I got this problem:

  1. Does not write the full log in the server console when a timeout rise, but when I change it to custom it works.
  2. Does not return any response to SoapUI (payloadFactory does not work)

When I deploy it in ESB 4.9.0 it works perfectly. Its a bug from the older version? How can I fix it?

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="StockQuoteProxy"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <send>
            <endpoint>
               <address uri="http://localhost:8089/mockStockQuoteProxySoap11Binding"
                        format="soap11">
                  <timeout>
                     <duration>1000</duration>
                     <responseAction>fault</responseAction>
                  </timeout>
                  <suspendOnFailure>
                     <errorCodes>101500,101501,101506,101507,101508</errorCodes>
                     <initialDuration>2000</initialDuration>
                     <progressionFactor>1.0</progressionFactor>
                     <maximumDuration>3000</maximumDuration>
                  </suspendOnFailure>
                  <markForSuspension>
                     <errorCodes>101504,101505</errorCodes>
                     <retriesBeforeSuspension>3</retriesBeforeSuspension>
                     <retryDelay>1</retryDelay>
                  </markForSuspension>
               </address>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
      <faultSequence>
         <log level="full">
            <property name="FALLO" value="DETALLES DEL ERROR!!"/>
            <property name="message" expression="get-property('ERROR_MESSAGE')"/>
            <property name="code" expression="get-property('ERROR_CODE')"/>
            <property name="detail" expression="get-property('ERROR_DETAIL')"/>
            <property name="exception" expression="get-property('ERROR_EXCEPTION')"/>
         </log>
       <payloadFactory>
       <format>
         <ns:MyResponse xmlns:ns="http://services.samples">
           <ns:Error>Execution Error</ns:Error>
         </ns:MyResponse>
       </format>
     </payloadFactory>
         <header name="To" action="remove"/>
         <property name="RESPONSE" value="true"/>
         <property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
         <send/>
      </faultSequence>
   </target>
   <description/>
</proxy>                  

Thanks in advance.


Solution

  • Try with this fault sequence: Steps:

    1. Create my response message.
    2. Use the enrich mediator to store the body in property OK.
    3. Create a fault message.
    4. Override the body with the property OK using the enrich mediator.

      <payloadFactory>
          <format>
              <ns:getQuoteResponse xmlns:ns="http://services.samples">
                  <ns:return xmlns:ax21="http://services.samples/xsd">
                  <status>ERROR</status>
                  </ns:return>
              </ns:getQuoteResponse>
          </format>
      </payloadFactory>   
      <log level="full">
         <property name="MESSAGE" value="Mensaje despues del payloadFactory"></property>
      </log>  
      <enrich>
         <source clone="true" type="body"></source>
         <target action="replace" type="property" property="OK"></target>
      </enrich>       
        <makefault version="soap11">
          <code xmlns:soap11Env="schemas.xmlsoap.org/soap/envelope/" value="soap11Env:EdnpointTimeout"/>
          <reason value="timeout fault"/>
          <role/>
        </makefault>
      <enrich>
          <source type="property" clone="true" property="OK"/>
          <target type="body"/>
      </enrich>   
      <log level="full">
         <property name="MESSAGE" value="Mensaje despues del enrich"></property>
      </log>          
      <send/>