Groovy WSClient和document / literal WS

时间:2011-05-20 16:35:03

标签: java web-services groovy

我有一个WS avaialbel @ http://domain.com/Service?wsdl。 wsdl导入多个XSD定义。当我尝试调用如下所示的服务时,我得到一个例外,说它无法在服务器上找到xsd,因为xsd不存在。我的问题是如何告诉WSClient从类路径或文件系统解析xsd并忽略从服务器获取它们?

def proxy = new WSClient("http://domain/Service?wsdl", this.class.classLoader)
        proxy.initialize()



Caused by: java.lang.reflect.InvocationTargetException
    at org.apache.cxf.common.util.ReflectionInvokationHandler.invoke(ReflectionInvokationHandler.java:52)
    ... 19 more
Caused by: java.lang.RuntimeException: Error compiling schema from WSDL at {http://domain/Service/IcTransactionService?wsdl}: http://domain/Service/RequestImpl1-0.xsd
    ... 20 more
Caused by: java.io.FileNotFoundException: http://domain/Service/RequestImpl1-0.xsd
    ... 18 more
Caused by: java.io.FileNotFoundException: http://domain/Service/RequestImpl1-0.xsd
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1434)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:677)
    at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:186)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:772)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.tools.internal.xjc.reader.internalizer.DOMForest.parse(DOMForest.java:383)
    ... 16 more

1 个答案:

答案 0 :(得分:1)

  1. 下载WSDL& a 中的XSD 文件夹并替换所有远程XSD WSDL中的引用与本地引用 对应[相对路径]。

  2. 生成WS客户端并使用它。

  3. 使用Axis,Metro& amp; XFire的

    如果遇到任何麻烦,请放心回复。