嗯,我是grails的新手,所以我试图将Web服务称为练习,我在开发环境中工作时没有问题,但是当我尝试将war文件部署到我的tomcat 7服务器时,它只是不起作用。这是我一直在使用的代码
import org.grails.plugins.wsclient.service.WebService
//import groovyx.net.ws.WSClient
class CalculadoraController {
WebService webService
def index() { }
def calcular()
{
def wsdlUrl = "http://www.webservicex.net/ConvertTemperature.asmx?WSDL"
def proxy = webService.getClient(wsdlUrl)
//def proxy = new WSClient(wsdlUrl, this.class.classLoader)
//proxy.initialize()
String res = proxy.ConvertTemp(params.temp,params.from,params.to)
render res
}
}
我尝试过使用两种方法,使用webService实例和WsClient类,但两者的结果相同。这是我从tomcat的日志中获得的堆栈跟踪:
2013-03-04 06:55:23,542 [http-apr-8080-exec-5] ERROR StackTrace - Full Stack Trace:
java.lang.NullPointerException
at org.apache.cxf.endpoint.ClientImpl.<init>(ClientImpl.java:156)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:253)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:196)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:175)
at groovyx.net.ws.AbstractCXFWSClient.createClient(AbstractCXFWSClient.java:198)
at groovyx.net.ws.WSClient.initialize(WSClient.java:107)
at examen.CalculadoraController.calcular(CalculadoraController.groovy:15)
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:195)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
有什么建议吗?
感谢先生,对不起我糟糕的英语