Announcement Announcement Module
Collapse
No announcement yet.
Exception Resolvers Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exception Resolvers

    It is my understanding that to change the SOAP fault code or message that is associated with an exception all I should need to do is:

    Configure a bean that implements EndpointExceptionResolver, in this case, an instance of the SoapFaultMappingExceptionResolver.

    Specify the name of the exception and specify the Fault Code and optionally the message and language.

    The MessageDispatcher should find all beans that implement this interface.

    However, I have configured a bean (see below) as described , but it doesn't seem to be having any effect. I have even put a breakpoint in the resolveException method of the SoapFaultMappingExceptionResolver and it never stops there. What am I missing?

    <bean id="exceptionResolver" class="org.springframework.ws.soap.server.endpoint .SoapFaultMappingExceptionResolver">
    <property name="defaultFault">
    <value>SERVER</value>
    </property>
    <property name="exceptionMappings">
    <props>
    <prop key="com.sun.xml.wss.impl.WssSoapFaultException">
    SERVER, Invalid username or password!
    </prop>
    </props>
    </property>
    </bean>

  • #2
    How is exception matched?

    Does the SoapFaultMappingExceptionResolver match the specified class AND any subclasses? Or does the mapping only apply if exactly that exception occurs?

    Also, does the "name" property need to be set on the resolver? This is the only difference I can find between my config and the airline example, but mine does not seem to be working.

    Comment


    • #3
      Yes, it matches subclasses as well. As for the name property on an exception resolver: it does not have one, so I am unsure what you mean.

      Secondly, in the WS-Security implementation (the XwsSecurityInterceptor), we should probably catch the WssSoapFaultException, and create a Fault there. Seems like the proper thing to do. Could you create please a JIRA issue for this?

      Comment


      • #4
        Exception Resolvers

        Hi Arjen,

        I misspoke ... it was late in the day and my mind was burnt. I meant the 'order' property which I assume determines the order the exception resolvers are used to resolve an exception. I didn't specify it in mine, but noticed it was there in the example. I will add it and see if it makes a difference, but I'm guessing it should not matter.

        I agree that it would be nice if the Spring-WS code would detect the WS-Security exceptions like this one and create an appropriate fault. I will create a JIRA issue once I figure out how to do it ... it will be my first.

        All that said, is there any reason you can think of that my exception resolver would not have intercepted the WS-Security exception? It doesn't appear that the resolver I configure is ever invoked ... but I also don't get any errors that I can see that suggests it was configured improperly.

        Comment


        • #5
          The order property is not required. Only if you have multiple resolvers (as in the example), and you want to indicate a preference for one.

          Creating a JIRA issue is pretty simple . Just go here: http://opensource.atlassian.com/proj...ing/browse/SWS, create a login, and choose "Create New Issue".

          Comment


          • #6
            Defect entered into JIRA

            Sorry it took me this long to do it, but I have created bug SWS-188 in JIRA.

            Comment


            • #7
              I'm using Spring-WS Version 1.0.2 but I still can not map the wsse exceptions.
              JIRA states it should have been fixed with ws 1.0.1
              Does anybody know the trick?

              Thanks,
              Robert

              Comment


              • #8
                The WssSoapFaultException is mapped automatically to a SOAP Fault, so you don't need to add a mapping for it.

                Comment


                • #9
                  Arjen,
                  thanks for your reply. I appreciate your whole work.

                  I'm fairly new to webservices.
                  I want to map wsse failures to a generic message like "authentication failed".

                  Also, in SoapUI I receive a "missing fault" warning when authentication fails.

                  Comment


                  • #10
                    What is the exact client-side message and possible server-side log you get?

                    Comment


                    • #11
                      Arjen,

                      sorry for the long delay, I didn't see your reply, first.

                      In SoapUI I see the following warning when Authentication fails:
                      Thu Dec 06 08:50:32 CET 2007:WARN:Missing matching Fault in wsdl for bindingOperation [Person]


                      On the server side I get usual acegi warnings:

                      2007-12-06 08:50:31,230 [TP-Processor3] [127.0.0.1: 7BE937F424861A2E0AC65D864BC6FD04] WARN org.acegisecurity.event.authentication.LoggerListe ner - Authentication event AuthenticationFailureBadCredentialsEvent: [email protected]; details: null; exception: Bad credentials
                      06.12.2007 08:50:31 com.sun.xml.wss.impl.filter.AuthenticationTokenFil ter getUserNameTokenFromMessage
                      SCHWERWIEGEND: WSS1408: UsernameToken Authentication Failed
                      2007-12-06 08:50:31,230 [TP-Processor3] [127.0.0.1: 7BE937F424861A2E0AC65D864BC6FD04] WARN org.springframework.ws.soap.security.xwss.XwsSecur ityInterceptor - Could not validate request: com.sun.xml.wss.impl.WssSoapFaultException: Authentication of Username Password Token Failed; nested exception is com.sun.xml.wss.XWSSecurityException: com.sun.xml.wss.impl.WssSoapFaultException: Authentication of Username Password Token Failed

                      Comment


                      • #12
                        Hi,

                        I am new to spring ws. i want to add custom validation errors for soap validation error.

                        i have tried like this,

                        Endpoint added
                        public boolean resolveException (MessageContext messagecontext, Object obj,
                        Exception exception)
                        {
                        System.out.println("resolveException");
                        // TODO Auto-generated method stub
                        return false;
                        }

                        in spring.xml

                        <bean id="exceptionResolver"
                        class="org.springframework.ws.soap.server.endpoint .SoapFaultMappingExceptionResolver">
                        <property name="defaultFault" value="SERVER" />
                        <property name="exceptionMappings">
                        <props>
                        <prop key="org.springframework.oxm.ValidationFailureExce ption">
                        CLIENT, Invalid request client</prop>
                        <prop key="org.springframework.oxm.ValidationFailureExce ption">
                        SERVER, Invalid request server</prop>
                        </props>
                        </property>
                        <property name="mappedEndpoints">
                        <set>
                        <value>echoEndpoint</value> </set>
                        </property>

                        </bean>

                        <bean id="echoPayloadMapping"
                        class="org.springframework.ws.server.endpoint.mapp ing.PayloadRootQNameEndpointMapping">
                        <property name="mappings">
                        <props>
                        <prop key="{http://www.publishing.org/spedySchema}spedy">echoEndpoint</prop>
                        </props>
                        </property>
                        </bean>


                        while i am trying to tun saaj client class, its returns soap fault message instead of custom fault message.

                        Please suggest me, where i doing mistake?

                        Thanks in advance

                        Thanks & Regards,
                        Revathy Palani.

                        Comment

                        Working...
                        X