FUSE Services Framework
  1. FUSE Services Framework
  2. SF-317

Returning SOAP headers doesn't work with Faults

    Details

    • Type: Enhancement Enhancement
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Resolved at Apache
    • Affects Version/s: 2.3.1-fuse-01-00
    • Fix Version/s: 2.3.3-fuse-00-00
    • Component/s: None
    • Labels:
      None
    • Similar Issues:
      Show 10 results 

      Description

      The solution for returning SOAP header described here: http://cxf.apache.org/faq.html (Question: How can I add soap headers to the request/response?). However it does not work with SOAP faults.

      I'm using binding server (so not @WebServiceProvider but @WebService). Please see attached test case for more details. I believe it's due to below code snippet of JAXWSMethodInvoker.java class:

      try {
                  if ((params == null || params.isEmpty()) && m.getDeclaringClass().equals(Provider.class)) {
                      params = Collections.singletonList(null);
                  }
                  res = CastUtils.cast((List)super.invoke(exchange, serviceObject, m, params));
                  addHandlerProperties(ctx, handlerScopedStuff);
                  //update the webservice response context
                  updateWebServiceContext(exchange, ctx);
              } finally {
                  //clear the WebServiceContextImpl's ThreadLocal variable
                  WebServiceContextImpl.clear();
              }
      

      As SOAP headers are copied within the function updateWebServiceContext() but it is only called in success scenario and all stuff is cleared in finally block so in case of a fault, the headers are lost.

        Activity

        Hide
        Joe Luo
        added a comment -

        Here is attached test case.
        Start.java under "cxf-soapfault-headers/cxf-server" directory is a server mainline.
        ServiceTests.java under "cxf-soapfault-headers/cxf-binding-client" directory is a JUnit test case.

        So just load both modules to eclipse and set break point on JAXWSMethodInvoker class of server side to see how it behaves in an exception scenario.

        It is a bit similar as SF-283 but the main difference is that in this case, I am using @WebService while in JIRA SF-283 @WebServiceProvider was used.

        Show
        Joe Luo
        added a comment - Here is attached test case. Start.java under "cxf-soapfault-headers/cxf-server" directory is a server mainline. ServiceTests.java under "cxf-soapfault-headers/cxf-binding-client" directory is a JUnit test case. So just load both modules to eclipse and set break point on JAXWSMethodInvoker class of server side to see how it behaves in an exception scenario. It is a bit similar as SF-283 but the main difference is that in this case, I am using @WebService while in JIRA SF-283 @WebServiceProvider was used.

          People

          • Assignee:
            Freeman(Yue) Fang
            Reporter:
            Joe Luo
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: