2

Grails アプリで GroovyWS を使用して、外部 SOAP サーバーに接続しています。

有用な情報がないエラーが発生しているため、GroovyWS によって生成された実際の XML を確認したいと思います。

Wireshark などを使用できることはわかっていますが、もっと簡単な方法があるはずです。

オブジェクトを印刷すると、Java Object@... 文字列が印刷されるだけです。

4

1 に答える 1

1

GroovyWSは内部でApacheCXFを使用するため、ロギングインターセプターを使用してトリックを実行できるはずです。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を参照してください

于 2012-11-10T12:20:08.963 に答える