1 Reply Latest reply on Dec 9, 2014 11:32 AM by Tom Cunningham

    SyncServiceInvoker fault response changes http headers and changes soap version to use 1.1 default.

    rahul tandon Newbie



      I am having trouble trying to figure out something related to JBOSS ESB SyncServiceInvoker action. I have class which extends from SyncServiceInvoker and to provides custom fault-handling. For non-fault scenarios; the default functionality is used by calling "super.process". All seems to work perfectly for regular responses (non-fault response). The response message is received with the correct soap version and http headers (specifically referring to 'Content-Type' ) is received correctly. However for fault messages; the content-type is not returned and I'm finding it unable to 'SET' it in the header too. The soap version is also changed to  default (i.e version 1.1); however i managed to get around this by calling " MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL); "


      Reading around other posts and forums suggested that by adding the above; my content type should automatically be set correctly and received. However - that is not the case.

      Have also tried some other stuff thanks to answers to other related posts but doesn't seem to help.


      Version details :  JBoss SOA Platform: Embedded Server - Version 5.3.1.GA

      Seems there IS a bug related to fault handling in Jboss ESB ; but im not sure if its related to the problem i'm facing or if it's already resolved in 5.3.1 GA.


      Any inputs/advice/help/tips ? Thanks a lot!


      Bug ids: [JBESB-3796] Exception handling after SyncServiceInvoker fails - JBoss Issue Tracker

                   [JBESB-3772] SyncServiceInvoker does not reset ReplyTo and FaultTo EPR when deliverSync is succesful - JBoss Issue Track…


      Below is snapshot of code:



          public Message process(Message message) throws ActionProcessingException {


          Call call = message.getHeader().getCall();

          EPR fault = call.getFaultTo();

          EPR replyTo = call.getReplyTo();

          try {


          return super.process(message);


              } catch (ActionProcessingException e) {




                  return handleException(message, e, payloadProxy, printStackTrace);





           * handle ESB exceptions and set it back as SOAP Faults


          public static Message handleException(Message message, Throwable e, MessagePayloadProxy payloadProxy,

                                                boolean printStackTrace) {

              try {

                  MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);

                  SOAPMessage responseMessage = messageFactory.createMessage();

                  responseMessage.getMimeHeaders().setHeader("Content-Type", "application/soap+xml; charset=utf-8");                         //this doesn't seem to help. Checked in debug mode ; header is set on the object however actual response doesn't contain it.

                  responseMessage.setProperty("CHARACTER_SET_ENCODING", IMessageContent.ENCODING);


                  SOAPFault fault = responseMessage.getSOAPBody().addFault();

                  if (e.getCause() != null) {


                      addFaultDetails(e.getCause(), fault, printStackTrace);

                  } else {


                      addFaultDetails(e, fault, printStackTrace);


                  ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();



                  payloadProxy.setPayload(message, new String(byteArrayOutputStream.toByteArray(), IMessageContent.CHARSET));

              } catch (Exception exc) {


                          "Failed to handle fault on SOAP call", e);


              return message;