我在Grails应用程序中使用GroovyWS连接到外部SOAP服务器。
我希望看到由GroovyWS生成的实际XML,因为我在没有任何有用信息的情况下收到错误。
打印对象只会打印Java对象@...字符串。
发布于 2012-11-10 20:20:09
GroovyWS在内部使用Apache CXF,因此您应该能够使用它的日志拦截器来完成此任务。下面的测试脚本从GroovyWS文档中剪切并粘贴温度示例,同时打印请求和响应SOAP消息:
@Grab(group='org.codehaus.groovy.modules', module='groovyws', version='0.5.2')
import groovyx.net.ws.WSClient
import org.apache.cxf.interceptor.LoggingInInterceptor
import org.apache.cxf.interceptor.LoggingOutInterceptor
proxy = new WSClient("http://www.w3schools.com/webservices/tempconvert.asmx?WSDL", this.class.classLoader)
proxy.initialize()
println proxy.client.outInterceptors.add(new LoggingOutInterceptor())
println proxy.client.inInterceptors.add(new LoggingInInterceptor())
result = proxy.CelsiusToFahrenheit(0)
println "You are probably freezing at ${result} degrees Farhenheit"请参阅http://cxf.apache.org/docs/debugging-and-logging.html
https://stackoverflow.com/questions/2087604
复制相似问题