Saturday, September 15, 2012

Now you can send the SoapFaults to the Fault Sequence in WSO2 ESB

WSO2 ESB 4.5.0 was released recently. There are many new features, enhancements and performance gains in this new release. I wanted to highlight one new cool feature which I couldn't wait anymore. That is the title of this post.

In the previous releases of WSO2 ESB fault sequence was hit only when there was a fault during the mediation process taking place inside the WSO2 ESB. If a soap fault was received from a backend service it was sent to the out sequence because the WSO2 ESB considered it as a response from the backend. It was fair from ESB's point of view and unfair from developer's point of view. But with the 4.5.0 release, now you can send the soap faults to the fault sequence and do the fault handling.

To do that, you need to set the FORCE_ERROR_ON_SOAP_FAULT property before you send the message to the backend. This is a newly introduced property and following sample proxy service will show you how to do it.


   
      
         
         
      
      
         
      
      
         
            
         
      
      
         

Hope this property will help many integration developers during their use of WSO2 ESB.

NOTE

Above proxy configuration was taken from a resource which was emailed to me by Kasun Indrasiri who is an ESB expert in WSO2.

Happy Integration.... :)

8 comments:

  1. i have a 4 sequences those are inserting in different 4 tables . so i can define this property in every sequence else just in insequence only .

    ReplyDelete
  2. As far as I understand, you have four sequences and each sequence has a send mediator to invoke the data service. If these invocations happen one after another, you need to add the property in each sequence. If only one sequence is invoked based on some parameter, then it is enough to add the property in the in-sequence.

    ReplyDelete
  3. Hello Amila,

    I have a sequence that I do some xlst transformations and after this, I invoke my service in some endpoit. When the endpoint return for me some fault message I need transform (by xslt e.g.) this fault message in one message for the client, I have configurated my fault sequence and configurated the FORCE_ERROR_ON_SOAP_FAULT in "in sequence", but anyway this dont work, the ESB return error below:

    [2013-04-05 12:34:40,032] ERROR - ClientUtils The system cannot infer the transport information from the /services/BusinessMgrGateway URL.
    [2013-04-05 12:34:40,032] ERROR - Axis2Sender Unexpected error during sending message out

    Can you do help me, please?

    ReplyDelete
  4. In your scenario it seems the ESB has failed to send the message to the backend service. Seems it is unable to detect some transport related information. Its better if you can post your question in StackOverflow, so a wider audience can help you by looking at your proxy service configuration.

    ReplyDelete

  5. Below is the dss error while i am running esb and also esb is showing an error as {"ResponseJSON":{"Exception":"","Status":"500000"}} so, what does it mean?can one help me.

    at java.lang.Thread.run(Thread.java:679)
    Caused by: javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:clientid
    DS Code: INCOMPATIBLE_PARAMETERS_ERROR
    Source Data Service:-
    Name: mparameter_DataService
    Location: /mparameter_DataService.dbs
    Description: N/A
    Default Namespace: http://ws.wso2.org/dataservice
    Current Request Name: mparameter
    Current Params: {parameterid=}

    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:105)
    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.getReader(DSOMDataSource.java:116)
    at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getDirectReader(OMSourcedElementImpl.java:225)
    ... 41 more

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Hello! This example is not work for my task.
    I have REST service, which return error http 500 (specially). Fault sequence not catch this error. How to catch this error?

    ReplyDelete
  8. HTTP 500 is a valid response for ESB. So, it does not route it to the fault sequence. This feature only captures SOAP Faults. If you want to send HTTP 500 kind of responses to the fault sequence, you need to check for the response code within the out sequence and if it is 500, invoke the fault sequence.

    ReplyDelete