Grails-Plugin-Consortium / grails-cxf-client

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

Autowire PortType implementation doesn´t work #43

Open Manas101 opened 10 years ago

Manas101 commented 10 years ago

Hello, I have a problem with correct settings (propably) of cxf-client 1.6.0. My config.groovy: // cxf config cxf { client { authLdService { wsdl = "docs/wsdl/auth.wsdl" namespace = "cxf.client.ld.auth" outputDir = "src/java" clientInterface = cxf.client.ld.auth.AuthService serviceEndpointAddress = "${service.ld.url}/services/Auth" } } }

Wsdl2java script executed successfully (java classes were generated). But when I want to test a service:

class LdAuthService {

AuthService authLdService

def loginUser(String userName, String password) {
    def sid

    try {
        sid = authLdService.login(userName, password)
        return sid

    } catch (Exception e) {
        e.printStackTrace()
        throw new RuntimeException('login to LD failed')
    }
}

}

I always got a null pointer exception (at use authLdService in controller). I supposed that authLdService should be wired automatically.... What do I wrong?

Thanks a lot.

ctoestreich commented 10 years ago

What version of grails are you using?

Manas101 commented 10 years ago

Grails 2.3.7

froderik commented 9 years ago

Similar problem here on Grails 2.4.3 - also tried to use the generated classes directly but getting javax.xml.ws.WebServiceException: Port {.......}MyMessageResponderPort not found. in that case. How did you move forward?

froderik commented 9 years ago

I had some other problems also but now I got it working. (Doing anything where SOAP is involved always requires a "random changes until it works"-session.....) I think the missing thing in your code is that the clientInterface property needs to point to the interface rather than the service. Replace AuthService with AuthInterface.

I believe this issue can be closed or maybe result in better documentation.