简体   繁体   中英

Groovy WSClient and document/literal WS

I have a WS avaialbel @ http://domain.com/Service?wsdl . The wsdl imports multiple XSD definitions. 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. My question is how to tell WSClient resolve the xsd's from classpath or file system and ignore to get them from server?

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. Download the WSDL & XSDs in a folder and replace all remote XSD references in WSDL with their local counterpart[Relative Path].

  2. Generate WS client and use that.

Tested many times with Axis, Metro & XFire

Please feel comfortable to getback in case of any trouble.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM