Grails-Plugin-Consortium / grails-cxf-client

Easy cxf client for grails

Home Page:http://grails.org/plugin/cxf-client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot get output interceptors handleMessage method to fire in Grails 3 version of plugin (latest)

rvanderwerf opened this issue · comments

I am having an issue where I cannot get output interceptors to fire in the latest release for Grails 3. I am trying to inject authentication headers into the outgoing message. I have a Grails 3 app, which wires in the output interceptors like so in resources.groovy:

    wsAuthHeaderInjectorOutInterceptor(wsAuthHeaderInjectorOutInterceptor) {
        grailsApplication = ref('grailsApplication')
    }

    destWsLoginHeaderInjectorOutInterceptor(DestWsLoginHeaderInjectorOutInterceptor) {
        grailsApplication = ref('grailsApplication')
    }

My methods here, never fire even though I list in the application.yml definition for the service. I see on the classes the constructure is called successfully on application startup.

 public void handleMessage(SoapMessage message) {
     System.out.println("Here I am!!!")
 }

The method above never gets fired. It calls the remote endpoint and never runs it. Doesn't seem to matter which one.

I've configured it like so:

cxf:
  proxy:
    password: 'changeme'
    port: 3128
    server: 'aproxysomehwere'
    username: 'proxy-user'
  client:
    afancyWs:
      afancyUsername: 'username'
      afancyPassword: 'password'
      afancyWsVersion: '9.8'
      afancyCulture: com.afancyholidays.ws.Culture.EN_US
      clientInterface:  com.afancyholidays.ws.IFancyFlow
      serviceEndpointAddress: 'http://demows.afancyholidays.com/FancyFlow.svc/bas'
      inInterceptors: afancyLoggingInInterceptor, springGzipInInterceptor
#      outInterceptors: wsAuthHeaderInjectorOutInterceptor, afancyLoggingOutInterceptor, springGzipOutInterceptor, sAAJOutInterceptor
      outInterceptors: wsAuthHeaderInjectorOutInterceptor
      connectionTimeout: 120000
      receiveTimeout: 120000
      enableDefaultLoggingInterceptors: false

What I am sure of: stepped through the debugger and monitored netstat, my proxy settings are being used. I am sure the bean constructor is called when initialized. I've stepped through the CXF code and don't see my interceptors in the list it builds of them to call (PhaseInterceptorChain.java). I am sure the handleMessage method is not called, verified through stdout println, logger, and debugger. I've debugged through ClientImpl and PhaseIntercepterChain class where it gathers the interceptors to invoke but I just don't see mine in the list anywhere? It does know enough to call my interface, endpoint address, etc so it has to be reading my configuration for the basics anyways. This does work on the old grails 2.x version of the plugins.

@ctoestreich Does this look familiar to you?

Thanks for any input. I appreciate it.

Looking into it now.

Found the issue. It was checking for instanceof Interceptor and was using the default groovy Interceptor. It needed to check against the cxf Interceptor. Version 3.0.1 released with fix.

Thanks a ton we appreciate the quick turnaround!

@ctoestreich Excellent. Thanks for looking into it. Will you be able to publish a release soon? We are blocked with a project which needs the fix.

Thanks again. Your help is appreciated.

@ctoestreich is this a snapshot published somewhere? I can't recall where 3.0.0-SNAPSHOT we're using came from.

I was just looking to see if snapshots are being auto published. It looks like https://github.com/Grails-Plugin-Consortium/grails-cxf-client/blob/79d7fa2b7d6ef0b2da5de38d74d1b12b4d940140/travis-build.sh would do the publish but it isn't being run. https://github.com/Grails-Plugin-Consortium/grails-cxf-client/blob/79d7fa2b7d6ef0b2da5de38d74d1b12b4d940140/.travis.yml isn't invoking travis-build.sh. @ctoestreich is that intentional?

I tried the version you tagged as 3.0.1 on our local artifactory server, but it seems the problem is not fixed, and still not seeing the outinterceptors firing :(

It looks like the commit at 79d7fa2 may contain the fix but that commit is not included under the v3.0.1 tag. See https://github.com/Grails-Plugin-Consortium/grails-cxf-client/commits/3.0.1. I am not sure what the intent was.