Announcement Announcement Module
Collapse
No announcement yet.
How to implement WS-BaseFaults Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to implement WS-BaseFaults

    Hello,

    I'm playing around with writing a simple WS-Notification framework using Spring-WS, and I'm unclear on how to implement WS-Basefaults.

    I have the necessary classes to marshall/unmarshall a base fault, I'm just not sure how to wire them up using Spring-WS. As far as I can tell what I want to do is to extend AbstractSoapFaultDefinitionExceptionResolver and override customizeFault in order to make the SoapFault's detail compliant with WS-BaseFaults.

    This is where I get stuck. Based on another posting I read here Arjen specifically added SoapFaultDetail.getResult in order to do such a thing, but I'm not sure how to implement this. Is the answer as simple as writing my own ExceptionResolver with the appropriate marshaller wired in and then added my own SoapFaultDetail uses that marshaller to spit out the desired xml? Or should I go about this some other way?

    Thanks for any help.

  • #2
    Yes: to write to the detail of a SOAP fault, you basically create the detail entry (as a DOMSource, for instance), get the Result, and transform the source to the result.

    Comment


    • #3
      Arjen,

      Thanks for your response. I think I've got it now (roughly):

      Code:
      SoapFault fault = soapBody.addFault();
      SoapFaultDetail detail = fault.addFaultDetail();
      marshaller.marshall(myJaxBGraph, detail.getResult());
      I *think* this works but I ran into another problem. Namely that I am using WS-Addressing via a AnnotationActionEndpointMapping endpoint mapper. AnnotationActionEndpointMapping is an ancestor of AbstractAddressingEndpointMapping, which as you know adds an implicit AddressingEndpointInterceptor in between it's pre and post interceptors.

      My response with the WS-BaseFault detail doesn't get set because the AddressingEndpointInterceptor attempts to set the Action SOAP header variable to a default 'faultAction' in the case of a fault:

      Code:
      SoapMessage reply = (SoapMessage) messageContext.getResponse();
              URI replyMessageId = getMessageId(reply);
              URI action = !isFault ? replyAction : faultAction;
              MessageAddressingProperties replyMap = requestMap.getReplyProperties(replyEpr, action, replyMessageId);
              version.addAddressingHeaders(reply, replyMap);
      'faultAction' is always null, and it appears that AbstractAddressingEndpointMapping doesn't expose it either:

      Code:
      AddressingEndpointInterceptor interceptor =
                      new AddressingEndpointInterceptor(version, messageIdStrategy, messageSenders, responseAction, null);
      I suppose I could add my own post interceptor and reset the addressing header (or at least the action portion), but it seems so ugly. Would it be possible to expose a default 'faultAction' to be taken in AbstractAddressingEndpointMapping?

      Thanks!

      Comment

      Working...
      X