clientgen生成的Web服务客户端代码无法解析wsdl

时间:2012-08-01 14:26:05

标签: jax-ws weblogic-10.x webservices-client

我的要求是为用SAP编写的webservice创建一个java客户端,并且必须部署在weblogic中。 Web方法将复杂类型作为输入参数。

我使用clientgen创建了存根类。并编写了一个独立的客户端进行测试。

还在classpath xmlbeans-1.0.jar中添加了以下jar文件wlfullclient.jar webserviceclient.jar webservice.jar

我没有将wsdl url提供给Impl对象,而是使用静态wsdl。当我运行应用程序时,它给出了以下错误。使用相同的wsdl我正在终止客户端。

javax.xml.rpc.ServiceException: Failed to parse WSDL file:/C:/xxx-LPMS/trunk/build/classes/com/xxx/xxx/webservice/client/TestService_wsdl.wsdl weblogic.wsee.wsdl.WsdlException: Failed to read wsdl file from url due to -- java.io.IOException: Invalid index
        at weblogic.wsee.jaxrpc.ServiceImpl.throwServiceException(ServiceImpl.java:169)
        at weblogic.wsee.jaxrpc.ServiceImpl.loadWsdlDefinition(ServiceImpl.java:477)
        at weblogic.wsee.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:114)
        at com.xxx.xxx.webservice.client.TestService_Impl.<init>(TestService_Impl.java:23)
        at com.xxx.xxx.webservice.client.TestService_Impl.<init>(TestService_Impl.java:13)
        at com.xxx.xxx.schnittstellen.util.StdQmCreateWSClientUtil.initServicePort(StdQmCreateWSClientUtil.java:77)
        at com.xxx.xxx.schnittstellen.util.StdQmCreateWSClientUtil.getStdQmCreateCrServiceport(StdQmCreateWSClientUtil.java:70)
        at com.xxx.xxx.schnittstellen.util.StdQmCreateWSClientUtil.StdQmCreateCr(StdQmCreateWSClientUtil.java:30)
        at com.xxx.xxx.schnittstellen.util.StdQmCreateWSClientUtil.main(StdQmCreateWSClientUtil.java:91)
    Caused by: weblogic.wsee.wsdl.WsdlException: Failed to read wsdl file from url due to -- java.io.IOException: Invalid index
        at weblogic.wsee.wsdl.WsdlReader.getDocument(WsdlReader.java:313)
        at weblogic.wsee.wsdl.WsdlDefinitions.parse(WsdlDefinitions.java:402)
        at weblogic.wsee.wsdl.WsdlDefinitions.parse(WsdlDefinitions.java:388)
        at weblogic.wsee.wsdl.WsdlFactory.parse(WsdlFactory.java:78)
        at weblogic.wsee.wsdl.WsdlFactory.parse(WsdlFactory.java:65)
        at weblogic.wsee.jaxrpc.ServiceImpl.loadWsdlDefinition(ServiceImpl.java:468)
        ... 7 more
    Caused by: java.io.IOException: Invalid index
        at weblogic.xml.domimpl.Loader.load(Loader.java:38)
        at weblogic.wsee.util.dom.DOMParser.getWebLogicDocumentImpl(DOMParser.java:168)
        at weblogic.wsee.util.dom.DOMParser.getDocument(DOMParser.java:58)
        at weblogic.wsee.wsdl.WsdlReader.getDocument(WsdlReader.java:311)
        ... 12 more
    Caused by: javax.xml.stream.XMLStreamException: Invalid index
        at weblogic.xml.stax.XMLStreamReaderBase.prime(XMLStreamReaderBase.java:80)
        at weblogic.xml.stax.XMLStreamReaderBase.setInput(XMLStreamReaderBase.java:103)
        at weblogic.xml.stax.RecyclingFactory.createXMLStreamReader(RecyclingFactory.java:35)
        at weblogic.xml.stax.XMLStreamInputFactory.createXMLStreamReader(XMLStreamInputFactory.java:49)
        at weblogic.xml.domimpl.Loader.createXMLStreamReader(Loader.java:60)
        at weblogic.xml.domimpl.Loader.load(Loader.java:34)
        ... 15 more
    Caused by: sun.misc.InvalidJarIndexException: Invalid index
        at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:766)
        at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:679)
        at sun.misc.URLClassPath.getResource(URLClassPath.java:158)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:192)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at weblogic.xml.babel.scanner.ScannerState.<init>(ScannerState.java:86)
        at weblogic.xml.babel.scanner.Scanner.<init>(Scanner.java:75)
        at weblogic.xml.babel.baseparser.BaseParser.baseScanner(BaseParser.java:172)
        at weblogic.xml.babel.baseparser.BaseParser.createScanner(BaseParser.java:164)
        at weblogic.xml.babel.baseparser.BaseParser.init(BaseParser.java:213)
        at weblogic.xml.babel.baseparser.BaseParser.<init>(BaseParser.java:84)
        at weblogic.xml.stax.XMLStreamReaderBase.prime(XMLStreamReaderBase.java:56)
        ... 20 more

1 个答案:

答案 0 :(得分:0)

我正在看一些模糊相似的东西。就我而言,连接到ClassLoader的东西正在构建一个看起来像你的无效URL。具体来说,file:/C:/blah/blah/blah语法不正确;它应该是file:///C:/blah/blah/blahsource

我很好奇你是否以与我相关的方式解决了你的问题。