Announcement Announcement Module
Collapse
No announcement yet.
Interceptors not working for WS-addressing endpoint (@Action) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Interceptors not working for WS-addressing endpoint (@Action)

    Interceptors are not called (in 2.0.1.RELEASE) for endpoint annotated with WS-Addressing's @Action:

    springBeans.xml:
    Code:
    <sws:annotation-driven />
    ...
    <bean class="org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping" />
    ...
    <sws:interceptors>
      <bean class="org.springframework.ws.soap.server.endpoint.interceptor.SoapEnvelopeLoggingInterceptor" />
      <bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor" />
    </sws:interceptors>
    Endpoint:
    Code:
    @Action("http://xyzserver/services/DeviceInfo/GetDeviceCapabilityProfileIdRequestOneWay")
    public void getWSADeviceCapabilityProfileIdOneWay(
       @RequestPayload final GetDeviceCapabilityProfileIdRequestType request,
       final SoapHeader soapHeader) throws ReceptionSystemException
    {
      ...
    }
    Adding preInterceptors to AnnotationActionEndpointMapping works for global interceptors, but is not fulfilling our requirements for method-individual interceptors ;-(

    Is the not-execution of global interceptors (defined as shown above) a bug?
    And how to configure interceptors per Endpoint method?

  • #2
    Facing the same issue but not for all global interceptors

    Using SWS 2.0.2.
    Our configuration is as follows:

    Code:
    <sws:interceptors>
    <bean
        class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
    <bean
        class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
        <property name="schema" value="/xsd/request.xsd" />
        <property name="validateRequest" value="${request.validate}" />
        <property name="validateResponse" value="false" />
    </bean>
    <bean
        class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
        <property name="schema" value="/xsd/response.xsd" />
        <property name="validateRequest" value="false" />
        <property name="validateResponse" value="${response.validate}" />
    </bean>
    </sws:interceptors>
    The PayloadValidatingInterceptors work but the LoggingInterceptors (also tried with the SoapEnvelopeLoggingInterceptor) do not work.
    Logging is done with log4j at debug level.
    Do others face the same issue?

    Cheers, Sjoerd

    Comment


    • #3
      I am having exactly the same issue. I recently changed my endpoint to use @Action instead of the @PayloadRoot and the PayloadValidatingInterceptor stopped working. I had a look around hoping that there might be another interceptor for endpoints using WS-Addressing but as far as I can tell there are none.

      Here's what I've tried (without success):

      Code:
      <context:annotation-config/> 
      <context:component-scan base-package="package of endpoint" />
      
      <oxm:jaxb2-marshaller id="marshaller" contextPath="context path"/>	
      
      <sws:annotation-driven marshaller="marshaller" unmarshaller="marshaller" />
      
      <sws:interceptors>
         <sws:payloadInterceptor namespaceUri="uri">
           <ref bean="payloadValidatingInterceptor"/>
         </sws:payloadInterceptor>
         <!-- also tried just putting <ref bean="payloadValidatingInterceptor"/> -->
      </sws:interceptors>
      
      <bean id="payloadValidatingInterceptor"  class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
      ...
      </bean>
      Has anyone managed to solve this one.

      Cheers,
      Grigori
      Last edited by grigori.goldman; Sep 15th, 2011, 12:15 AM.

      Comment


      • #4
        I have the same problem. Is there a fix, or solution?

        Comment


        • #5
          Workaround the AnnotationActionEndpointMapping Interceptor Problem

          the following worked for me, based on java configuration
          Code:
          package de.lammers.messaging.namespace;
          
          import org.springframework.beans.factory.InitializingBean;
          import org.springframework.beans.factory.annotation.Autowired;
          import org.springframework.context.annotation.Bean;
          import org.springframework.context.annotation.Configuration;
          import org.springframework.core.io.ClassPathResource;
          import org.springframework.core.io.Resource;
          import org.springframework.ws.server.EndpointInterceptor;
          import org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping;
          import org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor;
          
          /**
           * @author Dirk Lammers
           * 
           * Java Based Spring Configuration
           * 
           */
          @Configuration
          public class TestConfigurationImpl implements NamespaceConfiguration, InitializingBean {
          
              // Pick up the AnnotationActionEndpointMapping instance, created by <sws:annotation-driven/>
              // do not throw an exception, if isn´t there, required = false
              private @Autowired(required=false)
              AnnotationActionEndpointMapping annotationActionEndpointMapping = null;
              
              /**
               * 
               * Hack for @Action EndpointMapping, 
               * 
               * @return
               * @throws Exception
               */
              public void afterPropertiesSet() throws Exception {
                  if (annotationActionEndpointMapping != null){
                      EndpointInterceptor[] postInterceptors = new EndpointInterceptor[1];
                      // add the validator interceptor for the cli namespace
                      postInterceptors[0] = cliValidatingInterceptor();
                      
                      // validate after the implicit ws-adress validation, therefore add to postInterceptors
                      annotationActionEndpointMapping.setPostInterceptors(postInterceptors);
                  }
              }
          
              @Bean
              public Resource cliSchema(){
                  ClassPathResource cr = new ClassPathResource("de/lammers/xmlschema.xsd");
                  return cr;
              }
              
              @Bean
              public PayloadValidatingInterceptor cliValidatingInterceptor(){
                  PayloadValidatingInterceptor i = new PayloadValidatingInterceptor();        
                  i.setValidateRequest(true);        
                  // Antworten von uns müssen absolut konform mit dem Schema sein, daher validieren
                  i.setValidateResponse(true);                                    
                  i.setSchema(cliSchema());        
                  return i;
              }

          Comment


          • #6
            That worked perfectly for me ... thanks.

            Comment

            Working...
            X