0

我使用本教程http://java.dzone.com/articles/jax-ws-hello-world设置了 WS 服务器(Java 客户端当然可以正常工作)并尝试像这样在 Grails 项目中调用客户端:

客户端.java

public class Client {
    public static void main(String[] args) {
        GreetingImplService service = new GreetingImplService();
        Greeting greeting = service.getGreetingImplPort();
        System.out.println("------->>  Call Started");
        System.out.println(greeting.sayHello("Ali"));
        System.out.println("------->>  Call Ended");
    }
}

测试控制器.groovy

class TestController {
    def index() {
        Client.main(null);
    }
}

对于 Grails,此命令会引发异常:

Greeting greeting = service.getGreetingImplPort();

完整的堆栈跟踪在这里http://pastebin.ca/2316018

如何解决?

4

1 回答 1

0

为 Grails安装WSClient 插件,然后编写:

def proxy = webService.getClient(wsdlURL)
def result = proxy.getGreetingImplPort()
于 2013-02-20T17:18:43.537 回答