使用WSClient调用外部SOAP Web服务时出错
我已经创建了一个我想从Grails访问的SOAP Web服务。使用WSClient调用外部SOAP Web服务时出错
我已经安装了插件WS-客户端才能使用该对象WSClient。
我试图在这里给出的例子:http://groovy.codehaus.org/Using+WSClient+in+Grails
所以我的代码是:
def index = {
def proxy = new WSClient("http://www.w3schools.com/webservices/tempconvert.asmx?WSDL", this.class.classLoader)
proxy.initialize()
def result = proxy.CelsiusToFahrenheit(0)
result = "You are probably freezing at ${result} degrees Farhenheit"
flash.message = result
}
这是错误我得到:
javac: target release 1.5 conflicts with default source release 1.7
| Error 2013-02-27 17:47:06,901 [http-bio-8080-exec-10] ERROR errors.GrailsExceptionResolver - JAXBException occurred when processing request: [POST] /WordGame/game/create
"org.tempuri" doesnt contain ObjectFactory.class or jaxb.index. Stacktrace follows:
Message: "org.tempuri" doesnt contain ObjectFactory.class or jaxb.index
Line | Method
->> 197 | createContext in com.sun.xml.bind.v2.ContextFactory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 172 | newInstance in javax.xml.bind.ContextFinder
| 132 | newInstance . in ''
| 334 | find in ''
| 431 | newInstance . in javax.xml.bind.JAXBContext
| 349 | createClient in org.apache.cxf.endpoint.dynamic.DynamicClientFactory
| 196 | createClient in ''
| 175 | createClient in ''
| 198 | createClient in groovyx.net.ws.AbstractCXFWSClient
| 107 | initialize in groovyx.net.ws.WSClient
| 30 | conversion . in wordgame.GameController$$ENyfXWG9
| 42 | doCall in wordgame.GameController$_closure1$$ENyfXWG9
| 195 | doFilter . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 1110 | runWorker . . in java.util.concurrent.ThreadPoolExecutor
| 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . . . in java.lang.Thread
我知道有没有错误调用方法proxy.CelsiusToFahrenheit(0),因为我有同样的错误只是在做:
def proxy = new WSClient("http://www.w3schools.com/webservices/tempconvert.asmx?WSDL", this.class.classLoader)
proxy.initialize()
我试图用我已经创建了一个Web服务等,但我有同样的错误。
我对谷歌搜索,我已经看到了很多有这个问题的人,我没有找到如何解决它。
配置: Windows 7的64位 Netbeans的7.2.1 的Grails 2.2.0
难道有人知道如何解决这个问题?
从错误信息
javac: target release 1.5 conflicts with default source release 1.7
,我认为它是关于JDK版本。 WSClient需要JDK在运行时编译一些东西,所以你必须部署一个1.7版本的JDK来支持它。
感谢您的回答,但问题是从插件。为了工作,这是必须安装的插件:
CXF
CXF的客户端
安装这两个插件解决了这个问题。
我发现WS-客户端插件http://grails.org/plugin/ws-client多更巧妙的使用。虽然安装cxf是必需的。 – 2014-06-06 17:25:38
此消息刚刚消失的时候我已经安装了CXF插件 – Chewbye 2013-03-01 11:36:54