我正在尝试使用以下教程从wsdl生成src,但在wsimport时获取异常。
http://www.mkyong.com/webservices/jax-ws/jax-ws-wsgen-tool-example/
wsimport -keep -verbose http://localhost:7001/poc-war/ServerInfoService?wsdl
获取以下错误:
var aryExample = ["ID:2","ID:3","ID:4"], aryNew = [];
for( var i in aryExample ) {
aryNew.push({ID:Number(aryExample[i].split(":")[1])});
}
console.dir(aryNew);
ServerInfoService?WSDL
C:\Program Files\Java\jdk1.8.0_102\bin>wsimport -keep -verbose http://localhost:7001/poc-war/ServerInfoService?wsdl
parsing WSDL...
[ERROR] Server returned HTTP response code: 504 for URL: http://localhost:7001/poc-war/ServerInfoService?wsdl
Failed to read the WSDL document: http://localhost:7001/poc-war/ServerInfoService?wsdl, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.
[ERROR] Could not find wsdl:service in the provided WSDL(s):
At least one WSDL with at least one service definition needs to be provided.
Failed to parse the WSDL.
答案 0 :(得分:1)
这是一个网络问题。您可以在浏览器中打开wsdl并将文本粘贴到新的.wsdl文件中,然后从硬盘驱动器URL和网络URL重新生成。
我曾经遇到网络安全问题使我无法使用某些开发工具来访问WSDL,因此在本地保留副本可以正常工作。我承认这是最好的解决办法,但如果没有更多的信息,502就不容易排除故障。