WSDLException:尝试解析引用的架构时发生错误
我正在尝试使用 windows xp 上的 eclipse Galileo 和 axis 2 1.4 从本地 WSDL 文件生成代理类。我的问题是,由于 WSDL 中导入的架构,我收到错误。令我困扰的行是:
<xsd:import namespace="http://www.w3.org/2005/05/xmlmime" schemaLocation="http://www.w3.org/2005/05/xmlmime"/>
我尝试运行以下命令运行 wsdl2java:
wsdl2java.bat -uri SOAService.wsdl -o D:\temp p test -d xmlbeans -a -s -ns2p -uw
并且出现以下异常:
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException
: Error parsing WSDL
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerat
ionEngine.java:156)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:ty
pes/xsd:schema): faultCode=OTHER_ERROR: An error occurred trying to resolve sche
ma referenced at 'http://www.w3.org/2005/05/xmlmime', relative to 'file:/D:/Prog
rammi/axis2-1.4/bin/SOAService.wsdl'.: java.net.ConnectException: Connection tim
ed out: connect
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile(
CodeGenerationEngine.java:288)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerat
ionEngine.java:111)
... 2 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.Socket.connect(Socket.java:520)
at java.net.Socket.connect(Socket.java:470)
at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:523)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:231)
at sun.net.www.http.HttpClient.New(HttpClient.java:304)
at sun.net.www.http.HttpClient.New(HttpClient.java:321)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC
onnection.java:813)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
ction.java:765)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:690)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:934)
at java.net.URL.openStream(URL.java:1007)
at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source)
我怀疑这是由于系统代理不允许将 xsd 检索到 wsdl2java 工具。事实上,我可以毫无问题地从浏览器下载文件。
有一个选项可以指定 wsdl2java 的代理,或者有人已经解决了这个问题? 目前我已经下载了 XSD,将其添加到项目中并更改了 WSDL 以包含相关文件(而不是远程文件),但我宁愿避免这种情况,因为该文件是第三方服务 WSDL 。
预先感谢您的任何提示。
I'm trying to generate a proxy class from a local WSDL file with eclipse Galileo and axis 2 1.4 on windows xp . My problem is that i get an error due to an imported schema inside the WSDL . The line tha troubles me is :
<xsd:import namespace="http://www.w3.org/2005/05/xmlmime" schemaLocation="http://www.w3.org/2005/05/xmlmime"/>
I've tried to run the wsdl2java following command:
wsdl2java.bat -uri SOAService.wsdl -o D:\temp p test -d xmlbeans -a -s -ns2p -uw
and I get the following exception:
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException
: Error parsing WSDL
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerat
ionEngine.java:156)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:ty
pes/xsd:schema): faultCode=OTHER_ERROR: An error occurred trying to resolve sche
ma referenced at 'http://www.w3.org/2005/05/xmlmime', relative to 'file:/D:/Prog
rammi/axis2-1.4/bin/SOAService.wsdl'.: java.net.ConnectException: Connection tim
ed out: connect
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile(
CodeGenerationEngine.java:288)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerat
ionEngine.java:111)
... 2 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.Socket.connect(Socket.java:520)
at java.net.Socket.connect(Socket.java:470)
at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:523)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:231)
at sun.net.www.http.HttpClient.New(HttpClient.java:304)
at sun.net.www.http.HttpClient.New(HttpClient.java:321)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC
onnection.java:813)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
ction.java:765)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:690)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:934)
at java.net.URL.openStream(URL.java:1007)
at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source)
I suspect it's due to the system proxy which doesn't let retrieve the xsd to the wsdl2java tool. In fact i can download the file from the browser without problems.
There's an option to specify a proxy to wsdl2java or someone has resolved this issue ?
For the moment i've downloaded the XSD, added it to the project and changed the WSDL to include the relative file (instead of the remote one) , but i'd prefer to avoid this , because the file is a third party service WSDL.
Thank you in advance for any hint.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想我也遇到了同样的问题,下面是我如何使用 java
-D
选项解决它,看看它是否对您有帮助。问候
I think I had the same problem and below is how I solved it using java
-D
optionSee if it helps you. Regards
根据用户的安装情况,该解决方案可能无法正常工作。解决方案中没有提及 -Dhttp.nonProxyHosts={要排除的主机列表} 选项,如果运行 Web 服务的服务器是本地的,并且引用了托管在您的环境之外的 xml 文件,或者如果您的代理是未设置为响应本地请求。
This solution may not work asis depending on the user's installation. There is no mention in the solution of the -Dhttp.nonProxyHosts={list of hosts to exclude} option which may be required if your server running the webservices is local and there are references to xml files hosted outside your environment or if your proxy is not setup to answer local requests.