gpt4 book ai didi

java - Groovy WSClient 和文档/文字 WS

转载 作者:行者123 更新时间:2023-12-01 15:50:52 24 4
gpt4 key购买 nike

我有一个 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. 下载 a 中的 WSDL 和 XSD文件夹并替换所有远程 XSDWSDL 中的引用及其本地对应[相对路径]。

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

使用 Axis、Metro 和 XFire 进行了多次测试

如果出现任何问题,请放心返回。

关于java - Groovy WSClient 和文档/文字 WS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6074998/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com