Grails-Plugin-Consortium / grails-cxf-client

Easy cxf client for grails
http://grails.org/plugin/cxf-client
27 stars 30 forks source link

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

Closed rvanderwerf closed 8 years ago

rvanderwerf commented 8 years ago

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.

osscontributor commented 8 years ago

@ctoestreich Does this look familiar to you?

Thanks for any input. I appreciate it.

ctoestreich commented 8 years ago

Looking into it now.

ctoestreich commented 8 years ago

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.

rvanderwerf commented 8 years ago

Thanks a ton we appreciate the quick turnaround!

osscontributor commented 8 years ago

@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.

rvanderwerf commented 8 years ago

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

osscontributor commented 8 years ago

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?

rvanderwerf commented 8 years ago

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 :(

osscontributor commented 8 years ago

It looks like the commit at https://github.com/Grails-Plugin-Consortium/grails-cxf-client/commit/79d7fa2b7d6ef0b2da5de38d74d1b12b4d940140 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.