[英]Groovy WSClient and document/literal WS
I have a WS avaialbel @ http://domain.com/Service?wsdl . 我有WS avaialbel @ http://domain.com/Service?wsdl 。 The wsdl imports multiple XSD definitions.
wsdl导入多个XSD定义。 When I tried to invoke the service as shown below, i am getting an exception saying it is unable to locate the xsd's on server which is fine as the xsd's are not present there.
当我尝试如下图所示调用服务时,我收到一个异常消息,说它无法在服务器上找到xsd,这很好,因为那里不存在xsd。 My question is how to tell WSClient resolve the xsd's from classpath or file system and ignore to get them from server?
我的问题是如何告诉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
Download the WSDL & XSDs in a folder and replace all remote XSD references in WSDL with their local counterpart[Relative Path]. 将WSDL和XSD下载到一个文件夹中,并将WSDL中的所有远程XSD引用替换为其本地对应的“相对路径”。
Generate WS client and use that. 生成并使用WS客户端。
Tested many times with Axis, Metro & XFire 经过Axis,Metro和XFire的多次测试
Please feel comfortable to getback in case of any trouble. 如有任何麻烦,请随时取回。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.