Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin conflicts with grails-cxf? #36

Open
JonNeat opened this issue Sep 17, 2013 · 7 comments
Open

Plugin conflicts with grails-cxf? #36

JonNeat opened this issue Sep 17, 2013 · 7 comments

Comments

@JonNeat
Copy link

JonNeat commented Sep 17, 2013

Hi all,

We try to use both grails-cxf-client for endpoints and grails-cxf for exposing simple services.

They both work independently (only configurating one), but not together - why? No error messages are thrown, nothing what so ever.

We are running with grails 2.3.0RC1. Everything newest version.:
runtime ":cxf:1.1.1"
compile ":cxf-client:1.5.6"

Can anyone help? What are we doing wrong? We even tried a whole new "hello world"-grails project, and still doesn't work.

Jon.

@ctoestreich
Copy link
Member

tested with grails 2.2.1 and https://github.com/Grails-Plugin-Consortium/grails-cxf-client-demo and they work fine together. Trying 2.3.0 now with that project.

@ctoestreich
Copy link
Member

The demo project also works find with grails 2.3.0. You can clone that here. https://github.com/Grails-Plugin-Consortium/grails-cxf-client-demo/tree/grails-2.3.0

I will need more info to help debug. It could be in your config or some other conflicting plugins??

@TobiasMahlmann
Copy link

(I'm working on the same project as the OP)
I traced the problem: it only occurs when a service (or one of the classes it references) references a bean that was created by the cxf-client plugin, i.e.

@GrailsCxfEndpoint(expose=EndpointType.SIMPLE)
class MyService {
...
}

works fine.

@GrailsCxfEndpoint(expose=EndpointType.SIMPLE)
class MyService {
  def endpointBeanWasSetupByCxfClientPluginInConfigDotGroovy
...
}

does not.

@ctoestreich
Copy link
Member

I am not sure I ever tested this. I would guess it has to do with the order of bean wiring or the cxf proxy class.

Can you wrap the cxf client in a grails service and call the FooService class that will in turn call the endpointbean class?

@TobiasMahlmann
Copy link

Hi ctoestreich,
I hope I got you right:

class FooService{
    def cxfClientEndpoint
    public String someMethod(){
       ...
    }
}

@GrailsCxfEndpoint(expose=EndpointType.SIMPLE)
class MyService {
    def fooService

    public String exposedMethod(){
      return fooService.someMethod()
   }
}

This is actually our setup, but unfortunately doesn't work. It did however work with grails 1.3.7
Would it make sense to try to not use the cxf-client plugin and write the cxf XML file ourselves?

@TobiasMahlmann
Copy link

I found a workaround for the problem:

cxf{
    client {
        targetServiceEndpoint {
           ...
        }
}

@GrailsCxfEndpoint(expose=EndpointType.SIMPLE)
class MyService{
   def grailsApplication
   MyEndpoint myEndpoint

   private MyEndpoint getEndpoint(){
        if(myEndpoint==null){
           myEndpoint = grailsApplication.getMainContext().getBean("targetServiceEndpoint")
        }
       return myEndpoint
    }

    public String exposedMethod(){
      return getEndpoint().someMethod()
   }
}

Not pretty, but works. I don't know enough about the Spring internals to make a prettier solution though.

@bilgehanm
Copy link

Had a similar problem. I have a cxf service that works fine when using cxf plugin alone. In that application i also need to consume an external service. After i add cxf-client and generate the stubs using wsdl2java, i get no service found error when trying to list services. Saw similar errors, one suggested modifying the cxf-client plugin WebServiceClientFactoryImpl class.

Bus bus = Holders.grailsApplication.mainContext.getBean("cxf") as Bus
JaxWsProxyFactoryBean clientProxyFactory = new JaxWsProxyFactoryBean(serviceClass: serviceInterface,address: serviceEndpointAddress, bus: bus)

(http://stackoverflow.com/questions/26470223/cant-get-cxf-and-cxf-client-to-work-at-the-same-time-grails). I tried with no luck. Grails version 2.4.5 and cxf client version 2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants