Web服务Axis2客户端代码生成问题

时间:2014-04-21 16:29:55

标签: web-services wsdl axis2 axis webservice-client

我正在尝试使用Axis2构建的Web服务,因此我按照this example创建了客户端代码。

我有端点,我可以通过浏览器访问它。但尝试使用以下方法生成客户端代码:

WSDL2Java.bat -uri <<endpoint>> -o client

抛出以下异常:

  

线程中的异常&#34; main&#34; org.apache.axis2.wsdl.codegen.CodeGenerationException:解析WSDL时出错               在org.apache.axis2.wsdl.codegen.CodeGenerationEngine。(CodeGenerationEngine.java:181)               在org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)               在org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)       引起:java.net.ConnectException:连接超时:连接               at java.net.PlainSocketImpl.socketConnect(Native Method)               在java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)               在java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)               在java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)               在java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)               在java.net.Socket.connect(Socket.java:529)               at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:570)               在com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:141)               在sun.net.NetworkClient.doConnect(NetworkClient.java:163)               在sun.net.www.http.HttpClient.openServer(HttpClient.java:411)               在sun.net.www.http.HttpClient.openServer(HttpClient.java:525)               在sun.net.www.protocol.https.HttpsClient。(HttpsClient.java:272)               在sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:329)               at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)               at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:923)               at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)               at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)               at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)               at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:318)               在org.apache.axis2.wsdl.codegen.CodeGenerationEngine。(CodeGenerationEngine.java:99)               ......还有2个

出现此错误的原因是什么?

1 个答案:

答案 0 :(得分:1)

如果您可以从浏览器访问WSDL而不是从命令行中的工具访问,那么您的浏览器可能会使用HTTP代理进行连接,而wsdl2java会直接访问该地址。

尝试使用代理设置一些JVM参数,如Java Networking and Proxies中所述,如果失败,总是可以选择使用浏览器下载WSDL并使用本地下载的文件运行wsdl2java。